fix: webui github proxy selector and bugs after uninstalling plugins (#4724)
fixes: #4709
This commit is contained in:
@@ -121,6 +121,13 @@ export default {
|
||||
this.selectedGitHubProxy = localStorage.getItem('selectedGitHubProxy') || "";
|
||||
this.radioValue = localStorage.getItem('githubProxyRadioValue') || "0";
|
||||
this.githubProxyRadioControl = localStorage.getItem('githubProxyRadioControl') || "0";
|
||||
if (this.radioValue === "1") {
|
||||
if (this.githubProxyRadioControl !== "-1") {
|
||||
this.selectedGitHubProxy = this.githubProxies[this.githubProxyRadioControl] || "";
|
||||
}
|
||||
} else {
|
||||
this.selectedGitHubProxy = "";
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
selectedGitHubProxy: function (newVal, oldVal) {
|
||||
@@ -133,10 +140,16 @@ export default {
|
||||
localStorage.setItem('githubProxyRadioValue', newVal);
|
||||
if (newVal === "0") {
|
||||
this.selectedGitHubProxy = "";
|
||||
} else if (this.githubProxyRadioControl !== "-1") {
|
||||
this.selectedGitHubProxy = this.githubProxies[this.githubProxyRadioControl] || "";
|
||||
}
|
||||
},
|
||||
githubProxyRadioControl: function (newVal) {
|
||||
localStorage.setItem('githubProxyRadioControl', newVal);
|
||||
if (this.radioValue !== "1") {
|
||||
this.selectedGitHubProxy = "";
|
||||
return;
|
||||
}
|
||||
if (newVal !== "-1") {
|
||||
this.selectedGitHubProxy = this.githubProxies[newVal] || "";
|
||||
} else {
|
||||
@@ -151,4 +164,4 @@ export default {
|
||||
.v-label {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -46,6 +46,13 @@ let releases = ref([]);
|
||||
let updatingDashboardLoading = ref(false);
|
||||
let installLoading = ref(false);
|
||||
|
||||
const getSelectedGitHubProxy = () => {
|
||||
if (typeof window === "undefined" || !window.localStorage) return "";
|
||||
return localStorage.getItem("githubProxyRadioValue") === "1"
|
||||
? localStorage.getItem("selectedGitHubProxy") || ""
|
||||
: "";
|
||||
};
|
||||
|
||||
// Release Notes Modal
|
||||
let releaseNotesDialog = ref(false);
|
||||
let selectedReleaseNotes = ref('');
|
||||
@@ -204,7 +211,7 @@ function switchVersion(version: string) {
|
||||
installLoading.value = true;
|
||||
axios.post('/api/update/do', {
|
||||
version: version,
|
||||
proxy: localStorage.getItem('selectedGitHubProxy') || ''
|
||||
proxy: getSelectedGitHubProxy()
|
||||
})
|
||||
.then((res) => {
|
||||
updateStatus.value = res.data.message;
|
||||
@@ -796,4 +803,4 @@ const changeLanguage = async (langCode: string) => {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -22,6 +22,13 @@ const { t } = useI18n();
|
||||
const { tm } = useModuleI18n("features/extension");
|
||||
const router = useRouter();
|
||||
|
||||
const getSelectedGitHubProxy = () => {
|
||||
if (typeof window === "undefined" || !window.localStorage) return "";
|
||||
return localStorage.getItem("githubProxyRadioValue") === "1"
|
||||
? localStorage.getItem("selectedGitHubProxy") || ""
|
||||
: "";
|
||||
};
|
||||
|
||||
// 检查指令冲突并提示
|
||||
const conflictDialog = reactive({
|
||||
show: false,
|
||||
@@ -299,7 +306,8 @@ const paginatedPlugins = computed(() => {
|
||||
});
|
||||
|
||||
const updatableExtensions = computed(() => {
|
||||
return extension_data?.data?.filter((ext) => ext.has_update) || [];
|
||||
const data = Array.isArray(extension_data?.data) ? extension_data.data : [];
|
||||
return data.filter((ext) => ext.has_update);
|
||||
});
|
||||
|
||||
// 方法
|
||||
@@ -430,7 +438,8 @@ const handleUninstallConfirm = (options) => {
|
||||
|
||||
const updateExtension = async (extension_name, forceUpdate = false) => {
|
||||
// 查找插件信息
|
||||
const ext = extension_data.data?.find((e) => e.name === extension_name);
|
||||
const data = Array.isArray(extension_data?.data) ? extension_data.data : [];
|
||||
const ext = data.find((e) => e.name === extension_name);
|
||||
|
||||
// 如果没有检测到更新且不是强制更新,则弹窗确认
|
||||
if (!ext?.has_update && !forceUpdate) {
|
||||
@@ -444,7 +453,7 @@ const updateExtension = async (extension_name, forceUpdate = false) => {
|
||||
try {
|
||||
const res = await axios.post("/api/plugin/update", {
|
||||
name: extension_name,
|
||||
proxy: localStorage.getItem("selectedGitHubProxy") || "",
|
||||
proxy: getSelectedGitHubProxy(),
|
||||
});
|
||||
|
||||
if (res.data.status === "error") {
|
||||
@@ -513,7 +522,7 @@ const updateAllExtensions = async () => {
|
||||
try {
|
||||
const res = await axios.post("/api/plugin/update-all", {
|
||||
names: targets,
|
||||
proxy: localStorage.getItem("selectedGitHubProxy") || "",
|
||||
proxy: getSelectedGitHubProxy(),
|
||||
});
|
||||
|
||||
if (res.data.status === "error") {
|
||||
@@ -932,7 +941,7 @@ const newExtension = async () => {
|
||||
axios
|
||||
.post("/api/plugin/install", {
|
||||
url: extension_url.value,
|
||||
proxy: localStorage.getItem("selectedGitHubProxy") || "",
|
||||
proxy: getSelectedGitHubProxy(),
|
||||
})
|
||||
.then(async (res) => {
|
||||
loading_.value = false;
|
||||
|
||||
@@ -580,6 +580,12 @@ export default {
|
||||
this.getProviderList();
|
||||
},
|
||||
methods: {
|
||||
getSelectedGitHubProxy() {
|
||||
if (typeof window === "undefined" || !window.localStorage) return "";
|
||||
return localStorage.getItem("githubProxyRadioValue") === "1"
|
||||
? localStorage.getItem("selectedGitHubProxy") || ""
|
||||
: "";
|
||||
},
|
||||
llmModelProps(providerConfig) {
|
||||
return {
|
||||
title: providerConfig.llm_model || providerConfig.id,
|
||||
@@ -675,7 +681,7 @@ export default {
|
||||
try {
|
||||
const response = await axios.post('/api/plugin/update', {
|
||||
name: 'astrbot_plugin_knowledge_base',
|
||||
proxy: localStorage.getItem('selectedGitHubProxy') || ""
|
||||
proxy: this.getSelectedGitHubProxy()
|
||||
});
|
||||
|
||||
if (response.data.status === 'ok') {
|
||||
@@ -699,7 +705,7 @@ export default {
|
||||
this.installing = true;
|
||||
axios.post('/api/plugin/install', {
|
||||
url: "https://github.com/lxfight/astrbot_plugin_knowledge_base",
|
||||
proxy: localStorage.getItem('selectedGitHubProxy') || ""
|
||||
proxy: this.getSelectedGitHubProxy()
|
||||
})
|
||||
.then(response => {
|
||||
if (response.data.status === 'ok') {
|
||||
|
||||
Reference in New Issue
Block a user