From 725d9bdc57d6180de0afb1f02e978f109b4cd96d Mon Sep 17 00:00:00 2001 From: John Date: Sun, 19 Jan 2025 08:29:27 +0900 Subject: [PATCH] #: Modify Authorization.tsx --- capacitor/src/api/index.tsx | 7 ++----- .../UploadResource/UploadResource.worker.tsx | 4 ++-- electron/src/api/index.tsx | 7 ++----- .../UploadResource/UploadResource.worker.tsx | 4 ++-- react/src/api/Authorization.tsx | 4 ++-- react/src/api/index.tsx | 11 ++++++----- .../UploadResource/UploadResource.worker.tsx | 4 ++-- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/capacitor/src/api/index.tsx b/capacitor/src/api/index.tsx index fc7ee2fa..ad5cbfa2 100644 --- a/capacitor/src/api/index.tsx +++ b/capacitor/src/api/index.tsx @@ -1,12 +1,9 @@ import * as Git from '@/api/Git' import * as Resource from '@/api/Resource' +import * as LongTermTask from '@/api/LongTermTask' export default { Git, Resource, + LongTermTask, } - - - - - diff --git a/capacitor/src/common/WebWorker/UploadResource/UploadResource.worker.tsx b/capacitor/src/common/WebWorker/UploadResource/UploadResource.worker.tsx index 9c0c5960..551833f0 100644 --- a/capacitor/src/common/WebWorker/UploadResource/UploadResource.worker.tsx +++ b/capacitor/src/common/WebWorker/UploadResource/UploadResource.worker.tsx @@ -3,7 +3,7 @@ import registerWebworker from 'webworker-promise/lib/register' import axios from "axios"; import { concatMap, from, lastValueFrom, map, range, timer, toArray } from "rxjs"; import * as mathjs from 'mathjs' -import { getLongTermTask } from '@/api/LongTermTask'; +import api from '@/api'; import { addMilliseconds } from 'date-fns' import linq from 'linq' @@ -78,7 +78,7 @@ registerWebworker(async ({ }), map((response) => response.data), toArray(), - concatMap((urlList) => from(getLongTermTask(async () => axios.post(`/upload/merge`, urlList)))), + concatMap((urlList) => from(api.LongTermTask.getLongTermTask(async () => axios.post(`/upload/merge`, urlList)))), map((result) => result as string) )); return url; diff --git a/electron/src/api/index.tsx b/electron/src/api/index.tsx index fc7ee2fa..ad5cbfa2 100644 --- a/electron/src/api/index.tsx +++ b/electron/src/api/index.tsx @@ -1,12 +1,9 @@ import * as Git from '@/api/Git' import * as Resource from '@/api/Resource' +import * as LongTermTask from '@/api/LongTermTask' export default { Git, Resource, + LongTermTask, } - - - - - diff --git a/electron/src/common/WebWorker/UploadResource/UploadResource.worker.tsx b/electron/src/common/WebWorker/UploadResource/UploadResource.worker.tsx index 9c0c5960..551833f0 100644 --- a/electron/src/common/WebWorker/UploadResource/UploadResource.worker.tsx +++ b/electron/src/common/WebWorker/UploadResource/UploadResource.worker.tsx @@ -3,7 +3,7 @@ import registerWebworker from 'webworker-promise/lib/register' import axios from "axios"; import { concatMap, from, lastValueFrom, map, range, timer, toArray } from "rxjs"; import * as mathjs from 'mathjs' -import { getLongTermTask } from '@/api/LongTermTask'; +import api from '@/api'; import { addMilliseconds } from 'date-fns' import linq from 'linq' @@ -78,7 +78,7 @@ registerWebworker(async ({ }), map((response) => response.data), toArray(), - concatMap((urlList) => from(getLongTermTask(async () => axios.post(`/upload/merge`, urlList)))), + concatMap((urlList) => from(api.LongTermTask.getLongTermTask(async () => axios.post(`/upload/merge`, urlList)))), map((result) => result as string) )); return url; diff --git a/react/src/api/Authorization.tsx b/react/src/api/Authorization.tsx index 88562aaa..a2524b99 100644 --- a/react/src/api/Authorization.tsx +++ b/react/src/api/Authorization.tsx @@ -1,4 +1,4 @@ -import { getKeyOfRSAPublicKey } from '@/api/EncryptDecrypt'; +import api from '@/api'; import { encryptByPublicKeyOfRSA } from "@/common/RSAUtils"; import { GlobalUserInfo, removeGlobalUserInfo, setGlobalUserInfo } from "@/common/Server"; import { UserEmailModel } from "@/model/UserEmailModel"; @@ -29,7 +29,7 @@ export async function signIn(username: string, password: string): Promise const { data } = await axios.post(`/sign_in/one_time_password`, null, { params: { username: username, - password: await encryptByPublicKeyOfRSA(password, await getKeyOfRSAPublicKey()), + password: await encryptByPublicKeyOfRSA(password, await api.EncryptDecrypt.getKeyOfRSAPublicKey()), } }); const user = new TypedJSON(UserModel).parse(data)!; diff --git a/react/src/api/index.tsx b/react/src/api/index.tsx index a21a9864..0c9ab1ce 100644 --- a/react/src/api/index.tsx +++ b/react/src/api/index.tsx @@ -5,6 +5,9 @@ import * as Resource from '@/api/Resource' import * as Friendship from '@/api/Friendship' import * as SuperAdminSystemRoleQuery from '@/api/SuperAdminUserRoleQuery' import * as SuperAdminUserQuery from '@/api/SuperAdminUserQuery' +import * as EncryptDecrypt from '@/api/EncryptDecrypt' +import * as LongTermTask from '@/api/LongTermTask' +import * as User from '@/api/User' export default { Authorization, @@ -14,9 +17,7 @@ export default { Resource, SuperAdminSystemRoleQuery, SuperAdminUserQuery, + EncryptDecrypt, + LongTermTask, + User, } - - - - - diff --git a/react/src/common/WebWorker/UploadResource/UploadResource.worker.tsx b/react/src/common/WebWorker/UploadResource/UploadResource.worker.tsx index 9c0c5960..551833f0 100644 --- a/react/src/common/WebWorker/UploadResource/UploadResource.worker.tsx +++ b/react/src/common/WebWorker/UploadResource/UploadResource.worker.tsx @@ -3,7 +3,7 @@ import registerWebworker from 'webworker-promise/lib/register' import axios from "axios"; import { concatMap, from, lastValueFrom, map, range, timer, toArray } from "rxjs"; import * as mathjs from 'mathjs' -import { getLongTermTask } from '@/api/LongTermTask'; +import api from '@/api'; import { addMilliseconds } from 'date-fns' import linq from 'linq' @@ -78,7 +78,7 @@ registerWebworker(async ({ }), map((response) => response.data), toArray(), - concatMap((urlList) => from(getLongTermTask(async () => axios.post(`/upload/merge`, urlList)))), + concatMap((urlList) => from(api.LongTermTask.getLongTermTask(async () => axios.post(`/upload/merge`, urlList)))), map((result) => result as string) )); return url;