clear code

This commit is contained in:
2025-04-03 01:08:37 +08:00
parent aadd8266b1
commit 43ce37b1ce
21 changed files with 269 additions and 1868 deletions

View File

@@ -1,5 +1,6 @@
import path from 'path';
import fs from 'fs';
import { storage } from '../query.ts';
type DownloadTask = {
downloadPath: string;
@@ -62,8 +63,13 @@ export const installApp = async (app: Package, opts: InstallAppOpts = {}) => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
console.log('downloadUrl', downloadUrl);
const res = await fetch(downloadUrl);
console.log('downloadUrwl', downloadUrl);
const token = process.env.KEVISUAL_TOKEN || storage.getItem('token');
const fetchURL = new URL(downloadUrl);
if (token) {
fetchURL.searchParams.set('token', token);
}
const res = await fetch(fetchURL.toString());
const blob = await res.blob();
fs.writeFileSync(downloadPath, Buffer.from(await blob.arrayBuffer()));
}