additional change

This commit is contained in:
tamaina 2025-07-04 20:29:38 +09:00
parent ec1f8b3374
commit 6c0f2cadf1
4 changed files with 15 additions and 583 deletions

View File

@ -16,6 +16,7 @@ import { deepClone } from '@/misc/clone.js';
import { bindThis } from '@/decorators.js';
import { SystemAccountService } from '@/core/SystemAccountService.js';
import { UserKeypairService } from './UserKeypairService.js';
import type { PrivateKeyWithPem } from '@misskey-dev/node-http-message-signatures';
@Injectable()
export class RelayService {

View File

@ -18,7 +18,7 @@ import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
import { generateNativeUserToken } from '@/misc/token.js';
import { IdService } from '@/core/IdService.js';
import { genRsaKeyPair } from '@/misc/gen-key-pair.js';
import { genRSAAndEd25519KeyPair } from '@/misc/gen-key-pair.js';
export const SYSTEM_ACCOUNT_TYPES = ['actor', 'relay', 'proxy'] as const;
@ -119,7 +119,7 @@ export class SystemAccountService implements OnApplicationShutdown {
// Generate secret
const secret = generateNativeUserToken();
const keyPair = await genRsaKeyPair();
const keyPair = await genRSAAndEd25519KeyPair();
let account!: MiUser;
@ -148,9 +148,8 @@ export class SystemAccountService implements OnApplicationShutdown {
}).then(x => transactionalEntityManager.findOneByOrFail(MiUser, x.identifiers[0]));
await transactionalEntityManager.insert(MiUserKeypair, {
publicKey: keyPair.publicKey,
privateKey: keyPair.privateKey,
userId: account.id,
...keyPair,
});
await transactionalEntityManager.insert(MiUserProfile, {

View File

@ -16,7 +16,6 @@ import type { MiNote } from '@/models/Note.js';
import { bindThis } from '@/decorators.js';
import { MiLocalUser, MiRemoteUser } from '@/models/User.js';
import Logger from '@/logger.js';
import { UtilityService } from '@/core/UtilityService.js';
import { getApId } from './type.js';
import { ApPersonService } from './models/ApPersonService.js';
import { ApLoggerService } from './ApLoggerService.js';
@ -70,12 +69,6 @@ export class ApDbResolverService implements OnApplicationShutdown {
this.redisForSub.on('message', this.onMessage);
}
private punyHost(url: string): string {
const urlObj = new URL(url);
const host = `${this.utilityService.toPuny(urlObj.hostname)}${urlObj.port.length > 0 ? ':' + urlObj.port : ''}`;
return host;
}
@bindThis
public parseUri(value: string | IObject): UriParseResult {
const separator = '/';
@ -170,7 +163,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
} |
null> {
if (keyId) {
if (this.punyHost(uri) !== this.punyHost(keyId)) {
if (this.utilityService.punyHost(uri) !== this.utilityService.punyHost(keyId)) {
/**
* keyIdはURL形式かつkeyIdのホストはuriのホストと一致するはず
* ApPersonService.validateActorに由来

File diff suppressed because it is too large Load Diff