mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Fix http json loading
This commit is contained in:
parent
c2b78951a7
commit
7774a2a14a
|
@ -93,7 +93,9 @@ export const Drives = ({ cpu, io, sectors, enhanced, ready }: DrivesProps) => {
|
||||||
for (const drive of [1, 2] as DriveNumber[]) {
|
for (const drive of [1, 2] as DriveNumber[]) {
|
||||||
if (hashParts && hashParts[drive]) {
|
if (hashParts && hashParts[drive]) {
|
||||||
const hashPart = decodeURIComponent(hashParts[drive]);
|
const hashPart = decodeURIComponent(hashParts[drive]);
|
||||||
if (hashPart.match(/^https?:/)) {
|
const isHttp = hashPart.match(/^https?:/i);
|
||||||
|
const isJson = hashPart.match(/\.json$/i);
|
||||||
|
if (isHttp && !isJson) {
|
||||||
loading++;
|
loading++;
|
||||||
controllers.push(spawn(async (signal) => {
|
controllers.push(spawn(async (signal) => {
|
||||||
try {
|
try {
|
||||||
|
@ -113,7 +115,7 @@ export const Drives = ({ cpu, io, sectors, enhanced, ready }: DrivesProps) => {
|
||||||
setTotal(0);
|
setTotal(0);
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
const url = `/json/disks/${hashPart}.json`;
|
const url = isHttp ? hashPart : `/json/disks/${hashPart}.json`;
|
||||||
loadJSON(disk2, drive, url).catch((e) => setError(e));
|
loadJSON(disk2, drive, url).catch((e) => setError(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user