mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-20 09:07:23 -05:00
Signed per-component updater, release 1.1.55
This commit is contained in:
@@ -330,19 +330,6 @@ class FileUpdater {
|
||||
return changed ? Buffer.from(text, 'utf8') : buf;
|
||||
}
|
||||
|
||||
async repoTree(root) {
|
||||
const out = [];
|
||||
for (let page = 1; page <= 50; page++) {
|
||||
const url = `${REPO_API}${root}/repository/tree?recursive=true&per_page=100&ref=main&page=${page}`;
|
||||
return fetchBuffer(`${REPO_API}${root}/repository/files/${file}/raw?ref=main`, { headers: this.liveHeaders(), maxBytes: MAX_FILE, hosts: LIVE_HOSTS });
|
||||
const items = JSON.parse(raw.toString('utf8'));
|
||||
if (!Array.isArray(items) || items.length === 0) break;
|
||||
out.push(...items);
|
||||
if (items.length < 100) break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
async loadArchive(root) {
|
||||
const buf = await fetchBuffer(`${REPO_API}${root}/repository/archive.zip?sha=main`, { headers: this.liveHeaders(), maxBytes: 600 * 1024 * 1024, hosts: LIVE_HOSTS });
|
||||
const zip = new AdmZip(buf);
|
||||
@@ -363,7 +350,7 @@ class FileUpdater {
|
||||
const parts = rel.split('/');
|
||||
const root = parts.shift();
|
||||
const file = encodeURIComponent(parts.join('/'));
|
||||
return fetchBuffer(`${REPO_API}${root}/repository/files/${file}/raw?ref=main`, { maxBytes: MAX_FILE, hosts: LIVE_HOSTS });
|
||||
return fetchBuffer(`${REPO_API}${root}/repository/files/${file}/raw?ref=main`, { headers: this.liveHeaders(), maxBytes: MAX_FILE, hosts: LIVE_HOSTS });
|
||||
}
|
||||
|
||||
async headCommit(root) {
|
||||
@@ -550,6 +537,19 @@ class FileUpdater {
|
||||
return found;
|
||||
}
|
||||
|
||||
recoverSdk() {
|
||||
for (const root of [this.appDataPath, path.join(this.appDataPath, 'frontend'), path.join(this.appDataPath, 'player')]) {
|
||||
const dir = path.join(root, 'node_modules', ...SDK_NAME.split('/'));
|
||||
const old = `${dir}.vyla-old`;
|
||||
const stage = `${dir}.vyla-new`;
|
||||
try {
|
||||
if (!fs.existsSync(dir) && fs.existsSync(old)) fs.renameSync(old, dir);
|
||||
fs.rmSync(stage, { recursive: true, force: true });
|
||||
if (fs.existsSync(dir)) fs.rmSync(old, { recursive: true, force: true });
|
||||
} catch (e) { }
|
||||
}
|
||||
}
|
||||
|
||||
async checkSdk() {
|
||||
const raw = await fetchBuffer(SDK_LATEST_URL, {
|
||||
headers: this.sdkHeaders(),
|
||||
|
||||
Reference in New Issue
Block a user