diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-01-11 20:38:34 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-11 20:38:34 +0900 |
| commit | 6c975275f82c79eed2c7757d55283c95d23ca5b8 (patch) | |
| tree | 2871e4c3a1a67295ea5c3e19b9136ae79a17088c /src/server/api/endpoints/i.ts | |
| parent | fix context menu (diff) | |
| download | sharkey-6c975275f82c79eed2c7757d55283c95d23ca5b8.tar.gz sharkey-6c975275f82c79eed2c7757d55283c95d23ca5b8.tar.bz2 sharkey-6c975275f82c79eed2c7757d55283c95d23ca5b8.zip | |
Registry (#7073)
* wip
* wip
* wip
* wip
* wip
* Update registry.value.vue
* wip
* wip
* wip
* wip
* typo
Diffstat (limited to 'src/server/api/endpoints/i.ts')
| -rw-r--r-- | src/server/api/endpoints/i.ts | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/server/api/endpoints/i.ts b/src/server/api/endpoints/i.ts index bceb9548ef..3d0c092adb 100644 --- a/src/server/api/endpoints/i.ts +++ b/src/server/api/endpoints/i.ts @@ -1,5 +1,7 @@ import define from '../define'; -import { Users } from '../../../models'; +import { RegistryItems, UserProfiles, Users } from '../../../models'; +import { ensure } from '../../../prelude/ensure'; +import { genId } from '../../../misc/gen-id'; export const meta = { desc: { @@ -22,6 +24,27 @@ export const meta = { export default define(meta, async (ps, user, token) => { const isSecure = token == null; + // TODO: そのうち消す + const profile = await UserProfiles.findOne(user.id).then(ensure); + for (const [k, v] of Object.entries(profile.clientData)) { + await RegistryItems.insert({ + id: genId(), + createdAt: new Date(), + updatedAt: new Date(), + userId: user.id, + domain: null, + scope: ['client', 'base'], + key: k, + value: v + }); + } + await UserProfiles.createQueryBuilder().update() + .set({ + clientData: {}, + }) + .where('userId = :id', { id: user.id }) + .execute(); + return await Users.pack(user, user, { detail: true, includeSecrets: isSecure |