forked from FoundKeyGang/FoundKey
Compare commits
3 commits
main
...
libretrans
Author | SHA1 | Date | |
---|---|---|---|
494b9236db | |||
5cb5d8c8df | |||
f03e64d157 |
48 changed files with 462 additions and 472 deletions
|
@ -297,11 +297,8 @@ PostgreSQL array indices **start at 1**.
|
||||||
When `IN` is performed on a column that may contain `NULL` values, use `OR` or similar to handle `NULL` values.
|
When `IN` is performed on a column that may contain `NULL` values, use `OR` or similar to handle `NULL` values.
|
||||||
|
|
||||||
### creating migrations
|
### creating migrations
|
||||||
First make changes to the entity files in `packages/backend/src/models/entities/`.
|
In `packages/backend`, run:
|
||||||
|
|
||||||
Then, in `packages/backend`, run:
|
|
||||||
```sh
|
```sh
|
||||||
yarn build
|
|
||||||
npx typeorm migration:generate -d ormconfig.js -o <migration name>
|
npx typeorm migration:generate -d ormconfig.js -o <migration name>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ git merge tags/v13.0.0-preview2 --squash
|
||||||
```
|
```
|
||||||
|
|
||||||
## Making sure modern Yarn works
|
## Making sure modern Yarn works
|
||||||
Foundkey uses Modern Yarn instead of Classic (1.x). To make sure the `yarn` command will work going forward, run `corepack enable`.
|
Foundkey uses Yarn 3.2.3 instead of 1.x. To make sure the `yarn` command will work going forward, run `corepack enable`.
|
||||||
|
|
||||||
## Rebuilding and running database migrations
|
## Rebuilding and running database migrations
|
||||||
This will be pretty much the same as a regular update of Misskey. Note that `yarn install` may take a while since dependency versions have been updated or removed and we use a newer version of Yarn.
|
This will be pretty much the same as a regular update of Misskey. Note that `yarn install` may take a while since dependency versions have been updated or removed and we use a newer version of Yarn.
|
||||||
|
|
|
@ -190,9 +190,7 @@ charts: "Charts"
|
||||||
perHour: "Per Hour"
|
perHour: "Per Hour"
|
||||||
perDay: "Per Day"
|
perDay: "Per Day"
|
||||||
stopActivityDelivery: "Stop sending activities"
|
stopActivityDelivery: "Stop sending activities"
|
||||||
stopActivityDeliveryDescription: "Local activities will not be sent to this instance. Receiving activities works as before."
|
|
||||||
blockThisInstance: "Block this instance"
|
blockThisInstance: "Block this instance"
|
||||||
blockThisInstanceDescription: "Local activites will not be sent to this instance. Activites from this instance will be discarded."
|
|
||||||
operations: "Operations"
|
operations: "Operations"
|
||||||
software: "Software"
|
software: "Software"
|
||||||
version: "Version"
|
version: "Version"
|
||||||
|
@ -848,6 +846,8 @@ misskeyUpdated: "FoundKey has been updated!"
|
||||||
whatIsNew: "Show changes"
|
whatIsNew: "Show changes"
|
||||||
translate: "Translate"
|
translate: "Translate"
|
||||||
translatedFrom: "Translated from {x}"
|
translatedFrom: "Translated from {x}"
|
||||||
|
translationSettings: "Translation Settings"
|
||||||
|
translationService: "Translation Service"
|
||||||
accountDeletionInProgress: "Account deletion is currently in progress."
|
accountDeletionInProgress: "Account deletion is currently in progress."
|
||||||
usernameInfo: "A name that identifies your account from others on this server. You\
|
usernameInfo: "A name that identifies your account from others on this server. You\
|
||||||
\ can use the alphabet (a~z, A~Z), digits (0~9) or underscores (_). Usernames cannot\
|
\ can use the alphabet (a~z, A~Z), digits (0~9) or underscores (_). Usernames cannot\
|
||||||
|
@ -1524,3 +1524,10 @@ _services:
|
||||||
_github:
|
_github:
|
||||||
connected: "GitHub: @{login} connected to FoundKey: @{userName}!"
|
connected: "GitHub: @{login} connected to FoundKey: @{userName}!"
|
||||||
disconnected: "GitHub linkage has been removed."
|
disconnected: "GitHub linkage has been removed."
|
||||||
|
_translationService:
|
||||||
|
_deepl:
|
||||||
|
authKey: "DeepL Auth Key"
|
||||||
|
pro: "Pro Account"
|
||||||
|
_libreTranslate:
|
||||||
|
endpoint: "LibreTranslate API Endpoint"
|
||||||
|
authKey: "LibreTranslate Auth Key"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export class removeAds1657570176749 {
|
export class removeAds1657570176749 {
|
||||||
name = 'removeAds1657570176749';
|
name = 'removeAds1657570176749'
|
||||||
|
|
||||||
async up(queryRunner) {
|
async up(queryRunner) {
|
||||||
await queryRunner.query(`DROP TABLE "ad"`);
|
await queryRunner.query(`DROP TABLE "ad"`);
|
|
@ -1,44 +0,0 @@
|
||||||
export class sync1667503570994 {
|
|
||||||
name = 'sync1667503570994'
|
|
||||||
|
|
||||||
async up(queryRunner) {
|
|
||||||
await Promise.all([
|
|
||||||
// the migration for renote mutes added the index to the wrong table
|
|
||||||
queryRunner.query(`DROP INDEX "public"."IDX_renote_muting_createdAt"`),
|
|
||||||
queryRunner.query(`DROP INDEX "public"."IDX_renote_muting_muteeId"`),
|
|
||||||
queryRunner.query(`DROP INDEX "public"."IDX_renote_muting_muterId"`),
|
|
||||||
queryRunner.query(`CREATE INDEX "IDX_d1259a2c2b7bb413ff449e8711" ON "renote_muting" ("createdAt") `),
|
|
||||||
queryRunner.query(`CREATE INDEX "IDX_7eac97594bcac5ffcf2068089b" ON "renote_muting" ("muteeId") `),
|
|
||||||
queryRunner.query(`CREATE INDEX "IDX_7aa72a5fe76019bfe8e5e0e8b7" ON "renote_muting" ("muterId") `),
|
|
||||||
|
|
||||||
queryRunner.query(`COMMENT ON COLUMN "renote_muting"."createdAt" IS 'The created date of the Muting.'`),
|
|
||||||
queryRunner.query(`COMMENT ON COLUMN "renote_muting"."muteeId" IS 'The mutee user ID.'`),
|
|
||||||
queryRunner.query(`COMMENT ON COLUMN "renote_muting"."muterId" IS 'The muter user ID.'`),
|
|
||||||
queryRunner.query(`ALTER TABLE "page" ALTER COLUMN "text" SET NOT NULL`),
|
|
||||||
queryRunner.query(`ALTER TABLE "page" ALTER COLUMN "text" SET DEFAULT ''`),
|
|
||||||
queryRunner.query(`CREATE UNIQUE INDEX "IDX_0d801c609cec4e9eb4b6b4490c" ON "renote_muting" ("muterId", "muteeId") `),
|
|
||||||
queryRunner.query(`ALTER TABLE "renote_muting" ADD CONSTRAINT "FK_7eac97594bcac5ffcf2068089b6" FOREIGN KEY ("muteeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`),
|
|
||||||
queryRunner.query(`ALTER TABLE "renote_muting" ADD CONSTRAINT "FK_7aa72a5fe76019bfe8e5e0e8b7d" FOREIGN KEY ("muterId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
async down(queryRunner) {
|
|
||||||
await Promise.all([
|
|
||||||
queryRunner.query(`ALTER TABLE "renote_muting" DROP CONSTRAINT "FK_7aa72a5fe76019bfe8e5e0e8b7d"`),
|
|
||||||
queryRunner.query(`ALTER TABLE "renote_muting" DROP CONSTRAINT "FK_7eac97594bcac5ffcf2068089b6"`),
|
|
||||||
queryRunner.query(`DROP INDEX "public"."IDX_0d801c609cec4e9eb4b6b4490c"`),
|
|
||||||
queryRunner.query(`ALTER TABLE "page" ALTER COLUMN "text" DROP DEFAULT`),
|
|
||||||
queryRunner.query(`ALTER TABLE "page" ALTER COLUMN "text" DROP NOT NULL`),
|
|
||||||
queryRunner.query(`COMMENT ON COLUMN "renote_muting"."muterId" IS NULL`),
|
|
||||||
queryRunner.query(`COMMENT ON COLUMN "renote_muting"."muteeId" IS NULL`),
|
|
||||||
queryRunner.query(`COMMENT ON COLUMN "renote_muting"."createdAt" IS NULL`),
|
|
||||||
|
|
||||||
queryRunner.query(`DROP INDEX "public"."IDX_7aa72a5fe76019bfe8e5e0e8b7"`),
|
|
||||||
queryRunner.query(`DROP INDEX "public"."IDX_7eac97594bcac5ffcf2068089b"`),
|
|
||||||
queryRunner.query(`DROP INDEX "public"."IDX_d1259a2c2b7bb413ff449e8711"`),
|
|
||||||
queryRunner.query(`CREATE INDEX "IDX_renote_muting_muterId" ON "muting" ("muterId") `),
|
|
||||||
queryRunner.query(`CREATE INDEX "IDX_renote_muting_muteeId" ON "muting" ("muteeId") `),
|
|
||||||
queryRunner.query(`CREATE INDEX "IDX_renote_muting_createdAt" ON "muting" ("createdAt") `),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -96,7 +96,7 @@
|
||||||
"rss-parser": "3.12.0",
|
"rss-parser": "3.12.0",
|
||||||
"sanitize-html": "2.7.0",
|
"sanitize-html": "2.7.0",
|
||||||
"semver": "7.3.7",
|
"semver": "7.3.7",
|
||||||
"sharp": "0.31.2",
|
"sharp": "0.30.7",
|
||||||
"speakeasy": "2.0.0",
|
"speakeasy": "2.0.0",
|
||||||
"strict-event-emitter-types": "2.0.0",
|
"strict-event-emitter-types": "2.0.0",
|
||||||
"stringz": "2.1.0",
|
"stringz": "2.1.0",
|
||||||
|
|
|
@ -62,21 +62,22 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
|
||||||
const rel = node.attrs.find(x => x.name === 'rel');
|
const rel = node.attrs.find(x => x.name === 'rel');
|
||||||
const href = node.attrs.find(x => x.name === 'href');
|
const href = node.attrs.find(x => x.name === 'href');
|
||||||
|
|
||||||
// hashtags
|
// ハッシュタグ
|
||||||
if (hashtagNames && href && hashtagNames.map(x => x.toLowerCase()).includes(txt.toLowerCase())) {
|
if (hashtagNames && href && hashtagNames.map(x => x.toLowerCase()).includes(txt.toLowerCase())) {
|
||||||
text += txt;
|
text += txt;
|
||||||
// mentions
|
// メンション
|
||||||
} else if (txt.startsWith('@') && !(rel && rel.value.match(/^me /))) {
|
} else if (txt.startsWith('@') && !(rel && rel.value.match(/^me /))) {
|
||||||
const part = txt.split('@');
|
const part = txt.split('@');
|
||||||
|
|
||||||
if (part.length === 2 && href) {
|
if (part.length === 2 && href) {
|
||||||
// restore the host name part
|
//#region ホスト名部分が省略されているので復元する
|
||||||
const acct = `${txt}@${(new URL(href.value)).hostname}`;
|
const acct = `${txt}@${(new URL(href.value)).hostname}`;
|
||||||
text += acct;
|
text += acct;
|
||||||
|
//#endregion
|
||||||
} else if (part.length === 3) {
|
} else if (part.length === 3) {
|
||||||
text += txt;
|
text += txt;
|
||||||
}
|
}
|
||||||
// other
|
// その他
|
||||||
} else {
|
} else {
|
||||||
const generateLink = () => {
|
const generateLink = () => {
|
||||||
if (!href && !txt) {
|
if (!href && !txt) {
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
export class Cache<T> {
|
export class Cache<T> {
|
||||||
public cache: Map<string | null, { date: number; value: T; }>;
|
public cache: Map<string | null, { date: number; value: T; }>;
|
||||||
private lifetime: number;
|
private lifetime: number;
|
||||||
public fetcher: (key: string | null) => Promise<T | undefined>;
|
|
||||||
|
|
||||||
constructor(lifetime: number, fetcher: Cache<T>['fetcher']) {
|
constructor(lifetime: Cache<never>['lifetime']) {
|
||||||
this.cache = new Map();
|
this.cache = new Map();
|
||||||
this.lifetime = lifetime;
|
this.lifetime = lifetime;
|
||||||
this.fetcher = fetcher;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public set(key: string | null, value: T): void {
|
public set(key: string | null, value: T): void {
|
||||||
|
@ -19,13 +17,10 @@ export class Cache<T> {
|
||||||
public get(key: string | null): T | undefined {
|
public get(key: string | null): T | undefined {
|
||||||
const cached = this.cache.get(key);
|
const cached = this.cache.get(key);
|
||||||
if (cached == null) return undefined;
|
if (cached == null) return undefined;
|
||||||
|
|
||||||
// discard if past the cache lifetime
|
|
||||||
if ((Date.now() - cached.date) > this.lifetime) {
|
if ((Date.now() - cached.date) > this.lifetime) {
|
||||||
this.cache.delete(key);
|
this.cache.delete(key);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cached.value;
|
return cached.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,22 +29,52 @@ export class Cache<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the value is cached, it is returned. Otherwise the fetcher is
|
* キャッシュがあればそれを返し、無ければfetcherを呼び出して結果をキャッシュ&返します
|
||||||
* run to get the value. If the fetcher returns undefined, it is
|
* optional: キャッシュが存在してもvalidatorでfalseを返すとキャッシュ無効扱いにします
|
||||||
* returned but not cached.
|
|
||||||
*/
|
*/
|
||||||
public async fetch(key: string | null): Promise<T | undefined> {
|
public async fetch(key: string | null, fetcher: () => Promise<T>, validator?: (cachedValue: T) => boolean): Promise<T> {
|
||||||
const cached = this.get(key);
|
const cachedValue = this.get(key);
|
||||||
if (cached !== undefined) {
|
if (cachedValue !== undefined) {
|
||||||
return cached;
|
if (validator) {
|
||||||
|
if (validator(cachedValue)) {
|
||||||
|
// Cache HIT
|
||||||
|
return cachedValue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const value = await this.fetcher(key);
|
// Cache HIT
|
||||||
|
return cachedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// don't cache undefined
|
// Cache MISS
|
||||||
if (value !== undefined)
|
const value = await fetcher();
|
||||||
this.set(key, value);
|
this.set(key, value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* キャッシュがあればそれを返し、無ければfetcherを呼び出して結果をキャッシュ&返します
|
||||||
|
* optional: キャッシュが存在してもvalidatorでfalseを返すとキャッシュ無効扱いにします
|
||||||
|
*/
|
||||||
|
public async fetchMaybe(key: string | null, fetcher: () => Promise<T | undefined>, validator?: (cachedValue: T) => boolean): Promise<T | undefined> {
|
||||||
|
const cachedValue = this.get(key);
|
||||||
|
if (cachedValue !== undefined) {
|
||||||
|
if (validator) {
|
||||||
|
if (validator(cachedValue)) {
|
||||||
|
// Cache HIT
|
||||||
|
return cachedValue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Cache HIT
|
||||||
|
return cachedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache MISS
|
||||||
|
const value = await fetcher();
|
||||||
|
if (value !== undefined) {
|
||||||
|
this.set(key, value);
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -3,26 +3,22 @@ import { Note } from '@/models/entities/note.js';
|
||||||
import { User } from '@/models/entities/user.js';
|
import { User } from '@/models/entities/user.js';
|
||||||
import { UserListJoinings, UserGroupJoinings, Blockings } from '@/models/index.js';
|
import { UserListJoinings, UserGroupJoinings, Blockings } from '@/models/index.js';
|
||||||
import * as Acct from '@/misc/acct.js';
|
import * as Acct from '@/misc/acct.js';
|
||||||
import { MINUTE } from '@/const.js';
|
|
||||||
import { getFullApAccount } from './convert-host.js';
|
import { getFullApAccount } from './convert-host.js';
|
||||||
import { Packed } from './schema.js';
|
import { Packed } from './schema.js';
|
||||||
import { Cache } from './cache.js';
|
import { Cache } from './cache.js';
|
||||||
|
|
||||||
const blockingCache = new Cache<User['id'][]>(
|
const blockingCache = new Cache<User['id'][]>(1000 * 60 * 5);
|
||||||
5 * MINUTE,
|
|
||||||
(blockerId) => Blockings.findBy({ blockerId }).then(res => res.map(x => x.blockeeId)),
|
|
||||||
);
|
|
||||||
|
|
||||||
// designation for users you follow, list users and groups is disabled for performance reasons
|
// NOTE: フォローしているユーザーのノート、リストのユーザーのノート、グループのユーザーのノート指定はパフォーマンス上の理由で無効になっている
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* either noteUserFollowers or antennaUserFollowing must be specified
|
* noteUserFollowers / antennaUserFollowing はどちらか一方が指定されていればよい
|
||||||
*/
|
*/
|
||||||
export async function checkHitAntenna(antenna: Antenna, note: (Note | Packed<'Note'>), noteUser: { id: User['id']; username: string; host: string | null; }, noteUserFollowers?: User['id'][], antennaUserFollowing?: User['id'][]): Promise<boolean> {
|
export async function checkHitAntenna(antenna: Antenna, note: (Note | Packed<'Note'>), noteUser: { id: User['id']; username: string; host: string | null; }, noteUserFollowers?: User['id'][], antennaUserFollowing?: User['id'][]): Promise<boolean> {
|
||||||
if (note.visibility === 'specified') return false;
|
if (note.visibility === 'specified') return false;
|
||||||
|
|
||||||
// skip if the antenna creator is blocked by the note author
|
// アンテナ作成者がノート作成者にブロックされていたらスキップ
|
||||||
const blockings = await blockingCache.fetch(noteUser.id);
|
const blockings = await blockingCache.fetch(noteUser.id, () => Blockings.findBy({ blockerId: noteUser.id }).then(res => res.map(x => x.blockeeId)));
|
||||||
if (blockings.some(blocking => blocking === antenna.userId)) return false;
|
if (blockings.some(blocking => blocking === antenna.userId)) return false;
|
||||||
|
|
||||||
if (note.visibility === 'followers') {
|
if (note.visibility === 'followers') {
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
import push from 'web-push';
|
|
||||||
import { db } from '@/db/postgre.js';
|
import { db } from '@/db/postgre.js';
|
||||||
import { Meta } from '@/models/entities/meta.js';
|
import { Meta } from '@/models/entities/meta.js';
|
||||||
import { getFetchInstanceMetadataLock } from '@/misc/app-lock.js';
|
|
||||||
|
|
||||||
let cache: Meta;
|
let cache: Meta;
|
||||||
|
|
||||||
/**
|
export async function fetchMeta(noCache = false): Promise<Meta> {
|
||||||
* Performs the primitive database operation to set the server configuration
|
if (!noCache && cache) return cache;
|
||||||
*/
|
|
||||||
export async function setMeta(meta: Meta): Promise<void> {
|
|
||||||
const unlock = await getFetchInstanceMetadataLock('localhost');
|
|
||||||
|
|
||||||
// try to mitigate older bugs where multiple meta entries may have been created
|
return await db.transaction(async transactionalEntityManager => {
|
||||||
db.manager.clear(Meta);
|
// 過去のバグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する
|
||||||
db.manager.insert(Meta, meta);
|
const metas = await transactionalEntityManager.find(Meta, {
|
||||||
|
|
||||||
unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs the primitive database operation to fetch server configuration.
|
|
||||||
* Writes to `cache` instead of returning.
|
|
||||||
*/
|
|
||||||
async function getMeta(): Promise<void> {
|
|
||||||
const unlock = await getFetchInstanceMetadataLock('localhost');
|
|
||||||
|
|
||||||
// new IDs are prioritised because multiple records may have been created due to past bugs
|
|
||||||
cache = db.manager.findOne(Meta, {
|
|
||||||
order: {
|
order: {
|
||||||
id: 'DESC',
|
id: 'DESC',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
unlock();
|
const meta = metas[0];
|
||||||
|
|
||||||
|
if (meta) {
|
||||||
|
cache = meta;
|
||||||
|
return meta;
|
||||||
|
} else {
|
||||||
|
// metaが空のときfetchMetaが同時に呼ばれるとここが同時に呼ばれてしまうことがあるのでフェイルセーフなupsertを使う
|
||||||
|
const saved = await transactionalEntityManager
|
||||||
|
.upsert(
|
||||||
|
Meta,
|
||||||
|
{
|
||||||
|
id: 'x',
|
||||||
|
},
|
||||||
|
['id'],
|
||||||
|
)
|
||||||
|
.then((x) => transactionalEntityManager.findOneByOrFail(Meta, x.identifiers[0]));
|
||||||
|
|
||||||
|
cache = saved;
|
||||||
|
return saved;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchMeta(noCache = false): Promise<Meta> {
|
setInterval(() => {
|
||||||
if (!noCache && cache) return cache;
|
fetchMeta(true).then(meta => {
|
||||||
|
cache = meta;
|
||||||
await getMeta();
|
});
|
||||||
|
}, 1000 * 10);
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,11 +3,8 @@ import { User } from '@/models/entities/user.js';
|
||||||
import { UserKeypair } from '@/models/entities/user-keypair.js';
|
import { UserKeypair } from '@/models/entities/user-keypair.js';
|
||||||
import { Cache } from './cache.js';
|
import { Cache } from './cache.js';
|
||||||
|
|
||||||
const cache = new Cache<UserKeypair>(
|
const cache = new Cache<UserKeypair>(Infinity);
|
||||||
Infinity,
|
|
||||||
(userId) => UserKeypairs.findOneByOrFail({ userId }),
|
|
||||||
);
|
|
||||||
|
|
||||||
export async function getUserKeypair(userId: User['id']): Promise<UserKeypair> {
|
export async function getUserKeypair(userId: User['id']): Promise<UserKeypair> {
|
||||||
return await cache.fetch(userId);
|
return await cache.fetch(userId, () => UserKeypairs.findOneByOrFail({ userId }));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,27 +4,14 @@ import { Emojis } from '@/models/index.js';
|
||||||
import { Emoji } from '@/models/entities/emoji.js';
|
import { Emoji } from '@/models/entities/emoji.js';
|
||||||
import { Note } from '@/models/entities/note.js';
|
import { Note } from '@/models/entities/note.js';
|
||||||
import { query } from '@/prelude/url.js';
|
import { query } from '@/prelude/url.js';
|
||||||
import { HOUR } from '@/const.js';
|
|
||||||
import { Cache } from './cache.js';
|
import { Cache } from './cache.js';
|
||||||
import { isSelfHost, toPunyNullable } from './convert-host.js';
|
import { isSelfHost, toPunyNullable } from './convert-host.js';
|
||||||
import { decodeReaction } from './reaction-lib.js';
|
import { decodeReaction } from './reaction-lib.js';
|
||||||
|
|
||||||
/**
|
const cache = new Cache<Emoji | null>(1000 * 60 * 60 * 12);
|
||||||
* composite cache key: `${host ?? ''}:${name}`
|
|
||||||
*/
|
|
||||||
const cache = new Cache<Emoji | null>(
|
|
||||||
12 * HOUR,
|
|
||||||
async (key) => {
|
|
||||||
const [host, name] = key.split(':');
|
|
||||||
return (await Emojis.findOneBy({
|
|
||||||
name,
|
|
||||||
host: host || IsNull(),
|
|
||||||
})) || null;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information needed to attach in ActivityPub
|
* 添付用絵文字情報
|
||||||
*/
|
*/
|
||||||
type PopulatedEmoji = {
|
type PopulatedEmoji = {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -49,22 +36,28 @@ function parseEmojiStr(emojiName: string, noteUserHost: string | null) {
|
||||||
|
|
||||||
const name = match[1];
|
const name = match[1];
|
||||||
|
|
||||||
|
// ホスト正規化
|
||||||
const host = toPunyNullable(normalizeHost(match[2], noteUserHost));
|
const host = toPunyNullable(normalizeHost(match[2], noteUserHost));
|
||||||
|
|
||||||
return { name, host };
|
return { name, host };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve emoji information from ActivityPub attachment.
|
* 添付用絵文字情報を解決する
|
||||||
* @param emojiName custom emoji names attached to notes, user profiles or in rections. Colons should not be included. Localhost is denote by @. (see also `decodeReaction`)
|
* @param emojiName ノートやユーザープロフィールに添付された、またはリアクションのカスタム絵文字名 (:は含めない, リアクションでローカルホストの場合は@.を付ける (これはdecodeReactionで可能))
|
||||||
* @param noteUserHost host that the content is from, to default to
|
* @param noteUserHost ノートやユーザープロフィールの所有者のホスト
|
||||||
* @returns emoji information. `null` means not found.
|
* @returns 絵文字情報, nullは未マッチを意味する
|
||||||
*/
|
*/
|
||||||
export async function populateEmoji(emojiName: string, noteUserHost: string | null): Promise<PopulatedEmoji | null> {
|
export async function populateEmoji(emojiName: string, noteUserHost: string | null): Promise<PopulatedEmoji | null> {
|
||||||
const { name, host } = parseEmojiStr(emojiName, noteUserHost);
|
const { name, host } = parseEmojiStr(emojiName, noteUserHost);
|
||||||
if (name == null) return null;
|
if (name == null) return null;
|
||||||
|
|
||||||
const emoji = await cache.fetch(`${host ?? ''}:${name}`);
|
const queryOrNull = async () => (await Emojis.findOneBy({
|
||||||
|
name,
|
||||||
|
host: host ?? IsNull(),
|
||||||
|
})) || null;
|
||||||
|
|
||||||
|
const emoji = await cache.fetch(`${name} ${host}`, queryOrNull);
|
||||||
|
|
||||||
if (emoji == null) return null;
|
if (emoji == null) return null;
|
||||||
|
|
||||||
|
@ -79,7 +72,7 @@ export async function populateEmoji(emojiName: string, noteUserHost: string | nu
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve list of emojis from the cache. Uncached emoji are dropped.
|
* 複数の添付用絵文字情報を解決する (キャシュ付き, 存在しないものは結果から除外される)
|
||||||
*/
|
*/
|
||||||
export async function populateEmojis(emojiNames: string[], noteUserHost: string | null): Promise<PopulatedEmoji[]> {
|
export async function populateEmojis(emojiNames: string[], noteUserHost: string | null): Promise<PopulatedEmoji[]> {
|
||||||
const emojis = await Promise.all(emojiNames.map(x => populateEmoji(x, noteUserHost)));
|
const emojis = await Promise.all(emojiNames.map(x => populateEmoji(x, noteUserHost)));
|
||||||
|
@ -110,20 +103,11 @@ export function aggregateNoteEmojis(notes: Note[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query list of emojis in bulk and add them to the cache.
|
* 与えられた絵文字のリストをデータベースから取得し、キャッシュに追加します
|
||||||
*/
|
*/
|
||||||
export async function prefetchEmojis(emojis: { name: string; host: string | null; }[]): Promise<void> {
|
export async function prefetchEmojis(emojis: { name: string; host: string | null; }[]): Promise<void> {
|
||||||
const notCachedEmojis = emojis.filter(emoji => {
|
const notCachedEmojis = emojis.filter(emoji => cache.get(`${emoji.name} ${emoji.host}`) == null);
|
||||||
// check if the cache has this emoji
|
|
||||||
return cache.get(`${emoji.host ?? ''}:${emoji.name}`) == null;
|
|
||||||
});
|
|
||||||
|
|
||||||
// check if there even are any uncached emoji to handle
|
|
||||||
if (notCachedEmojis.length === 0) return;
|
|
||||||
|
|
||||||
// query all uncached emoji
|
|
||||||
const emojisQuery: any[] = [];
|
const emojisQuery: any[] = [];
|
||||||
// group by hosts to try to reduce query size
|
|
||||||
const hosts = new Set(notCachedEmojis.map(e => e.host));
|
const hosts = new Set(notCachedEmojis.map(e => e.host));
|
||||||
for (const host of hosts) {
|
for (const host of hosts) {
|
||||||
emojisQuery.push({
|
emojisQuery.push({
|
||||||
|
@ -131,14 +115,11 @@ export async function prefetchEmojis(emojis: { name: string; host: string | null
|
||||||
host: host ?? IsNull(),
|
host: host ?? IsNull(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const _emojis = emojisQuery.length > 0 ? await Emojis.find({
|
||||||
await Emojis.find({
|
|
||||||
where: emojisQuery,
|
where: emojisQuery,
|
||||||
select: ['name', 'host', 'originalUrl', 'publicUrl'],
|
select: ['name', 'host', 'originalUrl', 'publicUrl'],
|
||||||
}).then(emojis => {
|
}) : [];
|
||||||
// store all emojis into the cache
|
for (const emoji of _emojis) {
|
||||||
emojis.forEach(emoji => {
|
cache.set(`${emoji.name} ${emoji.host}`, emoji);
|
||||||
cache.set(`${emoji.host ?? ''}:${emoji.name}`, emoji);
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { DAY } from '@/const.js';
|
||||||
|
|
||||||
// Threshold from last contact after which an instance will be considered
|
// Threshold from last contact after which an instance will be considered
|
||||||
// "dead" and should no longer get activities delivered to it.
|
// "dead" and should no longer get activities delivered to it.
|
||||||
const deadThreshold = 7 * DAY;
|
const deadThreshold = 30 * DAY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the subset of hosts which should be skipped.
|
* Returns the subset of hosts which should be skipped.
|
||||||
|
@ -33,8 +33,7 @@ export async function skippedInstances(hosts: Array<Instace['host']>): Array<Ins
|
||||||
})
|
})
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => { qb
|
||||||
.where('instance.isSuspended')
|
.where('instance.isSuspended')
|
||||||
.orWhere('instance.lastCommunicatedAt < :deadTime', { deadTime })
|
.orWhere('instance.lastCommunicatedAt < :deadTime', { deadTime });
|
||||||
.orWhere('instance.latestStatus = 410');
|
|
||||||
}))
|
}))
|
||||||
.select('host')
|
.select('host')
|
||||||
.getRawMany()
|
.getRawMany()
|
||||||
|
|
|
@ -62,8 +62,7 @@ export class DriveFile {
|
||||||
public size: number;
|
public size: number;
|
||||||
|
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
length: 2048,
|
length: 512, nullable: true,
|
||||||
nullable: true,
|
|
||||||
comment: 'The comment of the DriveFile.',
|
comment: 'The comment of the DriveFile.',
|
||||||
})
|
})
|
||||||
public comment: string | null;
|
public comment: string | null;
|
||||||
|
|
|
@ -7,7 +7,7 @@ export class Instance {
|
||||||
public id: string;
|
public id: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date and time this instance was first seen.
|
* このインスタンスを捕捉した日時
|
||||||
*/
|
*/
|
||||||
@Index()
|
@Index()
|
||||||
@Column('timestamp with time zone', {
|
@Column('timestamp with time zone', {
|
||||||
|
@ -16,7 +16,7 @@ export class Instance {
|
||||||
public caughtAt: Date;
|
public caughtAt: Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hostname
|
* ホスト
|
||||||
*/
|
*/
|
||||||
@Index({ unique: true })
|
@Index({ unique: true })
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
|
@ -26,7 +26,7 @@ export class Instance {
|
||||||
public host: string;
|
public host: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of users on this instance.
|
* インスタンスのユーザー数
|
||||||
*/
|
*/
|
||||||
@Column('integer', {
|
@Column('integer', {
|
||||||
default: 0,
|
default: 0,
|
||||||
|
@ -35,7 +35,7 @@ export class Instance {
|
||||||
public usersCount: number;
|
public usersCount: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of notes on this instance.
|
* インスタンスの投稿数
|
||||||
*/
|
*/
|
||||||
@Column('integer', {
|
@Column('integer', {
|
||||||
default: 0,
|
default: 0,
|
||||||
|
@ -44,7 +44,7 @@ export class Instance {
|
||||||
public notesCount: number;
|
public notesCount: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of local users who are followed by users from this instance.
|
* このインスタンスのユーザーからフォローされている、自インスタンスのユーザーの数
|
||||||
*/
|
*/
|
||||||
@Column('integer', {
|
@Column('integer', {
|
||||||
default: 0,
|
default: 0,
|
||||||
|
@ -52,7 +52,7 @@ export class Instance {
|
||||||
public followingCount: number;
|
public followingCount: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of users from this instance who are followed by local users.
|
* このインスタンスのユーザーをフォローしている、自インスタンスのユーザーの数
|
||||||
*/
|
*/
|
||||||
@Column('integer', {
|
@Column('integer', {
|
||||||
default: 0,
|
default: 0,
|
||||||
|
@ -60,7 +60,7 @@ export class Instance {
|
||||||
public followersCount: number;
|
public followersCount: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamp of the latest outgoing HTTP request.
|
* 直近のリクエスト送信日時
|
||||||
*/
|
*/
|
||||||
@Column('timestamp with time zone', {
|
@Column('timestamp with time zone', {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -68,7 +68,7 @@ export class Instance {
|
||||||
public latestRequestSentAt: Date | null;
|
public latestRequestSentAt: Date | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP status code that was received for the last outgoing HTTP request.
|
* 直近のリクエスト送信時のHTTPステータスコード
|
||||||
*/
|
*/
|
||||||
@Column('integer', {
|
@Column('integer', {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -76,7 +76,7 @@ export class Instance {
|
||||||
public latestStatus: number | null;
|
public latestStatus: number | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamp of the latest incoming HTTP request.
|
* 直近のリクエスト受信日時
|
||||||
*/
|
*/
|
||||||
@Column('timestamp with time zone', {
|
@Column('timestamp with time zone', {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
@ -84,13 +84,13 @@ export class Instance {
|
||||||
public latestRequestReceivedAt: Date | null;
|
public latestRequestReceivedAt: Date | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timestamp of last communication with this instance (incoming or outgoing).
|
* このインスタンスと最後にやり取りした日時
|
||||||
*/
|
*/
|
||||||
@Column('timestamp with time zone')
|
@Column('timestamp with time zone')
|
||||||
public lastCommunicatedAt: Date;
|
public lastCommunicatedAt: Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this instance seems unresponsive.
|
* このインスタンスと不通かどうか
|
||||||
*/
|
*/
|
||||||
@Column('boolean', {
|
@Column('boolean', {
|
||||||
default: false,
|
default: false,
|
||||||
|
@ -98,7 +98,7 @@ export class Instance {
|
||||||
public isNotResponding: boolean;
|
public isNotResponding: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether sending activities to this instance has been suspended.
|
* このインスタンスへの配信を停止するか
|
||||||
*/
|
*/
|
||||||
@Index()
|
@Index()
|
||||||
@Column('boolean', {
|
@Column('boolean', {
|
||||||
|
|
|
@ -6,16 +6,13 @@ import { Packed } from '@/misc/schema.js';
|
||||||
import { awaitAll, Promiseable } from '@/prelude/await-all.js';
|
import { awaitAll, Promiseable } from '@/prelude/await-all.js';
|
||||||
import { populateEmojis } from '@/misc/populate-emojis.js';
|
import { populateEmojis } from '@/misc/populate-emojis.js';
|
||||||
import { getAntennas } from '@/misc/antenna-cache.js';
|
import { getAntennas } from '@/misc/antenna-cache.js';
|
||||||
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD, HOUR } from '@/const.js';
|
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
||||||
import { Cache } from '@/misc/cache.js';
|
import { Cache } from '@/misc/cache.js';
|
||||||
import { db } from '@/db/postgre.js';
|
import { db } from '@/db/postgre.js';
|
||||||
import { Instance } from '../entities/instance.js';
|
import { Instance } from '../entities/instance.js';
|
||||||
import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, RenoteMutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, AntennaNotes, ChannelFollowings, Instances, DriveFiles } from '../index.js';
|
import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, RenoteMutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, AntennaNotes, ChannelFollowings, Instances, DriveFiles } from '../index.js';
|
||||||
|
|
||||||
const userInstanceCache = new Cache<Instance | null>(
|
const userInstanceCache = new Cache<Instance | null>(1000 * 60 * 60 * 3);
|
||||||
3 * HOUR,
|
|
||||||
(host) => Instances.findOneBy({ host }).then(x => x ?? undefined),
|
|
||||||
);
|
|
||||||
|
|
||||||
type IsUserDetailed<Detailed extends boolean> = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>;
|
type IsUserDetailed<Detailed extends boolean> = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>;
|
||||||
type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends boolean> =
|
type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends boolean> =
|
||||||
|
@ -30,7 +27,7 @@ const ajv = new Ajv();
|
||||||
const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const;
|
const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const;
|
||||||
const passwordSchema = { type: 'string', minLength: 1 } as const;
|
const passwordSchema = { type: 'string', minLength: 1 } as const;
|
||||||
const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const;
|
const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const;
|
||||||
const descriptionSchema = { type: 'string', minLength: 1, maxLength: 2048 } as const;
|
const descriptionSchema = { type: 'string', minLength: 1, maxLength: 500 } as const;
|
||||||
const locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const;
|
const locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const;
|
||||||
const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const;
|
const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const;
|
||||||
|
|
||||||
|
@ -312,15 +309,17 @@ export const UserRepository = db.getRepository(User).extend({
|
||||||
isModerator: user.isModerator || falsy,
|
isModerator: user.isModerator || falsy,
|
||||||
isBot: user.isBot || falsy,
|
isBot: user.isBot || falsy,
|
||||||
isCat: user.isCat || falsy,
|
isCat: user.isCat || falsy,
|
||||||
instance: !user.host ? undefined : userInstanceCache.fetch(user.host)
|
instance: user.host ? userInstanceCache.fetch(user.host,
|
||||||
.then(instance => !instance ? undefined : {
|
() => Instances.findOneBy({ host: user.host! }),
|
||||||
|
v => v != null,
|
||||||
|
).then(instance => instance ? {
|
||||||
name: instance.name,
|
name: instance.name,
|
||||||
softwareName: instance.softwareName,
|
softwareName: instance.softwareName,
|
||||||
softwareVersion: instance.softwareVersion,
|
softwareVersion: instance.softwareVersion,
|
||||||
iconUrl: instance.iconUrl,
|
iconUrl: instance.iconUrl,
|
||||||
faviconUrl: instance.faviconUrl,
|
faviconUrl: instance.faviconUrl,
|
||||||
themeColor: instance.themeColor,
|
themeColor: instance.themeColor,
|
||||||
}),
|
} : undefined) : undefined,
|
||||||
emojis: populateEmojis(user.emojis, user.host),
|
emojis: populateEmojis(user.emojis, user.host),
|
||||||
onlineStatus: this.getOnlineStatus(user),
|
onlineStatus: this.getOnlineStatus(user),
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,8 @@ export default async (job: Bull.Job<DeliverJobData>) => {
|
||||||
if (res instanceof StatusError) {
|
if (res instanceof StatusError) {
|
||||||
// 4xx
|
// 4xx
|
||||||
if (res.isClientError) {
|
if (res.isClientError) {
|
||||||
// A client error means that something is wrong with the request we are making,
|
// HTTPステータスコード4xxはクライアントエラーであり、それはつまり
|
||||||
// which means that retrying it makes no sense.
|
// 何回再送しても成功することはないということなのでエラーにはしないでおく
|
||||||
return `${res.statusCode} ${res.statusMessage}`;
|
return `${res.statusCode} ${res.statusMessage}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,8 @@ import { uriPersonCache, userByIdCache } from '@/services/user-cache.js';
|
||||||
import { IObject, getApId } from './type.js';
|
import { IObject, getApId } from './type.js';
|
||||||
import { resolvePerson } from './models/person.js';
|
import { resolvePerson } from './models/person.js';
|
||||||
|
|
||||||
const publicKeyCache = new Cache<UserPublickey>(
|
const publicKeyCache = new Cache<UserPublickey | null>(Infinity);
|
||||||
Infinity,
|
const publicKeyByUserIdCache = new Cache<UserPublickey | null>(Infinity);
|
||||||
(keyId) => UserPublickeys.findOneBy({ keyId }).then(x => x ?? undefined),
|
|
||||||
);
|
|
||||||
const publicKeyByUserIdCache = new Cache<UserPublickey>(
|
|
||||||
Infinity,
|
|
||||||
(userId) => UserPublickeys.findOneBy({ userId }).then(x => x ?? undefined),
|
|
||||||
);
|
|
||||||
|
|
||||||
export type UriParseResult = {
|
export type UriParseResult = {
|
||||||
/** wether the URI was generated by us */
|
/** wether the URI was generated by us */
|
||||||
|
@ -105,9 +99,13 @@ export default class DbResolver {
|
||||||
if (parsed.local) {
|
if (parsed.local) {
|
||||||
if (parsed.type !== 'users') return null;
|
if (parsed.type !== 'users') return null;
|
||||||
|
|
||||||
return await userByIdCache.fetch(parsed.id) ?? null;
|
return await userByIdCache.fetchMaybe(parsed.id, () => Users.findOneBy({
|
||||||
|
id: parsed.id,
|
||||||
|
}).then(x => x ?? undefined)) ?? null;
|
||||||
} else {
|
} else {
|
||||||
return await uriPersonCache.fetch(parsed.uri) ?? null;
|
return await uriPersonCache.fetch(parsed.uri, () => Users.findOneBy({
|
||||||
|
uri: parsed.uri,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,12 +116,20 @@ export default class DbResolver {
|
||||||
user: CacheableRemoteUser;
|
user: CacheableRemoteUser;
|
||||||
key: UserPublickey;
|
key: UserPublickey;
|
||||||
} | null> {
|
} | null> {
|
||||||
const key = await publicKeyCache.fetch(keyId);
|
const key = await publicKeyCache.fetch(keyId, async () => {
|
||||||
|
const key = await UserPublickeys.findOneBy({
|
||||||
|
keyId,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (key == null) return null;
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}, key => key != null);
|
||||||
|
|
||||||
if (key == null) return null;
|
if (key == null) return null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
user: await userByIdCache.fetch(key.userId) as CacheableRemoteUser,
|
user: await userByIdCache.fetch(key.userId, () => Users.findOneByOrFail({ id: key.userId })) as CacheableRemoteUser,
|
||||||
key,
|
key,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -139,7 +145,7 @@ export default class DbResolver {
|
||||||
|
|
||||||
if (user == null) return null;
|
if (user == null) return null;
|
||||||
|
|
||||||
const key = await publicKeyByUserIdCache.fetch(user.id);
|
const key = await publicKeyByUserIdCache.fetch(user.id, () => UserPublickeys.findOneBy({ userId: user.id }), v => v != null);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
user,
|
user,
|
||||||
|
|
|
@ -119,18 +119,26 @@ export default class DeliverManager {
|
||||||
|
|
||||||
if (this.recipes.some(r => isFollowers(r))) {
|
if (this.recipes.some(r => isFollowers(r))) {
|
||||||
// followers deliver
|
// followers deliver
|
||||||
const followers = await Followings.createQueryBuilder('followings')
|
// TODO: SELECT DISTINCT ON ("followerSharedInbox") "followerSharedInbox" みたいな問い合わせにすればよりパフォーマンス向上できそう
|
||||||
// return either the shared inbox (if available) or the individual inbox
|
// ただ、sharedInboxがnullなリモートユーザーも稀におり、その対応ができなさそう?
|
||||||
.select('COALESCE(followings.followerSharedInbox, followings.followerInbox)', 'inbox')
|
const followers = await Followings.find({
|
||||||
// so we don't have to make our inboxes Set work as hard
|
where: {
|
||||||
.distinct(true)
|
followeeId: this.actor.id,
|
||||||
// ...for the specific actors followers
|
followerHost: Not(IsNull()),
|
||||||
.where('followings.followeeId = :actorId', { actorId: this.actor.id })
|
},
|
||||||
// don't deliver to ourselves
|
select: {
|
||||||
.andWhere('followings.followerHost IS NOT NULL')
|
followerSharedInbox: true,
|
||||||
.getRawMany();
|
followerInbox: true,
|
||||||
|
},
|
||||||
|
}) as {
|
||||||
|
followerSharedInbox: string | null;
|
||||||
|
followerInbox: string;
|
||||||
|
}[];
|
||||||
|
|
||||||
followers.forEach(({ inbox }) => inboxes.add(inbox));
|
for (const following of followers) {
|
||||||
|
const inbox = following.followerSharedInbox || following.followerInbox;
|
||||||
|
inboxes.add(inbox);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.recipes.filter((recipe): recipe is IDirectRecipe =>
|
this.recipes.filter((recipe): recipe is IDirectRecipe =>
|
||||||
|
|
|
@ -23,6 +23,8 @@ import Featured from './activitypub/featured.js';
|
||||||
// Init router
|
// Init router
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
|
//#region Routing
|
||||||
|
|
||||||
function inbox(ctx: Router.RouterContext) {
|
function inbox(ctx: Router.RouterContext) {
|
||||||
let signature;
|
let signature;
|
||||||
|
|
||||||
|
@ -43,8 +45,6 @@ const LD_JSON = 'application/ld+json; profile="https://www.w3.org/ns/activitystr
|
||||||
|
|
||||||
function isActivityPubReq(ctx: Router.RouterContext) {
|
function isActivityPubReq(ctx: Router.RouterContext) {
|
||||||
ctx.response.vary('Accept');
|
ctx.response.vary('Accept');
|
||||||
// if no accept header is supplied, koa returns the 1st, so html is used as a dummy
|
|
||||||
// i.e. activitypub requests must be explicit
|
|
||||||
const accepted = ctx.accepts('html', ACTIVITY_JSON, LD_JSON);
|
const accepted = ctx.accepts('html', ACTIVITY_JSON, LD_JSON);
|
||||||
return typeof accepted === 'string' && !accepted.match(/html/);
|
return typeof accepted === 'string' && !accepted.match(/html/);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ router.get('/notes/:note', async (ctx, next) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// redirect if remote
|
// リモートだったらリダイレクト
|
||||||
if (note.userHost != null) {
|
if (note.userHost != null) {
|
||||||
if (note.uri == null || isSelfHost(note.userHost)) {
|
if (note.uri == null || isSelfHost(note.userHost)) {
|
||||||
ctx.status = 500;
|
ctx.status = 500;
|
||||||
|
@ -94,15 +94,6 @@ router.get('/notes/:note', async (ctx, next) => {
|
||||||
|
|
||||||
// note activity
|
// note activity
|
||||||
router.get('/notes/:note/activity', async ctx => {
|
router.get('/notes/:note/activity', async ctx => {
|
||||||
if (!isActivityPubReq(ctx)) {
|
|
||||||
/*
|
|
||||||
Redirect to the human readable page. in this case using next is not possible,
|
|
||||||
since there is no human readable page explicitly for the activity.
|
|
||||||
*/
|
|
||||||
ctx.redirect(`/notes/${ctx.params.note}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const note = await Notes.findOneBy({
|
const note = await Notes.findOneBy({
|
||||||
id: ctx.params.note,
|
id: ctx.params.note,
|
||||||
userHost: IsNull(),
|
userHost: IsNull(),
|
||||||
|
@ -194,6 +185,7 @@ router.get('/@:user', async (ctx, next) => {
|
||||||
|
|
||||||
await userInfo(ctx, user);
|
await userInfo(ctx, user);
|
||||||
});
|
});
|
||||||
|
//#endregion
|
||||||
|
|
||||||
// emoji
|
// emoji
|
||||||
router.get('/emojis/:emoji', async ctx => {
|
router.get('/emojis/:emoji', async ctx => {
|
||||||
|
|
|
@ -3,13 +3,10 @@ import { Users, AccessTokens, Apps } from '@/models/index.js';
|
||||||
import { AccessToken } from '@/models/entities/access-token.js';
|
import { AccessToken } from '@/models/entities/access-token.js';
|
||||||
import { Cache } from '@/misc/cache.js';
|
import { Cache } from '@/misc/cache.js';
|
||||||
import { App } from '@/models/entities/app.js';
|
import { App } from '@/models/entities/app.js';
|
||||||
import { userByIdCache, localUserByNativeTokenCache } from '@/services/user-cache.js';
|
import { localUserByIdCache, localUserByNativeTokenCache } from '@/services/user-cache.js';
|
||||||
import isNativeToken from './common/is-native-token.js';
|
import isNativeToken from './common/is-native-token.js';
|
||||||
|
|
||||||
const appCache = new Cache<App>(
|
const appCache = new Cache<App>(Infinity);
|
||||||
Infinity,
|
|
||||||
(id) => Apps.findOneByOrFail({ id }),
|
|
||||||
);
|
|
||||||
|
|
||||||
export class AuthenticationError extends Error {
|
export class AuthenticationError extends Error {
|
||||||
constructor(message: string) {
|
constructor(message: string) {
|
||||||
|
@ -42,7 +39,8 @@ export default async (authorization: string | null | undefined, bodyToken: strin
|
||||||
const token: string = maybeToken;
|
const token: string = maybeToken;
|
||||||
|
|
||||||
if (isNativeToken(token)) {
|
if (isNativeToken(token)) {
|
||||||
const user = await localUserByNativeTokenCache.fetch(token);
|
const user = await localUserByNativeTokenCache.fetch(token,
|
||||||
|
() => Users.findOneBy({ token }) as Promise<ILocalUser | null>);
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new AuthenticationError('unknown token');
|
throw new AuthenticationError('unknown token');
|
||||||
|
@ -66,13 +64,14 @@ export default async (authorization: string | null | undefined, bodyToken: strin
|
||||||
lastUsedAt: new Date(),
|
lastUsedAt: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const user = await userByIdCache.fetch(accessToken.userId);
|
const user = await localUserByIdCache.fetch(accessToken.userId,
|
||||||
|
() => Users.findOneBy({
|
||||||
// can't authorize remote users
|
id: accessToken.userId,
|
||||||
if (!Users.isLocalUser(user)) return [null, null];
|
}) as Promise<ILocalUser>);
|
||||||
|
|
||||||
if (accessToken.appId) {
|
if (accessToken.appId) {
|
||||||
const app = await appCache.fetch(accessToken.appId);
|
const app = await appCache.fetch(accessToken.appId,
|
||||||
|
() => Apps.findOneByOrFail({ id: accessToken.appId! }));
|
||||||
|
|
||||||
return [user, {
|
return [user, {
|
||||||
id: accessToken.id,
|
id: accessToken.id,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
import { Meta } from '@/models/entities/meta.js';
|
||||||
import { insertModerationLog } from '@/services/insert-moderation-log.js';
|
import { insertModerationLog } from '@/services/insert-moderation-log.js';
|
||||||
import { fetchMeta, setMeta } from '@/misc/fetch-meta.js';
|
import { db } from '@/db/postgre.js';
|
||||||
import define from '../../define.js';
|
import define from '../../define.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -374,10 +375,20 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||||
set.deeplIsPro = ps.deeplIsPro;
|
set.deeplIsPro = ps.deeplIsPro;
|
||||||
}
|
}
|
||||||
|
|
||||||
const meta = await fetchMeta();
|
await db.transaction(async transactionalEntityManager => {
|
||||||
await setMeta({
|
const metas = await transactionalEntityManager.find(Meta, {
|
||||||
...meta,
|
order: {
|
||||||
...set,
|
id: 'DESC',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const meta = metas[0];
|
||||||
|
|
||||||
|
if (meta) {
|
||||||
|
await transactionalEntityManager.update(Meta, meta.id, set);
|
||||||
|
} else {
|
||||||
|
await transactionalEntityManager.save(Meta, set);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
insertModerationLog(me, 'updateMeta');
|
insertModerationLog(me, 'updateMeta');
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Apps } from '@/models/index.js';
|
||||||
import { genId } from '@/misc/gen-id.js';
|
import { genId } from '@/misc/gen-id.js';
|
||||||
import { unique } from '@/prelude/array.js';
|
import { unique } from '@/prelude/array.js';
|
||||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||||
import { kinds } from '@/misc/api-permissions.js';
|
|
||||||
import define from '../../define.js';
|
import define from '../../define.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -22,14 +21,10 @@ export const paramDef = {
|
||||||
properties: {
|
properties: {
|
||||||
name: { type: 'string' },
|
name: { type: 'string' },
|
||||||
description: { type: 'string' },
|
description: { type: 'string' },
|
||||||
permission: {
|
permission: { type: 'array', uniqueItems: true, items: {
|
||||||
type: 'array',
|
|
||||||
uniqueItems: true,
|
|
||||||
items: {
|
|
||||||
type: 'string',
|
type: 'string',
|
||||||
enum: kinds,
|
// FIXME: add enum of possible permissions
|
||||||
},
|
} },
|
||||||
},
|
|
||||||
callbackUrl: { type: 'string', nullable: true },
|
callbackUrl: { type: 'string', nullable: true },
|
||||||
},
|
},
|
||||||
required: ['name', 'description', 'permission'],
|
required: ['name', 'description', 'permission'],
|
||||||
|
|
|
@ -32,7 +32,10 @@ app.use(async (ctx, next) => {
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(bodyParser());
|
app.use(bodyParser({
|
||||||
|
// リクエストが multipart/form-data でない限りはJSONだと見なす
|
||||||
|
detectJSON: ctx => !ctx.is('multipart/form-data'),
|
||||||
|
}));
|
||||||
|
|
||||||
// Init multer instance
|
// Init multer instance
|
||||||
const upload = multer({
|
const upload = multer({
|
||||||
|
|
|
@ -11,51 +11,48 @@ import { getIpHash } from '@/misc/get-ip-hash.js';
|
||||||
import signin from '../common/signin.js';
|
import signin from '../common/signin.js';
|
||||||
import { verifyLogin, hash } from '../2fa.js';
|
import { verifyLogin, hash } from '../2fa.js';
|
||||||
import { limiter } from '../limiter.js';
|
import { limiter } from '../limiter.js';
|
||||||
import { ApiError } from '../error.js';
|
|
||||||
|
|
||||||
export default async (ctx: Koa.Context) => {
|
export default async (ctx: Koa.Context) => {
|
||||||
ctx.set('Access-Control-Allow-Origin', config.url);
|
ctx.set('Access-Control-Allow-Origin', config.url);
|
||||||
ctx.set('Access-Control-Allow-Credentials', 'true');
|
ctx.set('Access-Control-Allow-Credentials', 'true');
|
||||||
|
|
||||||
const body = ctx.request.body as any;
|
const body = ctx.request.body as any;
|
||||||
const { username, password, token } = body;
|
const username = body['username'];
|
||||||
|
const password = body['password'];
|
||||||
|
const token = body['token'];
|
||||||
|
|
||||||
// taken from @server/api/api-handler.ts
|
function error(status: number, error: { id: string }) {
|
||||||
function error (e: ApiError): void {
|
ctx.status = status;
|
||||||
ctx.status = e.httpStatusCode;
|
ctx.body = { error };
|
||||||
if (e.httpStatusCode === 401) {
|
|
||||||
ctx.response.set('WWW-Authenticate', 'Bearer');
|
|
||||||
}
|
|
||||||
ctx.body = {
|
|
||||||
error: {
|
|
||||||
message: e!.message,
|
|
||||||
code: e!.code,
|
|
||||||
...(e!.info ? { info: e!.info } : {}),
|
|
||||||
endpoint: endpoint.name,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// not more than 1 attempt per second and not more than 10 attempts per hour
|
// not more than 1 attempt per second and not more than 10 attempts per hour
|
||||||
await limiter({ key: 'signin', duration: 60 * 60 * 1000, max: 10, minInterval: 1000 }, getIpHash(ctx.ip));
|
await limiter({ key: 'signin', duration: 60 * 60 * 1000, max: 10, minInterval: 1000 }, getIpHash(ctx.ip));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error(new ApiError('RATE_LIMIT_EXCEEDED'));
|
ctx.status = 429;
|
||||||
|
ctx.body = {
|
||||||
|
error: {
|
||||||
|
message: 'Too many failed attempts to sign in. Try again later.',
|
||||||
|
code: 'TOO_MANY_AUTHENTICATION_FAILURES',
|
||||||
|
id: '22d05606-fbcf-421a-a2db-b32610dcfd1b',
|
||||||
|
},
|
||||||
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof username !== 'string') {
|
if (typeof username !== 'string') {
|
||||||
error(new ApiError('INVALID_PARAM', { param: 'username', reason: 'not a string' }));
|
ctx.status = 400;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof password !== 'string') {
|
if (typeof password !== 'string') {
|
||||||
error(new ApiError('INVALID_PARAM', { param: 'password', reason: 'not a string' }));
|
ctx.status = 400;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token != null && typeof token !== 'string') {
|
if (token != null && typeof token !== 'string') {
|
||||||
error(new ApiError('INVALID_PARAM', { param: 'token', reason: 'provided but not a string' }));
|
ctx.status = 400;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,12 +63,16 @@ export default async (ctx: Koa.Context) => {
|
||||||
}) as ILocalUser;
|
}) as ILocalUser;
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
error(new ApiError('NO_SUCH_USER'));
|
error(404, {
|
||||||
|
id: '6cc579cc-885d-43d8-95c2-b8c7fc963280',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.isSuspended) {
|
if (user.isSuspended) {
|
||||||
error(new ApiError('SUSPENDED'));
|
error(403, {
|
||||||
|
id: 'e03a5f46-d309-4865-9b69-56282d94e1eb',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ export default async (ctx: Koa.Context) => {
|
||||||
// Compare password
|
// Compare password
|
||||||
const same = await bcrypt.compare(password, profile.password!);
|
const same = await bcrypt.compare(password, profile.password!);
|
||||||
|
|
||||||
async function fail(): void {
|
async function fail(status?: number, failure?: { id: string }) {
|
||||||
// Append signin history
|
// Append signin history
|
||||||
await Signins.insert({
|
await Signins.insert({
|
||||||
id: genId(),
|
id: genId(),
|
||||||
|
@ -91,7 +92,7 @@ export default async (ctx: Koa.Context) => {
|
||||||
success: false,
|
success: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
error(new ApiError('ACCESS_DENIED'));
|
error(status || 500, failure || { id: '4e30e80c-e338-45a0-8c8f-44455efa3b76' });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile.twoFactorEnabled) {
|
if (!profile.twoFactorEnabled) {
|
||||||
|
@ -99,14 +100,18 @@ export default async (ctx: Koa.Context) => {
|
||||||
signin(ctx, user);
|
signin(ctx, user);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
if (!same) {
|
if (!same) {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,12 +126,16 @@ export default async (ctx: Koa.Context) => {
|
||||||
signin(ctx, user);
|
signin(ctx, user);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: 'cdf1235b-ac71-46d4-a3a6-84ccce48df6f',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (body.credentialId) {
|
} else if (body.credentialId) {
|
||||||
if (!same && !profile.usePasswordLessLogin) {
|
if (!same && !profile.usePasswordLessLogin) {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +149,9 @@ export default async (ctx: Koa.Context) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!challenge) {
|
if (!challenge) {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: '2715a88a-2125-4013-932f-aa6fe72792da',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +161,9 @@ export default async (ctx: Koa.Context) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (new Date().getTime() - challenge.createdAt.getTime() >= 5 * 60 * 1000) {
|
if (new Date().getTime() - challenge.createdAt.getTime() >= 5 * 60 * 1000) {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: '2715a88a-2125-4013-932f-aa6fe72792da',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +177,9 @@ export default async (ctx: Koa.Context) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!securityKey) {
|
if (!securityKey) {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: '66269679-aeaf-4474-862b-eb761197e046',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,12 +196,16 @@ export default async (ctx: Koa.Context) => {
|
||||||
signin(ctx, user);
|
signin(ctx, user);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: '93b86c4b-72f9-40eb-9815-798928603d1e',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!same && !profile.usePasswordLessLogin) {
|
if (!same && !profile.usePasswordLessLogin) {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: '932c904e-9460-45b7-9ce6-7ed33be7eb2c',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +214,9 @@ export default async (ctx: Koa.Context) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (keys.length === 0) {
|
if (keys.length === 0) {
|
||||||
await fail();
|
await fail(403, {
|
||||||
|
id: 'f27fd449-9af4-4841-9249-1f989b9fa4a4',
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { IsNull, MoreThan } from 'typeorm';
|
||||||
import config from '@/config/index.js';
|
import config from '@/config/index.js';
|
||||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||||
import { Users, Notes } from '@/models/index.js';
|
import { Users, Notes } from '@/models/index.js';
|
||||||
|
import { Cache } from '@/misc/cache.js';
|
||||||
|
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
|
@ -17,33 +18,7 @@ export const links = [{
|
||||||
href: config.url + nodeinfo2_0path,
|
href: config.url + nodeinfo2_0path,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
const repository = 'https://akkoma.dev/FoundKeyGang/FoundKey';
|
const nodeinfo2 = async () => {
|
||||||
|
|
||||||
type NodeInfo2Base = {
|
|
||||||
software: {
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
repository?: string; // Not used in NodeInfo 2.0; used in 2.1
|
|
||||||
};
|
|
||||||
protocols: string[];
|
|
||||||
services: {
|
|
||||||
inbound: string[];
|
|
||||||
outbound: string[];
|
|
||||||
};
|
|
||||||
openRegistrations: boolean;
|
|
||||||
usage: {
|
|
||||||
users: {
|
|
||||||
total: number;
|
|
||||||
activeHalfyear: number;
|
|
||||||
activeMonth: number;
|
|
||||||
};
|
|
||||||
localPosts: number;
|
|
||||||
localComments: number;
|
|
||||||
};
|
|
||||||
metadata: Record<string, any>;
|
|
||||||
};
|
|
||||||
|
|
||||||
const nodeinfo2 = async (): Promise<NodeInfo2Base> => {
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const [
|
const [
|
||||||
meta,
|
meta,
|
||||||
|
@ -65,7 +40,7 @@ const nodeinfo2 = async (): Promise<NodeInfo2Base> => {
|
||||||
software: {
|
software: {
|
||||||
name: 'foundkey',
|
name: 'foundkey',
|
||||||
version: config.version,
|
version: config.version,
|
||||||
repository,
|
repository: 'https://akkoma.dev/FoundKeyGang/FoundKey',
|
||||||
},
|
},
|
||||||
protocols: ['activitypub'],
|
protocols: ['activitypub'],
|
||||||
services: {
|
services: {
|
||||||
|
@ -87,7 +62,7 @@ const nodeinfo2 = async (): Promise<NodeInfo2Base> => {
|
||||||
},
|
},
|
||||||
langs: meta.langs,
|
langs: meta.langs,
|
||||||
tosUrl: meta.ToSUrl,
|
tosUrl: meta.ToSUrl,
|
||||||
repositoryUrl: repository,
|
repositoryUrl: meta.repositoryUrl,
|
||||||
feedbackUrl: 'ircs://irc.akkoma.dev/foundkey',
|
feedbackUrl: 'ircs://irc.akkoma.dev/foundkey',
|
||||||
disableRegistration: meta.disableRegistration,
|
disableRegistration: meta.disableRegistration,
|
||||||
disableLocalTimeline: meta.disableLocalTimeline,
|
disableLocalTimeline: meta.disableLocalTimeline,
|
||||||
|
@ -107,15 +82,17 @@ const nodeinfo2 = async (): Promise<NodeInfo2Base> => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const cache = new Cache<Awaited<ReturnType<typeof nodeinfo2>>>(1000 * 60 * 10);
|
||||||
|
|
||||||
router.get(nodeinfo2_1path, async ctx => {
|
router.get(nodeinfo2_1path, async ctx => {
|
||||||
const base = await nodeinfo2();
|
const base = await cache.fetch(null, () => nodeinfo2());
|
||||||
|
|
||||||
ctx.body = { version: '2.1', ...base };
|
ctx.body = { version: '2.1', ...base };
|
||||||
ctx.set('Cache-Control', 'public, max-age=600');
|
ctx.set('Cache-Control', 'public, max-age=600');
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get(nodeinfo2_0path, async ctx => {
|
router.get(nodeinfo2_0path, async ctx => {
|
||||||
const base = await nodeinfo2();
|
const base = await cache.fetch(null, () => nodeinfo2());
|
||||||
|
|
||||||
delete base.software.repository;
|
delete base.software.repository;
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,28 @@
|
||||||
import { IsNull } from 'typeorm';
|
import { IsNull } from 'typeorm';
|
||||||
import { ILocalUser } from '@/models/entities/user.js';
|
import { ILocalUser } from '@/models/entities/user.js';
|
||||||
import { Users } from '@/models/index.js';
|
import { Users } from '@/models/index.js';
|
||||||
|
import { Cache } from '@/misc/cache.js';
|
||||||
import { createSystemUser } from './create-system-user.js';
|
import { createSystemUser } from './create-system-user.js';
|
||||||
|
|
||||||
const ACTOR_USERNAME = 'instance.actor' as const;
|
const ACTOR_USERNAME = 'instance.actor' as const;
|
||||||
|
|
||||||
let instanceActor = await Users.findOneBy({
|
const cache = new Cache<ILocalUser>(Infinity);
|
||||||
|
|
||||||
|
export async function getInstanceActor(): Promise<ILocalUser> {
|
||||||
|
const cached = cache.get(null);
|
||||||
|
if (cached) return cached;
|
||||||
|
|
||||||
|
const user = await Users.findOneBy({
|
||||||
host: IsNull(),
|
host: IsNull(),
|
||||||
username: ACTOR_USERNAME,
|
username: ACTOR_USERNAME,
|
||||||
}) as ILocalUser | undefined;
|
}) as ILocalUser | undefined;
|
||||||
|
|
||||||
export async function getInstanceActor(): Promise<ILocalUser> {
|
if (user) {
|
||||||
if (instanceActor) {
|
cache.set(null, user);
|
||||||
return instanceActor;
|
return user;
|
||||||
} else {
|
} else {
|
||||||
instanceActor = await createSystemUser(ACTOR_USERNAME) as ILocalUser;
|
const created = await createSystemUser(ACTOR_USERNAME) as ILocalUser;
|
||||||
|
cache.set(null, created);
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,22 +36,13 @@ import { Cache } from '@/misc/cache.js';
|
||||||
import { UserProfile } from '@/models/entities/user-profile.js';
|
import { UserProfile } from '@/models/entities/user-profile.js';
|
||||||
import { getActiveWebhooks } from '@/misc/webhook-cache.js';
|
import { getActiveWebhooks } from '@/misc/webhook-cache.js';
|
||||||
import { IActivity } from '@/remote/activitypub/type.js';
|
import { IActivity } from '@/remote/activitypub/type.js';
|
||||||
import { MINUTE } from '@/const.js';
|
|
||||||
import { updateHashtags } from '../update-hashtag.js';
|
import { updateHashtags } from '../update-hashtag.js';
|
||||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js';
|
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js';
|
||||||
import { createNotification } from '../create-notification.js';
|
import { createNotification } from '../create-notification.js';
|
||||||
import { addNoteToAntenna } from '../add-note-to-antenna.js';
|
import { addNoteToAntenna } from '../add-note-to-antenna.js';
|
||||||
import { deliverToRelays } from '../relay.js';
|
import { deliverToRelays } from '../relay.js';
|
||||||
|
|
||||||
const mutedWordsCache = new Cache<{ userId: UserProfile['userId']; mutedWords: UserProfile['mutedWords']; }[]>(
|
const mutedWordsCache = new Cache<{ userId: UserProfile['userId']; mutedWords: UserProfile['mutedWords']; }[]>(1000 * 60 * 5);
|
||||||
5 * MINUTE,
|
|
||||||
() => UserProfiles.find({
|
|
||||||
where: {
|
|
||||||
enableWordMute: true,
|
|
||||||
},
|
|
||||||
select: ['userId', 'mutedWords'],
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
|
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
|
||||||
|
|
||||||
|
@ -266,7 +257,12 @@ export default async (user: { id: User['id']; username: User['username']; host:
|
||||||
incNotesCountOfUser(user);
|
incNotesCountOfUser(user);
|
||||||
|
|
||||||
// Word mute
|
// Word mute
|
||||||
mutedWordsCache.fetch(null).then(us => {
|
mutedWordsCache.fetch(null, () => UserProfiles.find({
|
||||||
|
where: {
|
||||||
|
enableWordMute: true,
|
||||||
|
},
|
||||||
|
select: ['userId', 'mutedWords'],
|
||||||
|
})).then(us => {
|
||||||
for (const u of us) {
|
for (const u of us) {
|
||||||
checkWordMute(note, { id: u.userId }, u.mutedWords).then(shouldMute => {
|
checkWordMute(note, { id: u.userId }, u.mutedWords).then(shouldMute => {
|
||||||
if (shouldMute) {
|
if (shouldMute) {
|
||||||
|
|
|
@ -53,9 +53,11 @@ export default async function(user: { id: User['id']; uri: User['uri']; host: Us
|
||||||
deliverToConcerned(user, note, content);
|
deliverToConcerned(user, note, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
// also deliver delete activity to cascaded notes
|
// also deliever delete activity to cascaded notes
|
||||||
const cascadingNotes = await findCascadingNotes(note);
|
const cascadingNotes = await findCascadingNotes(note);
|
||||||
for (const cascadingNote of cascadingNotes) {
|
for (const cascadingNote of cascadingNotes) {
|
||||||
|
if (!cascadingNote.user) continue;
|
||||||
|
if (!Users.isLocalUser(cascadingNote.user)) continue;
|
||||||
const content = renderActivity(renderDelete(renderTombstone(`${config.url}/notes/${cascadingNote.id}`), cascadingNote.user));
|
const content = renderActivity(renderDelete(renderTombstone(`${config.url}/notes/${cascadingNote.id}`), cascadingNote.user));
|
||||||
deliverToConcerned(cascadingNote.user, cascadingNote, content);
|
deliverToConcerned(cascadingNote.user, cascadingNote, content);
|
||||||
}
|
}
|
||||||
|
@ -105,9 +107,6 @@ async function findCascadingNotes(note: Note): Promise<Note[]> {
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all(replies.map(reply => {
|
await Promise.all(replies.map(reply => {
|
||||||
// only add unique notes
|
|
||||||
if (cascadingNotes.find((x) => x.id == reply.id) != null) return;
|
|
||||||
|
|
||||||
cascadingNotes.push(reply);
|
cascadingNotes.push(reply);
|
||||||
return recursive(reply.id);
|
return recursive(reply.id);
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -15,21 +15,20 @@ type pushNotificationsTypes = {
|
||||||
'readAllMessagingMessagesOfARoom': { userId: string } | { groupId: string };
|
'readAllMessagingMessagesOfARoom': { userId: string } | { groupId: string };
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reduce the content of the push message because of the character limit
|
// プッシュメッセージサーバーには文字数制限があるため、内容を削減します
|
||||||
function truncateNotification(notification: Packed<'Notification'>): any {
|
function truncateNotification(notification: Packed<'Notification'>): any {
|
||||||
if (notification.note) {
|
if (notification.note) {
|
||||||
return {
|
return {
|
||||||
...notification,
|
...notification,
|
||||||
note: {
|
note: {
|
||||||
...notification.note,
|
...notification.note,
|
||||||
// replace text with getNoteSummary
|
// textをgetNoteSummaryしたものに置き換える
|
||||||
text: getNoteSummary(notification.type === 'renote' ? notification.note.renote as Packed<'Note'> : notification.note),
|
text: getNoteSummary(notification.type === 'renote' ? notification.note.renote as Packed<'Note'> : notification.note),
|
||||||
|
|
||||||
cw: undefined,
|
cw: undefined,
|
||||||
reply: undefined,
|
reply: undefined,
|
||||||
renote: undefined,
|
renote: undefined,
|
||||||
// unnecessary, since usually the user who is receiving the notification knows who they are
|
user: undefined as any, // 通知を受け取ったユーザーである場合が多いのでこれも捨てる
|
||||||
user: undefined as any,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -42,7 +41,7 @@ export async function pushNotification<T extends keyof pushNotificationsTypes>(u
|
||||||
|
|
||||||
if (!meta.enableServiceWorker || meta.swPublicKey == null || meta.swPrivateKey == null) return;
|
if (!meta.enableServiceWorker || meta.swPublicKey == null || meta.swPrivateKey == null) return;
|
||||||
|
|
||||||
// Register key pair information
|
// アプリケーションの連絡先と、サーバーサイドの鍵ペアの情報を登録
|
||||||
push.setVapidDetails(config.url,
|
push.setVapidDetails(config.url,
|
||||||
meta.swPublicKey,
|
meta.swPublicKey,
|
||||||
meta.swPrivateKey);
|
meta.swPrivateKey);
|
||||||
|
@ -66,6 +65,10 @@ export async function pushNotification<T extends keyof pushNotificationsTypes>(u
|
||||||
}), {
|
}), {
|
||||||
proxy: config.proxy,
|
proxy: config.proxy,
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
|
//swLogger.info(err.statusCode);
|
||||||
|
//swLogger.info(err.headers);
|
||||||
|
//swLogger.info(err.body);
|
||||||
|
|
||||||
if (err.statusCode === 410) {
|
if (err.statusCode === 410) {
|
||||||
SwSubscriptions.delete({
|
SwSubscriptions.delete({
|
||||||
userId,
|
userId,
|
||||||
|
|
|
@ -3,20 +3,18 @@ import { Instances } from '@/models/index.js';
|
||||||
import { genId } from '@/misc/gen-id.js';
|
import { genId } from '@/misc/gen-id.js';
|
||||||
import { toPuny } from '@/misc/convert-host.js';
|
import { toPuny } from '@/misc/convert-host.js';
|
||||||
import { Cache } from '@/misc/cache.js';
|
import { Cache } from '@/misc/cache.js';
|
||||||
import { HOUR } from '@/const.js';
|
|
||||||
|
|
||||||
const cache = new Cache<Instance>(
|
const cache = new Cache<Instance>(1000 * 60 * 60);
|
||||||
HOUR,
|
|
||||||
(host) => Instances.findOneBy({ host }).then(x => x ?? undefined),
|
|
||||||
);
|
|
||||||
|
|
||||||
export async function registerOrFetchInstanceDoc(idnHost: string): Promise<Instance> {
|
export async function registerOrFetchInstanceDoc(idnHost: string): Promise<Instance> {
|
||||||
const host = toPuny(idnHost);
|
const host = toPuny(idnHost);
|
||||||
|
|
||||||
const cached = cache.fetch(host);
|
const cached = cache.get(host);
|
||||||
if (cached) return cached;
|
if (cached) return cached;
|
||||||
|
|
||||||
// apparently a new instance
|
const index = await Instances.findOneBy({ host });
|
||||||
|
|
||||||
|
if (index == null) {
|
||||||
const i = await Instances.insert({
|
const i = await Instances.insert({
|
||||||
id: genId(),
|
id: genId(),
|
||||||
host,
|
host,
|
||||||
|
@ -26,4 +24,8 @@ export async function registerOrFetchInstanceDoc(idnHost: string): Promise<Insta
|
||||||
|
|
||||||
cache.set(host, i);
|
cache.set(host, i);
|
||||||
return i;
|
return i;
|
||||||
|
} else {
|
||||||
|
cache.set(host, index);
|
||||||
|
return index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,21 +8,11 @@ import { Users, Relays } from '@/models/index.js';
|
||||||
import { genId } from '@/misc/gen-id.js';
|
import { genId } from '@/misc/gen-id.js';
|
||||||
import { Cache } from '@/misc/cache.js';
|
import { Cache } from '@/misc/cache.js';
|
||||||
import { Relay } from '@/models/entities/relay.js';
|
import { Relay } from '@/models/entities/relay.js';
|
||||||
import { MINUTE } from '@/const.js';
|
|
||||||
import { createSystemUser } from './create-system-user.js';
|
import { createSystemUser } from './create-system-user.js';
|
||||||
|
|
||||||
const ACTOR_USERNAME = 'relay.actor' as const;
|
const ACTOR_USERNAME = 'relay.actor' as const;
|
||||||
|
|
||||||
/**
|
const relaysCache = new Cache<Relay[]>(1000 * 60 * 10);
|
||||||
* There is only one cache key: null.
|
|
||||||
* A cache is only used here to have expiring storage.
|
|
||||||
*/
|
|
||||||
const relaysCache = new Cache<Relay[]>(
|
|
||||||
10 * MINUTE,
|
|
||||||
() => Relays.findBy({
|
|
||||||
status: 'accepted',
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
export async function getRelayActor(): Promise<ILocalUser> {
|
export async function getRelayActor(): Promise<ILocalUser> {
|
||||||
const user = await Users.findOneBy({
|
const user = await Users.findOneBy({
|
||||||
|
@ -93,7 +83,9 @@ export async function relayRejected(id: string) {
|
||||||
export async function deliverToRelays(user: { id: User['id']; host: null; }, activity: any) {
|
export async function deliverToRelays(user: { id: User['id']; host: null; }, activity: any) {
|
||||||
if (activity == null) return;
|
if (activity == null) return;
|
||||||
|
|
||||||
const relays = await relaysCache.fetch(null);
|
const relays = await relaysCache.fetch(null, () => Relays.findBy({
|
||||||
|
status: 'accepted',
|
||||||
|
}));
|
||||||
if (relays.length === 0) return;
|
if (relays.length === 0) return;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Not, IsNull } from 'typeorm';
|
import { Not, IsNull } from 'typeorm';
|
||||||
import renderDelete from '@/remote/activitypub/renderer/delete.js';
|
import renderDelete from '@/remote/activitypub/renderer/delete.js';
|
||||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||||
import DeliverManager from '@/remote/activitypub/deliver-manager.js';
|
import { deliver } from '@/queue/index.js';
|
||||||
import config from '@/config/index.js';
|
import config from '@/config/index.js';
|
||||||
import { User } from '@/models/entities/user.js';
|
import { User } from '@/models/entities/user.js';
|
||||||
import { Users, Followings } from '@/models/index.js';
|
import { Users, Followings } from '@/models/index.js';
|
||||||
|
@ -11,11 +11,27 @@ export async function doPostSuspend(user: { id: User['id']; host: User['host'] }
|
||||||
publishInternalEvent('userChangeSuspendedState', { id: user.id, isSuspended: true });
|
publishInternalEvent('userChangeSuspendedState', { id: user.id, isSuspended: true });
|
||||||
|
|
||||||
if (Users.isLocalUser(user)) {
|
if (Users.isLocalUser(user)) {
|
||||||
|
// 知り得る全SharedInboxにDelete配信
|
||||||
const content = renderActivity(renderDelete(`${config.url}/users/${user.id}`, user));
|
const content = renderActivity(renderDelete(`${config.url}/users/${user.id}`, user));
|
||||||
|
|
||||||
// deliver to all of known network
|
const queue: string[] = [];
|
||||||
const dm = new DeliverManager(user, content);
|
|
||||||
dm.addEveryone();
|
const followings = await Followings.find({
|
||||||
await dm.execute();
|
where: [
|
||||||
|
{ followerSharedInbox: Not(IsNull()) },
|
||||||
|
{ followeeSharedInbox: Not(IsNull()) },
|
||||||
|
],
|
||||||
|
select: ['followerSharedInbox', 'followeeSharedInbox'],
|
||||||
|
});
|
||||||
|
|
||||||
|
const inboxes = followings.map(x => x.followerSharedInbox || x.followeeSharedInbox);
|
||||||
|
|
||||||
|
for (const inbox of inboxes) {
|
||||||
|
if (inbox != null && !queue.includes(inbox)) queue.push(inbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const inbox of queue) {
|
||||||
|
deliver(user, content, inbox);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,18 +3,10 @@ import { Users } from '@/models/index.js';
|
||||||
import { Cache } from '@/misc/cache.js';
|
import { Cache } from '@/misc/cache.js';
|
||||||
import { subscriber } from '@/db/redis.js';
|
import { subscriber } from '@/db/redis.js';
|
||||||
|
|
||||||
export const userByIdCache = new Cache<CacheableUser>(
|
export const userByIdCache = new Cache<CacheableUser>(Infinity);
|
||||||
Infinity,
|
export const localUserByNativeTokenCache = new Cache<CacheableLocalUser | null>(Infinity);
|
||||||
(id) => Users.findOneBy({ id }).then(x => x ?? undefined),
|
export const localUserByIdCache = new Cache<CacheableLocalUser>(Infinity);
|
||||||
);
|
export const uriPersonCache = new Cache<CacheableUser | null>(Infinity);
|
||||||
export const localUserByNativeTokenCache = new Cache<CacheableLocalUser>(
|
|
||||||
Infinity,
|
|
||||||
(token) => Users.findOneBy({ token }).then(x => x ?? undefined),
|
|
||||||
);
|
|
||||||
export const uriPersonCache = new Cache<CacheableUser>(
|
|
||||||
Infinity,
|
|
||||||
(uri) => Users.findOneBy({ uri }).then(x => x ?? undefined),
|
|
||||||
);
|
|
||||||
|
|
||||||
subscriber.on('message', async (_, data) => {
|
subscriber.on('message', async (_, data) => {
|
||||||
const obj = JSON.parse(data);
|
const obj = JSON.parse(data);
|
||||||
|
@ -35,6 +27,7 @@ subscriber.on('message', async (_, data) => {
|
||||||
}
|
}
|
||||||
if (Users.isLocalUser(user)) {
|
if (Users.isLocalUser(user)) {
|
||||||
localUserByNativeTokenCache.set(user.token, user);
|
localUserByNativeTokenCache.set(user.token, user);
|
||||||
|
localUserByIdCache.set(user.id, user);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,12 @@ export async function signout() {
|
||||||
const registration = await navigator.serviceWorker.ready;
|
const registration = await navigator.serviceWorker.ready;
|
||||||
const push = await registration.pushManager.getSubscription();
|
const push = await registration.pushManager.getSubscription();
|
||||||
if (push) {
|
if (push) {
|
||||||
await api('sw/unregister', {
|
await fetch(`${apiUrl}/sw/unregister`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({
|
||||||
|
i: $i.token,
|
||||||
endpoint: push.endpoint,
|
endpoint: push.endpoint,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +79,13 @@ export async function removeAccount(id: Account['id']) {
|
||||||
function fetchAccount(token: string): Promise<Account> {
|
function fetchAccount(token: string): Promise<Account> {
|
||||||
return new Promise((done, fail) => {
|
return new Promise((done, fail) => {
|
||||||
// Fetch user
|
// Fetch user
|
||||||
api('i', {}, token)
|
fetch(`${apiUrl}/i`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({
|
||||||
|
i: token,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') {
|
if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
:spellcheck="spellcheck"
|
:spellcheck="spellcheck"
|
||||||
:step="step"
|
:step="step"
|
||||||
:list="id"
|
:list="id"
|
||||||
:maxlength="max"
|
|
||||||
@focus="focused = true"
|
@focus="focused = true"
|
||||||
@blur="focused = false"
|
@blur="focused = false"
|
||||||
@keydown="onKeydown($event)"
|
@keydown="onKeydown($event)"
|
||||||
|
@ -59,7 +58,6 @@ const props = defineProps<{
|
||||||
manualSave?: boolean;
|
manualSave?: boolean;
|
||||||
small?: boolean;
|
small?: boolean;
|
||||||
large?: boolean;
|
large?: boolean;
|
||||||
max?: number;
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
:pattern="pattern"
|
:pattern="pattern"
|
||||||
:autocomplete="autocomplete ? 'on' : 'off'"
|
:autocomplete="autocomplete ? 'on' : 'off'"
|
||||||
:spellcheck="spellcheck"
|
:spellcheck="spellcheck"
|
||||||
:maxlength="max"
|
|
||||||
@focus="focused = true"
|
@focus="focused = true"
|
||||||
@blur="focused = false"
|
@blur="focused = false"
|
||||||
@keydown="onKeydown($event)"
|
@keydown="onKeydown($event)"
|
||||||
|
@ -55,7 +54,6 @@ const props = withDefaults(defineProps<{
|
||||||
pre?: boolean;
|
pre?: boolean;
|
||||||
debounce?: boolean;
|
debounce?: boolean;
|
||||||
manualSave?: boolean;
|
manualSave?: boolean;
|
||||||
max?: number;
|
|
||||||
}>(), {
|
}>(), {
|
||||||
pattern: undefined,
|
pattern: undefined,
|
||||||
placeholder: '',
|
placeholder: '',
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<div v-if="!totpLogin" class="normal-signin">
|
<div v-if="!totpLogin" class="normal-signin">
|
||||||
<MkInput v-model="username" class="_formBlock" :placeholder="i18n.ts.username" type="text" pattern="^[a-zA-Z0-9_]+$" :spellcheck="false" autofocus required data-cy-signin-username @update:modelValue="onUsernameChange">
|
<MkInput v-model="username" class="_formBlock" :placeholder="i18n.ts.username" type="text" pattern="^[a-zA-Z0-9_]+$" :spellcheck="false" autofocus required data-cy-signin-username @update:modelValue="onUsernameChange">
|
||||||
<template #prefix>@</template>
|
<template #prefix>@</template>
|
||||||
|
<template #suffix>@{{ host }}</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
<MkInput v-if="!user || user && !user.usePasswordLessLogin" v-model="password" class="_formBlock" :placeholder="i18n.ts.password" type="password" :with-password-toggle="true" required data-cy-signin-password>
|
<MkInput v-if="!user || user && !user.usePasswordLessLogin" v-model="password" class="_formBlock" :placeholder="i18n.ts.password" type="password" :with-password-toggle="true" required data-cy-signin-password>
|
||||||
<template #prefix><i class="fas fa-lock"></i></template>
|
<template #prefix><i class="fas fa-lock"></i></template>
|
||||||
|
@ -54,7 +55,7 @@ import { showSuspendedDialog } from '@/scripts/show-suspended-dialog';
|
||||||
import MkButton from '@/components/ui/button.vue';
|
import MkButton from '@/components/ui/button.vue';
|
||||||
import MkInput from '@/components/form/input.vue';
|
import MkInput from '@/components/form/input.vue';
|
||||||
import MkInfo from '@/components/ui/info.vue';
|
import MkInfo from '@/components/ui/info.vue';
|
||||||
import { apiUrl } from '@/config';
|
import { apiUrl, host as configHost } from '@/config';
|
||||||
import { byteify, hexify } from '@/scripts/2fa';
|
import { byteify, hexify } from '@/scripts/2fa';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { login } from '@/account';
|
import { login } from '@/account';
|
||||||
|
@ -67,6 +68,7 @@ let user = $ref(null);
|
||||||
let username = $ref('');
|
let username = $ref('');
|
||||||
let password = $ref('');
|
let password = $ref('');
|
||||||
let token = $ref('');
|
let token = $ref('');
|
||||||
|
let host = $ref(toUnicode(configHost));
|
||||||
let totpLogin = $ref(false);
|
let totpLogin = $ref(false);
|
||||||
let challengeData = $ref(null);
|
let challengeData = $ref(null);
|
||||||
let queryingKey = $ref(false);
|
let queryingKey = $ref(false);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<MkInput v-model="username" class="_formBlock" type="text" pattern="^[a-zA-Z0-9_]{1,20}$" :spellcheck="false" required data-cy-signup-username @update:modelValue="onChangeUsername">
|
<MkInput v-model="username" class="_formBlock" type="text" pattern="^[a-zA-Z0-9_]{1,20}$" :spellcheck="false" required data-cy-signup-username @update:modelValue="onChangeUsername">
|
||||||
<template #label>{{ i18n.ts.username }} <div v-tooltip:dialog="i18n.ts.usernameInfo" class="_button _help"><i class="far fa-question-circle"></i></div></template>
|
<template #label>{{ i18n.ts.username }} <div v-tooltip:dialog="i18n.ts.usernameInfo" class="_button _help"><i class="far fa-question-circle"></i></div></template>
|
||||||
<template #prefix>@</template>
|
<template #prefix>@</template>
|
||||||
|
<template #suffix>@{{ host }}</template>
|
||||||
<template #caption>
|
<template #caption>
|
||||||
<span v-if="usernameState === 'wait'" style="color:#999"><i class="fas fa-spinner fa-pulse fa-fw"></i> {{ i18n.ts.checking }}</span>
|
<span v-if="usernameState === 'wait'" style="color:#999"><i class="fas fa-spinner fa-pulse fa-fw"></i> {{ i18n.ts.checking }}</span>
|
||||||
<span v-else-if="usernameState === 'ok'" style="color: var(--success)"><i class="fas fa-check fa-fw"></i> {{ i18n.ts.available }}</span>
|
<span v-else-if="usernameState === 'ok'" style="color: var(--success)"><i class="fas fa-check fa-fw"></i> {{ i18n.ts.available }}</span>
|
||||||
|
@ -69,6 +70,7 @@ import MkButton from './ui/button.vue';
|
||||||
import MkCaptcha from './captcha.vue';
|
import MkCaptcha from './captcha.vue';
|
||||||
import MkInput from './form/input.vue';
|
import MkInput from './form/input.vue';
|
||||||
import MkSwitch from './form/switch.vue';
|
import MkSwitch from './form/switch.vue';
|
||||||
|
import * as config from '@/config';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { login } from '@/account';
|
import { login } from '@/account';
|
||||||
import { instance } from '@/instance';
|
import { instance } from '@/instance';
|
||||||
|
@ -85,6 +87,8 @@ const emit = defineEmits<{
|
||||||
(ev: 'signupEmailPending'): void;
|
(ev: 'signupEmailPending'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const host = toUnicode(config.host);
|
||||||
|
|
||||||
let hcaptcha = $ref();
|
let hcaptcha = $ref();
|
||||||
let recaptcha = $ref();
|
let recaptcha = $ref();
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,7 @@ export const api = ((endpoint: string, data: Record<string, any> = {}, token?: s
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
credentials: 'omit',
|
credentials: 'omit',
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: {
|
headers: authorization ? { authorization } : {},
|
||||||
'content-type': 'application/json',
|
|
||||||
...(authorization ? { authorization } : {}),
|
|
||||||
},
|
|
||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
const body = res.status === 204 ? null : await res.json();
|
const body = res.status === 204 ? null : await res.json();
|
||||||
|
|
||||||
|
@ -72,10 +69,7 @@ export const apiGet = ((endpoint: string, data: Record<string, any> = {}, token?
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
credentials: 'omit',
|
credentials: 'omit',
|
||||||
cache: 'default',
|
cache: 'default',
|
||||||
headers: {
|
headers: authorization ? { authorization } : {},
|
||||||
'content-type': 'application/json',
|
|
||||||
...(authorization ? { authorization } : {}),
|
|
||||||
},
|
|
||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
const body = res.status === 204 ? null : await res.json();
|
const body = res.status === 204 ? null : await res.json();
|
||||||
|
|
||||||
|
@ -103,7 +97,7 @@ export const apiWithDialog = ((
|
||||||
promiseDialog(promise, null, (err) => {
|
promiseDialog(promise, null, (err) => {
|
||||||
alert({
|
alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
text: (err.message + '\n' + (err?.endpoint ?? '') + (err?.code ?? '')).trim(),
|
text: err.message + '\n' + (err as any).id,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -141,7 +135,7 @@ export function promiseDialog<T extends Promise<any>>(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// NOTE: dynamic import results in strange behaviour (showing is not reactive)
|
// NOTE: dynamic importすると挙動がおかしくなる(showingの変更が伝播しない)
|
||||||
popup(MkWaitingDialog, {
|
popup(MkWaitingDialog, {
|
||||||
success,
|
success,
|
||||||
showing,
|
showing,
|
||||||
|
|
|
@ -130,15 +130,32 @@
|
||||||
</FormSection>
|
</FormSection>
|
||||||
|
|
||||||
<FormSection>
|
<FormSection>
|
||||||
<template #label>DeepL Translation</template>
|
<template #label>{{ i18n.ts.translationSettings }}</template>
|
||||||
|
<FormSelect v-model="translationService" class="_formBlock">
|
||||||
|
<template #label>{{ i18n.ts.translationService }}</template>
|
||||||
|
<option value="none">{{ i18n.ts.none }}</option>
|
||||||
|
<option value="deepl">DeepL</option>
|
||||||
|
<option value="libretranslate">LibreTranslate</option>
|
||||||
|
</FormSelect>
|
||||||
|
|
||||||
|
<template v-if="translationService === 'deepl'">
|
||||||
|
<FormSwitch v-model="deeplIsPro" class="_formBlock">
|
||||||
|
<template #label>{{ i18n.ts._translationService._deepl.pro }}</template>
|
||||||
|
</FormSwitch>
|
||||||
<FormInput v-model="deeplAuthKey" class="_formBlock">
|
<FormInput v-model="deeplAuthKey" class="_formBlock">
|
||||||
<template #prefix><i class="fas fa-key"></i></template>
|
<template #prefix><i class="fas fa-key"></i></template>
|
||||||
<template #label>DeepL Auth Key</template>
|
<template #label>{{ i18n.ts._translationService._deepl.authKey }}</template>
|
||||||
</FormInput>
|
</FormInput>
|
||||||
<FormSwitch v-model="deeplIsPro" class="_formBlock">
|
</template>
|
||||||
<template #label>Pro account</template>
|
<template v-else-if="translationService === 'libretranslate'">
|
||||||
</FormSwitch>
|
<FormInput v-model="libreTranslateEndpoint" class="_formBlock">
|
||||||
|
<template #label>{{ i18n.ts._translationService._libreTranslate.endpoint }}</template>
|
||||||
|
</FormInput>
|
||||||
|
<FormInput v-model="libreTranslateAuthKey" class="_formBlock">
|
||||||
|
<template #prefix><i class="fas fa-key"></i></template>
|
||||||
|
<template #label>{{ i18n.ts._translationService._libreTranslate.authKey }}</template>
|
||||||
|
</FormInput>
|
||||||
|
</template>
|
||||||
</FormSection>
|
</FormSection>
|
||||||
</div>
|
</div>
|
||||||
</FormSuspense>
|
</FormSuspense>
|
||||||
|
@ -153,6 +170,7 @@ import FormInput from '@/components/form/input.vue';
|
||||||
import FormTextarea from '@/components/form/textarea.vue';
|
import FormTextarea from '@/components/form/textarea.vue';
|
||||||
import FormInfo from '@/components/ui/info.vue';
|
import FormInfo from '@/components/ui/info.vue';
|
||||||
import FormSection from '@/components/form/section.vue';
|
import FormSection from '@/components/form/section.vue';
|
||||||
|
import FormSelect from '@/components/form/select.vue';
|
||||||
import FormSplit from '@/components/form/split.vue';
|
import FormSplit from '@/components/form/split.vue';
|
||||||
import FormSuspense from '@/components/form/suspense.vue';
|
import FormSuspense from '@/components/form/suspense.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
@ -182,8 +200,11 @@ let emailRequiredForSignup: boolean = $ref(false);
|
||||||
let enableServiceWorker: boolean = $ref(false);
|
let enableServiceWorker: boolean = $ref(false);
|
||||||
let swPublicKey: any = $ref(null);
|
let swPublicKey: any = $ref(null);
|
||||||
let swPrivateKey: any = $ref(null);
|
let swPrivateKey: any = $ref(null);
|
||||||
let deeplAuthKey: string = $ref('');
|
let translationService: string = $ref('none');
|
||||||
let deeplIsPro: boolean = $ref(false);
|
let deeplIsPro: boolean = $ref(false);
|
||||||
|
let deeplAuthKey: string = $ref('');
|
||||||
|
let libreTranslateEndpoint: string = $ref('');
|
||||||
|
let libreTranslateAuthKey: string = $ref('');
|
||||||
|
|
||||||
async function init(): Promise<void> {
|
async function init(): Promise<void> {
|
||||||
const meta = await os.api('admin/meta');
|
const meta = await os.api('admin/meta');
|
||||||
|
@ -209,8 +230,11 @@ async function init(): Promise<void> {
|
||||||
enableServiceWorker = meta.enableServiceWorker;
|
enableServiceWorker = meta.enableServiceWorker;
|
||||||
swPublicKey = meta.swPublickey;
|
swPublicKey = meta.swPublickey;
|
||||||
swPrivateKey = meta.swPrivateKey;
|
swPrivateKey = meta.swPrivateKey;
|
||||||
deeplAuthKey = meta.deeplAuthKey;
|
translationService = meta.translationService;
|
||||||
deeplIsPro = meta.deeplIsPro;
|
deeplIsPro = meta.deeplIsPro;
|
||||||
|
deeplAuthKey = meta.deeplAuthKey;
|
||||||
|
libreTranslateEndpoint = meta.libreTranslateEndpoint;
|
||||||
|
libreTranslateAuthKey = meta.libreTranslateAuthKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
|
|
@ -26,27 +26,8 @@
|
||||||
|
|
||||||
<FormSection v-if="iAmModerator">
|
<FormSection v-if="iAmModerator">
|
||||||
<template #label>Moderation</template>
|
<template #label>Moderation</template>
|
||||||
<FormSwitch
|
<FormSwitch v-model="suspended" class="_formBlock" @update:modelValue="toggleSuspend">{{ i18n.ts.stopActivityDelivery }}</FormSwitch>
|
||||||
:model-value="suspended || isBlocked"
|
<FormSwitch v-model="isBlocked" class="_formBlock" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</FormSwitch>
|
||||||
@update:model-value="newValue => {suspended = newValue; toggleSuspend() }"
|
|
||||||
:disabled="isBlocked"
|
|
||||||
class="_formBlock"
|
|
||||||
>
|
|
||||||
{{ i18n.ts.stopActivityDelivery }}
|
|
||||||
<template #caption>
|
|
||||||
{{ i18n.ts.stopActivityDeliveryDescription }}
|
|
||||||
</template>
|
|
||||||
</FormSwitch>
|
|
||||||
<FormSwitch
|
|
||||||
v-model="isBlocked"
|
|
||||||
@update:modelValue="toggleBlock"
|
|
||||||
class="_formBlock"
|
|
||||||
>
|
|
||||||
{{ i18n.ts.blockThisInstance }}
|
|
||||||
<template #caption>
|
|
||||||
{{ i18n.ts.blockThisInstanceDescription }}
|
|
||||||
</template>
|
|
||||||
</FormSwitch>
|
|
||||||
<MkButton @click="refreshMetadata"><i class="fas fa-refresh"></i> Refresh metadata</MkButton>
|
<MkButton @click="refreshMetadata"><i class="fas fa-refresh"></i> Refresh metadata</MkButton>
|
||||||
</FormSection>
|
</FormSection>
|
||||||
|
|
||||||
|
@ -171,7 +152,7 @@ const usersPagination = {
|
||||||
offsetMode: true,
|
offsetMode: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
async function fetch(): Promise<void> {
|
async function fetch() {
|
||||||
instance = await os.api('federation/show-instance', {
|
instance = await os.api('federation/show-instance', {
|
||||||
host: props.host,
|
host: props.host,
|
||||||
});
|
});
|
||||||
|
@ -179,21 +160,21 @@ async function fetch(): Promise<void> {
|
||||||
isBlocked = instance.isBlocked;
|
isBlocked = instance.isBlocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleBlock(): Promise<void> {
|
async function toggleBlock(ev) {
|
||||||
if (meta == null) return;
|
if (meta == null) return;
|
||||||
await os.api('admin/update-meta', {
|
await os.api('admin/update-meta', {
|
||||||
blockedHosts: isBlocked ? meta.blockedHosts.concat([instance.host]) : meta.blockedHosts.filter(x => x !== instance.host),
|
blockedHosts: isBlocked ? meta.blockedHosts.concat([instance.host]) : meta.blockedHosts.filter(x => x !== instance.host),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleSuspend(): Promise<void> {
|
async function toggleSuspend(v) {
|
||||||
await os.api('admin/federation/update-instance', {
|
await os.api('admin/federation/update-instance', {
|
||||||
host: instance.host,
|
host: instance.host,
|
||||||
isSuspended: suspended,
|
isSuspended: suspended,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshMetadata(): void {
|
function refreshMetadata() {
|
||||||
os.api('admin/federation/refresh-remote-instance-metadata', {
|
os.api('admin/federation/refresh-remote-instance-metadata', {
|
||||||
host: instance.host,
|
host: instance.host,
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent } from 'vue';
|
import { defineAsyncComponent, ref } from 'vue';
|
||||||
import FormLink from '@/components/form/link.vue';
|
import FormLink from '@/components/form/link.vue';
|
||||||
import FormButton from '@/components/ui/button.vue';
|
import FormButton from '@/components/ui/button.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
|
||||||
const isDesktop = window.innerWidth >= 1100;
|
const isDesktop = ref(window.innerWidth >= 1100);
|
||||||
|
|
||||||
function generateToken() {
|
function generateToken() {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/token-generate-window.vue')), {}, {
|
os.popup(defineAsyncComponent(() => import('@/components/token-generate-window.vue')), {}, {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<template #label>{{ i18n.ts._profile.name }}</template>
|
<template #label>{{ i18n.ts._profile.name }}</template>
|
||||||
</FormInput>
|
</FormInput>
|
||||||
|
|
||||||
<FormTextarea v-model="profile.description" :max="2048" tall manual-save class="_formBlock">
|
<FormTextarea v-model="profile.description" :max="500" tall manual-save class="_formBlock">
|
||||||
<template #label>{{ i18n.ts._profile.description }}</template>
|
<template #label>{{ i18n.ts._profile.description }}</template>
|
||||||
<template #caption>{{ i18n.ts._profile.youCanIncludeHashtags }}</template>
|
<template #caption>{{ i18n.ts._profile.youCanIncludeHashtags }}</template>
|
||||||
</FormTextarea>
|
</FormTextarea>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<MkInput v-model="username" pattern="^[a-zA-Z0-9_]{1,20}$" :spellcheck="false" required data-cy-admin-username class="_formBlock">
|
<MkInput v-model="username" pattern="^[a-zA-Z0-9_]{1,20}$" :spellcheck="false" required data-cy-admin-username class="_formBlock">
|
||||||
<template #label>{{ i18n.ts.username }}</template>
|
<template #label>{{ i18n.ts.username }}</template>
|
||||||
<template #prefix>@</template>
|
<template #prefix>@</template>
|
||||||
|
<template #suffix>@{{ host }}</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
<MkInput v-model="password" type="password" data-cy-admin-password class="_formBlock">
|
<MkInput v-model="password" type="password" data-cy-admin-password class="_formBlock">
|
||||||
<template #label>{{ i18n.ts.password }}</template>
|
<template #label>{{ i18n.ts.password }}</template>
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import MkButton from '@/components/ui/button.vue';
|
import MkButton from '@/components/ui/button.vue';
|
||||||
import MkInput from '@/components/form/input.vue';
|
import MkInput from '@/components/form/input.vue';
|
||||||
|
import { host } from '@/config';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { login } from '@/account';
|
import { login } from '@/account';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
|
|
@ -30,6 +30,14 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
|
||||||
const i18n = await swLang.i18n as I18n<any>;
|
const i18n = await swLang.i18n as I18n<any>;
|
||||||
const { t } = i18n;
|
const { t } = i18n;
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
|
/*
|
||||||
|
case 'driveFileCreated': // TODO (Server Side)
|
||||||
|
return [t('_notification.fileUploaded'), {
|
||||||
|
body: body.name,
|
||||||
|
icon: body.url,
|
||||||
|
data
|
||||||
|
}];
|
||||||
|
*/
|
||||||
case 'notification':
|
case 'notification':
|
||||||
switch (data.body.type) {
|
switch (data.body.type) {
|
||||||
case 'follow':
|
case 'follow':
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
declare var self: ServiceWorkerGlobalScope;
|
declare var self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
import { createNotification } from '@/scripts/create-notification';
|
import { createEmptyNotification, createNotification } from '@/scripts/create-notification';
|
||||||
import { swLang } from '@/scripts/lang';
|
import { swLang } from '@/scripts/lang';
|
||||||
import { swNotificationRead } from '@/scripts/notification-read';
|
import { swNotificationRead } from '@/scripts/notification-read';
|
||||||
import { pushNotificationDataMap } from '@/types';
|
import { pushNotificationDataMap } from '@/types';
|
||||||
|
@ -67,6 +67,8 @@ self.addEventListener('push', ev => {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return createEmptyNotification();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
23
yarn.lock
23
yarn.lock
|
@ -3743,7 +3743,7 @@ __metadata:
|
||||||
rss-parser: 3.12.0
|
rss-parser: 3.12.0
|
||||||
sanitize-html: 2.7.0
|
sanitize-html: 2.7.0
|
||||||
semver: 7.3.7
|
semver: 7.3.7
|
||||||
sharp: 0.31.2
|
sharp: 0.30.7
|
||||||
speakeasy: 2.0.0
|
speakeasy: 2.0.0
|
||||||
strict-event-emitter-types: 2.0.0
|
strict-event-emitter-types: 2.0.0
|
||||||
stringz: 2.1.0
|
stringz: 2.1.0
|
||||||
|
@ -15189,17 +15189,6 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"semver@npm:^7.3.8":
|
|
||||||
version: 7.3.8
|
|
||||||
resolution: "semver@npm:7.3.8"
|
|
||||||
dependencies:
|
|
||||||
lru-cache: ^6.0.0
|
|
||||||
bin:
|
|
||||||
semver: bin/semver.js
|
|
||||||
checksum: ba9c7cbbf2b7884696523450a61fee1a09930d888b7a8d7579025ad93d459b2d1949ee5bbfeb188b2be5f4ac163544c5e98491ad6152df34154feebc2cc337c1
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"serialize-javascript@npm:6.0.0":
|
"serialize-javascript@npm:6.0.0":
|
||||||
version: 6.0.0
|
version: 6.0.0
|
||||||
resolution: "serialize-javascript@npm:6.0.0"
|
resolution: "serialize-javascript@npm:6.0.0"
|
||||||
|
@ -15261,20 +15250,20 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"sharp@npm:0.31.2":
|
"sharp@npm:0.30.7":
|
||||||
version: 0.31.2
|
version: 0.30.7
|
||||||
resolution: "sharp@npm:0.31.2"
|
resolution: "sharp@npm:0.30.7"
|
||||||
dependencies:
|
dependencies:
|
||||||
color: ^4.2.3
|
color: ^4.2.3
|
||||||
detect-libc: ^2.0.1
|
detect-libc: ^2.0.1
|
||||||
node-addon-api: ^5.0.0
|
node-addon-api: ^5.0.0
|
||||||
node-gyp: latest
|
node-gyp: latest
|
||||||
prebuild-install: ^7.1.1
|
prebuild-install: ^7.1.1
|
||||||
semver: ^7.3.8
|
semver: ^7.3.7
|
||||||
simple-get: ^4.0.1
|
simple-get: ^4.0.1
|
||||||
tar-fs: ^2.1.1
|
tar-fs: ^2.1.1
|
||||||
tunnel-agent: ^0.6.0
|
tunnel-agent: ^0.6.0
|
||||||
checksum: 076717b7a073ea47bb522ff2931b74b6608daeb6f7ae334e4848d47fdf4d23bcb18cd49044fd5fb27ef27a1a4aa87d141894d67d1c4bb15a6e2e63cf4dbe329e
|
checksum: bbc63ca3c7ea8a5bff32cd77022cfea30e25a03f5bd031e935924bf6cf0e11e3388e8b0e22b3137bf8816aa73407f1e4fbeb190f3a35605c27ffca9f32b91601
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue