update: 优化部署

This commit is contained in:
2025-06-18 22:42:39 +08:00
parent c021beb576
commit b239dae9e3
5 changed files with 32 additions and 7 deletions

View File

@@ -31,11 +31,12 @@ type Options = {
hash?: string;
[key: string]: any;
};
export const fetchLink = async (url: string, opts?: Options) => {
export const fetchLink = async (url: string = '', opts?: Options) => {
const token = process.env.KEVISUAL_TOKEN || storage.getItem('token');
const fetchURL = new URL(url);
const check = opts?.check ?? false;
const setToken = opts?.setToken ?? true;
const isKevisual = !!url.includes('kevisual');
const setToken = opts?.setToken ?? isKevisual;
if (check) {
if (!url.startsWith(baseURL)) {
throw new Error('url must start with ' + baseURL);