diff --git a/web/i18n/en-US/plugin.ts b/web/i18n/en-US/plugin.ts
index cf9df89a6b..bc89f76f61 100644
--- a/web/i18n/en-US/plugin.ts
+++ b/web/i18n/en-US/plugin.ts
@@ -114,6 +114,54 @@ const translation = {
admins: 'Admins',
noone: 'No one',
},
+ autoUpdate: {
+ automaticUpdates: 'Automatic updates',
+ updateTime: 'Update time',
+ specifyPluginsToUpdate: 'Specify plugins to update',
+ strategy: {
+ disabled: {
+ name: 'Disabled',
+ description: 'Plugins will not auto-update',
+ },
+ fixOnly: {
+ name: 'Fix Only',
+ description: 'Auto-update for patch versions only (e.g., 1.0.1 → 1.0.2). Minor version changes won\'t trigger updates.',
+ selectedDescription: 'Auto-update for patch versions only',
+ },
+ latest: {
+ name: 'Latest',
+ description: 'Always update to latest version',
+ selectedDescription: 'Always update to latest version',
+ },
+ },
+ updateTimeTitle: 'Update time',
+ upgradeMode: {
+ all: 'Update all',
+ exclude: 'Exclude selected',
+ partial: 'Only selected',
+ },
+ upgradeModePlaceholder: {
+ exclude: 'Selected plugins will not auto-update',
+ partial: 'Only selected plugins will auto-update. No plugins are currently selected, so no plugins will auto-update.',
+ },
+ excludeUpdate: 'The following {{num}} plugins will not auto-update',
+ partialUPdate: 'Only the following {{num}} plugins will auto-update',
+ operation: {
+ clearAll: 'Clear all',
+ select: 'Select plugins',
+ },
+ nextUpdateTime: 'Next auto-update: {{time}}',
+ pluginDowngradeWarning: {
+ title: 'Plugin Downgrade',
+ description: 'Auto-update is currently enabled for this plugin. Downgrading the version may cause your changes to be overwritten during the next automatic update.',
+ downgrade: 'Downgrade anyway',
+ exclude: 'Exclude from auto-update',
+ },
+ noPluginPlaceholder: {
+ noFound: 'No plugins were found',
+ noInstalled: 'No plugins installed',
+ },
+ },
pluginInfoModal: {
title: 'Plugin info',
repository: 'Repository',
diff --git a/web/i18n/zh-Hans/plugin.ts b/web/i18n/zh-Hans/plugin.ts
index 89cdddc1e3..c7e18ed94f 100644
--- a/web/i18n/zh-Hans/plugin.ts
+++ b/web/i18n/zh-Hans/plugin.ts
@@ -114,6 +114,54 @@ const translation = {
admins: '管理员',
noone: '无人',
},
+ autoUpdate: {
+ automaticUpdates: '自动更新',
+ updateTime: '更新时间',
+ specifyPluginsToUpdate: '指定要更新的插件',
+ strategy: {
+ disabled: {
+ name: '禁用',
+ description: '插件将不会自动更新',
+ },
+ fixOnly: {
+ name: '仅修复',
+ description: '仅自动更新补丁版本(例如,1.0.1 → 1.0.2)。次要版本更改不会触发更新。',
+ selectedDescription: '仅自动更新补丁版本',
+ },
+ latest: {
+ name: '最新',
+ description: '始终更新到最新版本',
+ selectedDescription: '始终更新到最新版本',
+ },
+ },
+ updateTimeTitle: '更新时间',
+ upgradeMode: {
+ all: '更新全部',
+ exclude: '排除选定',
+ partial: '仅选定',
+ },
+ upgradeModePlaceholder: {
+ exclude: '选定的插件将不会自动更新',
+ partial: '仅选定的插件将自动更新。目前未选择任何插件,因此不会自动更新任何插件。',
+ },
+ excludeUpdate: '以下 {{num}} 个插件将不会自动更新',
+ partialUPdate: '仅以下 {{num}} 个插件将自动更新',
+ operation: {
+ clearAll: '清除所有',
+ select: '选择插件',
+ },
+ nextUpdateTime: '下次自动更新时间: {{time}}',
+ pluginDowngradeWarning: {
+ title: '插件降级',
+ description: '此插件目前已启用自动更新。降级版本可能会导致您的更改在下次自动更新时被覆盖。',
+ downgrade: '仍然降级',
+ exclude: '从自动更新中排除',
+ },
+ noPluginPlaceholder: {
+ noFound: '未找到插件',
+ noInstalled: '未安装插件',
+ },
+ },
pluginInfoModal: {
title: '插件信息',
repository: '仓库',
diff --git a/web/service/use-plugins.ts b/web/service/use-plugins.ts
index ff092bb037..86f8134a5d 100644
--- a/web/service/use-plugins.ts
+++ b/web/service/use-plugins.ts
@@ -13,7 +13,6 @@ import type {
InstalledLatestVersionResponse,
InstalledPluginListWithTotalResponse,
PackageDependency,
- Permissions,
Plugin,
PluginDeclaration,
PluginDetail,
@@ -22,6 +21,7 @@ import type {
PluginType,
PluginsFromMarketplaceByInfoResponse,
PluginsFromMarketplaceResponse,
+ ReferenceSetting,
VersionInfo,
VersionListResponse,
uploadGitHubResponse,
@@ -40,7 +40,7 @@ import {
useQueryClient,
} from '@tanstack/react-query'
import { useInvalidateAllBuiltInTools } from './use-tools'
-import usePermission from '@/app/components/plugins/plugin-page/use-permission'
+import useReferenceSetting from '@/app/components/plugins/plugin-page/use-reference-setting'
import { uninstallPlugin } from '@/service/plugins'
import useRefreshPluginList from '@/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list'
import { cloneDeep } from 'lodash-es'
@@ -350,37 +350,45 @@ export const useDebugKey = () => {
})
}
-const usePermissionsKey = [NAME_SPACE, 'permissions']
-export const usePermissions = () => {
+const useReferenceSettingKey = [NAME_SPACE, 'referenceSettings']
+export const useReferenceSettings = () => {
return useQuery({
- queryKey: usePermissionsKey,
- queryFn: () => get
('/workspaces/current/plugin/permission/fetch'),
+ queryKey: useReferenceSettingKey,
+ queryFn: () => get('/workspaces/current/plugin/preferences/fetch'),
})
}
-export const useInvalidatePermissions = () => {
+export const useInvalidateReferenceSettings = () => {
const queryClient = useQueryClient()
return () => {
queryClient.invalidateQueries(
{
- queryKey: usePermissionsKey,
+ queryKey: useReferenceSettingKey,
})
}
}
-export const useMutationPermissions = ({
+export const useMutationReferenceSettings = ({
onSuccess,
}: {
onSuccess?: () => void
}) => {
return useMutation({
- mutationFn: (payload: Permissions) => {
- return post('/workspaces/current/plugin/permission/change', { body: payload })
+ mutationFn: (payload: ReferenceSetting) => {
+ return post('/workspaces/current/plugin/preferences/change', { body: payload })
},
onSuccess,
})
}
+export const useRemoveAutoUpgrade = () => {
+ return useMutation({
+ mutationFn: (payload: { plugin_id: string }) => {
+ return post('/workspaces/current/plugin/preferences/autoupgrade/exclude', { body: payload })
+ },
+ })
+}
+
export const useMutationPluginsFromMarketplace = () => {
return useMutation({
mutationFn: (pluginsSearchParams: PluginsSearchParams) => {
@@ -427,6 +435,39 @@ export const useFetchPluginsInMarketPlaceByIds = (unique_identifiers: string[],
})
}
+export const useFetchPluginListOrBundleList = (pluginsSearchParams: PluginsSearchParams) => {
+ return useQuery({
+ queryKey: [NAME_SPACE, 'fetchPluginListOrBundleList', pluginsSearchParams],
+ queryFn: () => {
+ const {
+ query,
+ sortBy,
+ sortOrder,
+ category,
+ tags,
+ exclude,
+ type,
+ page = 1,
+ pageSize = 40,
+ } = pluginsSearchParams
+ const pluginOrBundle = type === 'bundle' ? 'bundles' : 'plugins'
+ return postMarketplace<{ data: PluginsFromMarketplaceResponse }>(`/${pluginOrBundle}/search/advanced`, {
+ body: {
+ page,
+ page_size: pageSize,
+ query,
+ sort_by: sortBy,
+ sort_order: sortOrder,
+ category: category !== 'all' ? category : '',
+ tags,
+ exclude,
+ type,
+ },
+ })
+ },
+ })
+}
+
export const useFetchPluginsInMarketPlaceByInfo = (infos: Record[]) => {
return useQuery({
queryKey: [NAME_SPACE, 'fetchPluginsInMarketPlaceByInfo', infos],
@@ -448,7 +489,7 @@ const usePluginTaskListKey = [NAME_SPACE, 'pluginTaskList']
export const usePluginTaskList = (category?: PluginType) => {
const {
canManagement,
- } = usePermission()
+ } = useReferenceSetting()
const { refreshPluginList } = useRefreshPluginList()
const {
data,