mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-30 07:39:54 +08:00
✨ 支持内网部署配置能力
This commit is contained in:
@@ -1,30 +1,53 @@
|
||||
import axios from "axios";
|
||||
|
||||
let baseURL = "https://gitee.com/monkeyWang/rubick-database/raw/master";
|
||||
let access_token = "";
|
||||
|
||||
try {
|
||||
const dbdata = window.rubick.db.get("rubick-localhost-config");
|
||||
baseURL = dbdata.data.database;
|
||||
access_token = dbdata.data.access_token;
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: baseURL || "https://gitee.com/monkeyWang/rubick-database/raw/master",
|
||||
});
|
||||
|
||||
export default {
|
||||
async getTotalPlugins() {
|
||||
const res = await axios.get(
|
||||
"https://gitee.com/monkeyWang/rubick-database/raw/master/plugins/total-plugins.json"
|
||||
);
|
||||
let targetPath = "plugins/total-plugins.json";
|
||||
if (access_token) {
|
||||
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
|
||||
}
|
||||
const res = await instance.get(targetPath);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async getFinderDetail() {
|
||||
const res = await axios.get(
|
||||
"https://gitee.com/monkeyWang/rubick-database/raw/master/plugins/finder.json"
|
||||
);
|
||||
let targetPath = "plugins/finder.json";
|
||||
if (access_token) {
|
||||
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
|
||||
}
|
||||
const res = await instance.get(targetPath);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async getSystemDetail() {
|
||||
const res = await axios.get(
|
||||
"https://gitee.com/monkeyWang/rubick-database/raw/master/plugins/system.json"
|
||||
);
|
||||
let targetPath = "/plugins/system.json";
|
||||
if (access_token) {
|
||||
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
|
||||
}
|
||||
const res = await instance.get(targetPath);
|
||||
return res.data;
|
||||
},
|
||||
async getWorkerDetail() {
|
||||
const res = await axios.get(
|
||||
"https://gitee.com/monkeyWang/rubick-database/raw/master/plugins/worker.json"
|
||||
);
|
||||
let targetPath = "/plugins/worker.json";
|
||||
if (access_token) {
|
||||
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
|
||||
}
|
||||
const res = await instance.get(targetPath);
|
||||
return res.data;
|
||||
},
|
||||
|
||||
@@ -33,16 +56,20 @@ export default {
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async getSearchDetail(url: string) {
|
||||
const res = await axios.get(
|
||||
"https://gitee.com/monkeyWang/rubick-database/raw/master/plugins/search.json"
|
||||
);
|
||||
async getSearchDetail() {
|
||||
let targetPath = "/plugins/search.json";
|
||||
if (access_token) {
|
||||
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
|
||||
}
|
||||
const res = await instance.get(targetPath);
|
||||
return res.data;
|
||||
},
|
||||
async getDevDetail(url: string) {
|
||||
const res = await axios.get(
|
||||
"https://gitee.com/monkeyWang/rubick-database/raw/master/plugins/dev.json"
|
||||
);
|
||||
async getDevDetail() {
|
||||
let targetPath = "/plugins/dev.json";
|
||||
if (access_token) {
|
||||
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
|
||||
}
|
||||
const res = await instance.get(targetPath);
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user