支持图像分类插件查看

This commit is contained in:
muwoo 2023-04-01 10:26:17 +08:00
parent a8006ec199
commit 35c9a32604
5 changed files with 109 additions and 48 deletions

View File

@ -1,10 +1,10 @@
import axios from "axios";
import axios from 'axios';
let baseURL = "https://gitcode.net/rubickcenter/rubick-database/-/raw/master";
let access_token = "";
let baseURL = 'https://gitcode.net/rubickcenter/rubick-database/-/raw/master';
let access_token = '';
try {
const dbdata = window.rubick.db.get("rubick-localhost-config");
const dbdata = window.rubick.db.get('rubick-localhost-config');
baseURL = dbdata.data.database;
access_token = dbdata.data.access_token;
} catch (e) {
@ -12,40 +12,49 @@ try {
}
const instance = axios.create({
baseURL: baseURL || "https://gitcode.net/rubickcenter/rubick-database/-/raw/master",
baseURL:
baseURL || 'https://gitcode.net/rubickcenter/rubick-database/-/raw/master',
});
export default {
async getTotalPlugins() {
let targetPath = "plugins/total-plugins.json";
let targetPath = 'plugins/total-plugins.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getFinderDetail() {
let targetPath = "plugins/finder.json";
let targetPath = 'plugins/finder.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getSystemDetail() {
let targetPath = "plugins/system.json";
let targetPath = 'plugins/system.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getWorkerDetail() {
let targetPath = "plugins/worker.json";
let targetPath = 'plugins/worker.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
@ -57,17 +66,31 @@ export default {
},
async getSearchDetail() {
let targetPath = "plugins/search.json";
let targetPath = 'plugins/search.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getDevDetail() {
let targetPath = "plugins/dev.json";
let targetPath = 'plugins/dev.json';
if (access_token) {
targetPath = `${encodeURIComponent(targetPath)}/raw?access_token=${access_token}&ref=master`
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;
},
async getImageDetail() {
let targetPath = 'plugins/image.json';
if (access_token) {
targetPath = `${encodeURIComponent(
targetPath
)}/raw?access_token=${access_token}&ref=master`;
}
const res = await instance.get(targetPath);
return res.data;

View File

@ -1,13 +1,49 @@
<template>
<div class="system">
<PluginList
v-if="system && !!system.length"
@downloadSuccess="downloadSuccess"
title="系统插件"
:list="system"
/>
</div>
</template>
<script>
export default {
name: "image"
};
<script setup>
import { ref, computed, onBeforeMount } from "vue";
import request from "../../../assets/request/index";
import PluginList from "./plugin-list.vue";
import { useStore } from "vuex";
const store = useStore();
const totalPlugins = computed(() => store.state.totalPlugins);
const data = ref([]);
onBeforeMount(async () => {
data.value = await request.getImageDetail();
});
const system = computed(() => {
const defaultData = data.value || [];
if (!defaultData.length) return [];
return defaultData.map((plugin) => {
let searchInfo = null;
totalPlugins.value.forEach((t) => {
if (t.name === plugin) {
searchInfo = t;
}
});
return searchInfo;
});
});
</script>
<style scoped>
<style lang="less">
.system {
width: 100%;
height: 100vh;
overflow-x: hidden;
box-sizing: border-box;
}
</style>

View File

@ -71,11 +71,13 @@ import System from "./components/system.vue";
import Worker from "./components/worker.vue";
import Tools from "./components/tools.vue";
import Dev from "./components/devlopment.vue";
import Image from "./components/image.vue";
const Components = {
finder: Finder,
system: System,
worker: Worker,
image: Image,
tools: Tools,
dev: Dev,
};

View File

@ -1,6 +1,6 @@
{
"name": "rubick",
"version": "2.1.6",
"version": "2.1.7",
"author": "muwoo <2424880409@qq.com>",
"private": true,
"scripts": {
@ -21,7 +21,7 @@
"dependencies": {
"@better-scroll/core": "^2.4.2",
"ant-design-vue": "^2.2.8",
"axios": "^1.3.4",
"axios": q"^1.3.4",
"core-js": "^3.6.5",
"cross-spawn": "^7.0.3",
"extract-file-icon": "^0.3.2",

View File

@ -1,22 +1,22 @@
"use strict";
'use strict';
import electron, {
app,
globalShortcut,
protocol,
BrowserWindow
} from "electron";
import { main } from "./browsers";
import commonConst from "../common/utils/commonConst";
BrowserWindow,
} from 'electron';
import { main } from './browsers';
import commonConst from '../common/utils/commonConst';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import API from "./common/api";
import createTray from "./common/tray";
import registerHotKey from "./common/registerHotKey";
import API from './common/api';
import createTray from './common/tray';
import registerHotKey from './common/registerHotKey';
import "../common/utils/localPlugin";
import "../common/utils/localConfig";
import '../common/utils/localPlugin';
import '../common/utils/localConfig';
import registerySystemPlugin from "./common/registerySystemPlugin";
import registerySystemPlugin from './common/registerySystemPlugin';
class App {
public windowCreator: { init: () => void; getWindow: () => BrowserWindow };
@ -24,7 +24,7 @@ class App {
constructor() {
protocol.registerSchemesAsPrivileged([
{ scheme: "app", privileges: { secure: true, standard: true } }
{ scheme: 'app', privileges: { secure: true, standard: true } },
]);
this.windowCreator = main();
const gotTheLock = app.requestSingleInstanceLock();
@ -66,14 +66,14 @@ class App {
);
};
if (!app.isReady()) {
app.on("ready", readyFunction);
app.on('ready', readyFunction);
} else {
readyFunction();
}
}
onRunning() {
app.on("second-instance", () => {
app.on('second-instance', () => {
// 当运行第二个实例时,将会聚焦到myWindow这个窗口
const win = this.windowCreator.getWindow();
if (win) {
@ -83,7 +83,7 @@ class App {
win.focus();
}
});
app.on("activate", () => {
app.on('activate', () => {
if (!this.windowCreator.getWindow()) {
this.createWindow();
}
@ -94,25 +94,25 @@ class App {
}
onQuit() {
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on("will-quit", () => {
app.on('will-quit', () => {
globalShortcut.unregisterAll();
});
if (commonConst.dev()) {
if (process.platform === "win32") {
process.on("message", data => {
if (data === "graceful-exit") {
if (process.platform === 'win32') {
process.on('message', (data) => {
if (data === 'graceful-exit') {
app.quit();
}
});
} else {
process.on("SIGTERM", () => {
process.on('SIGTERM', () => {
app.quit();
});
}