summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-02-28 09:34:21 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-02-28 09:34:21 +0900
commitc63c3462dd00e7de3f40b15ad43993a26734263f (patch)
tree959d9b753059e66e813ab3b8fe74e4975acbc32d /packages/backend/src/server/api
parent[skip ci] Update CHANGELOG.md (prepend template) (diff)
downloadsharkey-c63c3462dd00e7de3f40b15ad43993a26734263f.tar.gz
sharkey-c63c3462dd00e7de3f40b15ad43993a26734263f.tar.bz2
sharkey-c63c3462dd00e7de3f40b15ad43993a26734263f.zip
refactor
Diffstat (limited to 'packages/backend/src/server/api')
-rw-r--r--packages/backend/src/server/api/AuthenticateService.ts4
-rw-r--r--packages/backend/src/server/api/endpoints/i/regenerate-token.ts4
2 files changed, 4 insertions, 4 deletions
diff --git a/packages/backend/src/server/api/AuthenticateService.ts b/packages/backend/src/server/api/AuthenticateService.ts
index 690ff2e022..601618553e 100644
--- a/packages/backend/src/server/api/AuthenticateService.ts
+++ b/packages/backend/src/server/api/AuthenticateService.ts
@@ -11,7 +11,7 @@ import type { MiAccessToken } from '@/models/AccessToken.js';
import { MemoryKVCache } from '@/misc/cache.js';
import type { MiApp } from '@/models/App.js';
import { CacheService } from '@/core/CacheService.js';
-import isNativeToken from '@/misc/is-native-token.js';
+import { isNativeUserToken } from '@/misc/token.js';
import { bindThis } from '@/decorators.js';
export class AuthenticationError extends Error {
@@ -46,7 +46,7 @@ export class AuthenticateService implements OnApplicationShutdown {
return [null, null];
}
- if (isNativeToken(token)) {
+ if (isNativeUserToken(token)) {
const user = await this.cacheService.localUserByNativeTokenCache.fetch(token,
() => this.usersRepository.findOneBy({ token }) as Promise<MiLocalUser | null>);
diff --git a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts
index 78f3cce9ad..d25d5d5e0e 100644
--- a/packages/backend/src/server/api/endpoints/i/regenerate-token.ts
+++ b/packages/backend/src/server/api/endpoints/i/regenerate-token.ts
@@ -7,7 +7,7 @@ import bcrypt from 'bcryptjs';
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { UsersRepository, UserProfilesRepository } from '@/models/_.js';
-import generateUserToken from '@/misc/generate-native-user-token.js';
+import { generateNativeUserToken } from '@/misc/token.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { DI } from '@/di-symbols.js';
@@ -49,7 +49,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new Error('incorrect password');
}
- const newToken = generateUserToken();
+ const newToken = generateNativeUserToken();
await this.usersRepository.update(me.id, {
token: newToken,