This commit is contained in:
tamaina
2024-03-05 16:44:11 +00:00
parent 0127f89298
commit 01b8d2fdb1
3 changed files with 15 additions and 15 deletions

View File

@@ -81,7 +81,7 @@ export class FetchInstanceMetadataService {
// キャッシュ有効チェックはロック取得前に行う
const _instance = await this.federatedInstanceService.fetch(host);
const now = Date.now();
if (_instance && _instance.infoUpdatedAt && (now - _instance.infoUpdatedAt.getTime() < REMOTE_SERVER_CACHE_TTL)) {
if (_instance && _instance.infoUpdatedAt != null && (now - _instance.infoUpdatedAt.getTime() < REMOTE_SERVER_CACHE_TTL)) {
this.logger.debug(`Skip because updated recently ${_instance.infoUpdatedAt.toJSON()}`);
return;
}

View File

@@ -91,9 +91,10 @@ export class ApRequestService {
@bindThis
public async signedPost(user: { id: MiUser['id'] }, url: string, object: unknown, level: string, digest?: string, key?: PrivateKeyWithPem): Promise<void> {
const body = typeof object === 'string' ? object : JSON.stringify(object);
const keyFetched = await this.userKeypairService.getLocalUserPrivateKey(key ?? user.id, level);
const req = await createSignedPost({
level,
key: await this.userKeypairService.getLocalUserPrivateKey(key ?? user.id, level),
key: keyFetched,
url,
body,
additionalHeaders: {
@@ -106,7 +107,7 @@ export class ApRequestService {
version: 'draft',
level,
url,
keyId: key.keyId,
keyId: keyFetched.keyId,
});
await this.httpRequestService.send(url, {