wip fix
This commit is contained in:
parent
dab31e6ab2
commit
c140f98441
|
|
@ -69,10 +69,18 @@ export const fetchViaProxy = async (
|
||||||
(Array.isArray(data) && data[0] instanceof File)
|
(Array.isArray(data) && data[0] instanceof File)
|
||||||
) {
|
) {
|
||||||
if (data instanceof File) {
|
if (data instanceof File) {
|
||||||
const res = await fetch(url, { body: data, headers: _headers });
|
const res = await fetch(url, {
|
||||||
|
body: data,
|
||||||
|
method: "POST",
|
||||||
|
headers: _headers,
|
||||||
|
});
|
||||||
return await res.text();
|
return await res.text();
|
||||||
} else {
|
} else {
|
||||||
const res = await fetch(url, { body: data[0], headers: _headers });
|
const res = await fetch(url, {
|
||||||
|
body: data[0],
|
||||||
|
method: "POST",
|
||||||
|
headers: _headers,
|
||||||
|
});
|
||||||
return await res.text();
|
return await res.text();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -14,38 +14,35 @@ export const viLoadSnapshot = async (p: PG) => {
|
||||||
try {
|
try {
|
||||||
const apiURL = new URL(api_url);
|
const apiURL = new URL(api_url);
|
||||||
if (api_url && apiURL.hostname) {
|
if (api_url && apiURL.hostname) {
|
||||||
try {
|
await loadApiProxyDef(api_url, true);
|
||||||
await loadApiProxyDef(api_url, true);
|
|
||||||
|
|
||||||
const api = w.prasiApi[api_url];
|
const api = w.prasiApi[api_url];
|
||||||
if (api && api.apiTypes && api.prismaTypes) {
|
if (api && api.apiTypes && api.prismaTypes) {
|
||||||
const zip = JSON.stringify({
|
const zip = JSON.stringify({
|
||||||
api: api.apiTypes,
|
api: api.apiTypes,
|
||||||
prisma: api.prismaTypes,
|
prisma: api.prismaTypes,
|
||||||
});
|
});
|
||||||
const hash = hashCode(zip);
|
const hash = hashCode(zip);
|
||||||
const res = await p.sync?.code.action({
|
const res = await p.sync?.code.action({
|
||||||
type: "check-typings",
|
type: "check-typings",
|
||||||
|
site_id: p.site.id,
|
||||||
|
hash,
|
||||||
|
});
|
||||||
|
if (res?.type === "check-typings" && !res.hash) {
|
||||||
|
const body = Buffer.from(compress(encoder.encode(zip)));
|
||||||
|
p.sync?.code.action({
|
||||||
|
type: "push-typings",
|
||||||
site_id: p.site.id,
|
site_id: p.site.id,
|
||||||
|
body,
|
||||||
hash,
|
hash,
|
||||||
});
|
});
|
||||||
if (res?.type === "check-typings" && !res.hash) {
|
|
||||||
const body = Buffer.from(compress(encoder.encode(zip)));
|
|
||||||
p.sync?.code.action({
|
|
||||||
type: "push-typings",
|
|
||||||
site_id: p.site.id,
|
|
||||||
body,
|
|
||||||
hash,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
console.warn("Failed to load API:", api_url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
console.warn("Failed to load API:", api_url);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(p.site.code);
|
|
||||||
if (p.site.code.snapshot) {
|
if (p.site.code.snapshot) {
|
||||||
for (const [name, build] of Object.entries(p.site.code.snapshot)) {
|
for (const [name, build] of Object.entries(p.site.code.snapshot)) {
|
||||||
const doc = new Y.Doc();
|
const doc = new Y.Doc();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue