mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 11:49:02 +08:00
feat(auth): 添加设备在线状态上报和UUID功能
添加设备UUID生成和存储功能,实现设备在线状态上报API 新增oauth_report_online和oauth_get_device_uuid命令 优化OAuth token处理流程,支持JWT格式解析
This commit is contained in:
@@ -39,7 +39,11 @@ interface PluginStats {
|
||||
export const PluginManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
const { t } = useTranslation()
|
||||
const [data, setData] = useState<Plugin[]>([])
|
||||
const [stats, setStats] = useState<PluginStats>({ total_plugins: 0, enabled_plugins: 0, disabled_plugins: 0 })
|
||||
const [stats, setStats] = useState<PluginStats>({
|
||||
total_plugins: 0,
|
||||
enabled_plugins: 0,
|
||||
disabled_plugins: 0,
|
||||
})
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [installModalVisible, setInstallModalVisible] = useState(false)
|
||||
const [installLoading, setInstallLoading] = useState(false)
|
||||
@@ -180,7 +184,15 @@ export const PluginManager: React.FC<{ canEdit: boolean }> = ({ canEdit }) => {
|
||||
key: "description",
|
||||
render: (desc?: string) => (
|
||||
<Tooltip title={desc}>
|
||||
<span style={{ maxWidth: 200, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", display: "block" }}>
|
||||
<span
|
||||
style={{
|
||||
maxWidth: 200,
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
whiteSpace: "nowrap",
|
||||
display: "block",
|
||||
}}
|
||||
>
|
||||
{desc || "-"}
|
||||
</span>
|
||||
</Tooltip>
|
||||
|
||||
@@ -151,7 +151,9 @@ export class PluginRuntime {
|
||||
typeof (defaultExport as Record<string, unknown>).setup === "function"
|
||||
) {
|
||||
return {
|
||||
setup: ((defaultExport as Record<string, unknown>).setup as PluginSetup).bind(defaultExport),
|
||||
setup: ((defaultExport as Record<string, unknown>).setup as PluginSetup).bind(
|
||||
defaultExport
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +175,10 @@ export class PluginRuntime {
|
||||
runtimeModule: pluginRuntimeModule,
|
||||
disposers: Array<() => void>
|
||||
): PluginContext {
|
||||
const registerEvent = (event: PluginHostEvent, handler: (detail: any) => void): (() => void) => {
|
||||
const registerEvent = (
|
||||
event: PluginHostEvent,
|
||||
handler: (detail: any) => void
|
||||
): (() => void) => {
|
||||
const eventName = PLUGIN_EVENT_MAP[event]
|
||||
const listener = (nativeEvent: Event) => {
|
||||
handler((nativeEvent as CustomEvent<any>)?.detail)
|
||||
|
||||
+37
-6
@@ -548,6 +548,23 @@ const api = {
|
||||
success: boolean
|
||||
message?: string
|
||||
}> => invoke("oauth_stop_callback_server"),
|
||||
oauthReportOnline: (
|
||||
platformId: string,
|
||||
deviceType: string,
|
||||
customData?: any
|
||||
): Promise<{
|
||||
success: boolean
|
||||
data: {
|
||||
success: boolean
|
||||
message: string
|
||||
}
|
||||
message?: string
|
||||
}> => invoke("oauth_report_online", { platformId, deviceType, customData }),
|
||||
oauthGetDeviceUuid: (): Promise<{
|
||||
success: boolean
|
||||
data: string
|
||||
message?: string
|
||||
}> => invoke("oauth_get_device_uuid"),
|
||||
|
||||
// Data import/export
|
||||
exportDataJson: (): Promise<{ success: boolean; data: string }> => invoke("data_export_json"),
|
||||
@@ -721,7 +738,9 @@ const api = {
|
||||
data?: any[]
|
||||
message?: string
|
||||
}> => invoke("plugin_get_all"),
|
||||
pluginGet: (pluginId: string): Promise<{
|
||||
pluginGet: (
|
||||
pluginId: string
|
||||
): Promise<{
|
||||
success: boolean
|
||||
data?: any
|
||||
message?: string
|
||||
@@ -735,25 +754,37 @@ const api = {
|
||||
}
|
||||
message?: string
|
||||
}> => invoke("plugin_get_stats"),
|
||||
pluginToggle: (pluginId: string, enabled: boolean): Promise<{
|
||||
pluginToggle: (
|
||||
pluginId: string,
|
||||
enabled: boolean
|
||||
): Promise<{
|
||||
success: boolean
|
||||
message?: string
|
||||
}> => invoke("plugin_toggle", { pluginId, enabled }),
|
||||
pluginInstall: (manifest: any, pluginDir: string): Promise<{
|
||||
pluginInstall: (
|
||||
manifest: any,
|
||||
pluginDir: string
|
||||
): Promise<{
|
||||
success: boolean
|
||||
data?: any
|
||||
message?: string
|
||||
}> => invoke("plugin_install", { manifest, pluginDir }),
|
||||
pluginUninstall: (pluginId: string): Promise<{
|
||||
pluginUninstall: (
|
||||
pluginId: string
|
||||
): Promise<{
|
||||
success: boolean
|
||||
message?: string
|
||||
}> => invoke("plugin_uninstall", { pluginId }),
|
||||
pluginLoadManifest: (path: string): Promise<{
|
||||
pluginLoadManifest: (
|
||||
path: string
|
||||
): Promise<{
|
||||
success: boolean
|
||||
data?: any
|
||||
message?: string
|
||||
}> => invoke("plugin_load_manifest", { path }),
|
||||
pluginGetDir: (pluginId: string): Promise<{
|
||||
pluginGetDir: (
|
||||
pluginId: string
|
||||
): Promise<{
|
||||
success: boolean
|
||||
data?: string
|
||||
message?: string
|
||||
|
||||
Reference in New Issue
Block a user