Merge remote-tracking branch 'misskey/release/2024.5.0' into future-2024-04-25-post

This commit is contained in:
dakkar 2024-05-11 14:13:07 +01:00
commit 451b0ecc9b
81 changed files with 16594 additions and 13171 deletions

View file

@ -8,7 +8,7 @@
"version": "8.9.2" "version": "8.9.2"
}, },
"ghcr.io/devcontainers/features/node:1": { "ghcr.io/devcontainers/features/node:1": {
"version": "20.10.0" "version": "20.12.2"
} }
}, },
"forwardPorts": [3000], "forwardPorts": [3000],

View file

@ -1 +1 @@
20.10.0 20.12.2

View file

@ -1,7 +1,8 @@
## Unreleased ## 2024.5.0
### Note ### Note
- コントロールパネル内にあるサマリープロキシの設定個所がセキュリティから全般へ変更となります。 - コントロールパネル内にあるサマリープロキシの設定個所がセキュリティから全般へ変更となります。
- 悪意のある第三者がリモートユーザーになりすましたアクティビティを受け取れてしまう問題を修正しました。詳しくは[GitHub security advisory](https://github.com/misskey-dev/misskey/security/advisories/GHSA-2vxv-pv3m-3wvj)をご覧ください。
### General ### General
- Enhance: URLプレビューの有効化・無効化を設定できるように #13569 - Enhance: URLプレビューの有効化・無効化を設定できるように #13569
@ -35,7 +36,10 @@
- Enhance: リプライにて引用がある場合テキストが空でもノートできるように - Enhance: リプライにて引用がある場合テキストが空でもノートできるように
- 引用したいートのURLをコピーしリプライ投稿画面にペーストして添付することで達成できます - 引用したいートのURLをコピーしリプライ投稿画面にペーストして添付することで達成できます
- Enhance: フォローするかどうかの確認ダイアログを出せるように - Enhance: フォローするかどうかの確認ダイアログを出せるように
- Chore: AiScriptを0.18.0にバージョンアップ - Enhance: Playを手動でリロードできるように
- Enhance: 通報のコメント内のリンクをクリックした際、ウィンドウで開くように
- Enhance: `Ui:C:postForm` および `Ui:C:postFormButton``localOnly``visibility` を設定できるように
- Enhance: AiScriptを0.18.0にバージョンアップ
- Fix: 一部のページ内リンクが正しく動作しない問題を修正 - Fix: 一部のページ内リンクが正しく動作しない問題を修正
- Fix: 周年の実績が閏年を考慮しない問題を修正 - Fix: 周年の実績が閏年を考慮しない問題を修正
- Fix: ローカルURLのプレビューポップアップが左上に表示される - Fix: ローカルURLのプレビューポップアップが左上に表示される
@ -50,10 +54,18 @@
- Fix: ート詳細ページにおいてCW付き引用リートのCWボタンのラベルに「引用」が含まれていない問題を修正 - Fix: ート詳細ページにおいてCW付き引用リートのCWボタンのラベルに「引用」が含まれていない問題を修正
- Fix: ダイアログの入力で字数制限に違反していてもEnterキーが押せてしまう問題を修正 - Fix: ダイアログの入力で字数制限に違反していてもEnterキーが押せてしまう問題を修正
- Fix: ダイレクト投稿の宛先が保存されない問題を修正 - Fix: ダイレクト投稿の宛先が保存されない問題を修正
- Fix: Playのページを離れたときに、Playが正常に初期化されない問題を修正
- Fix: ページのOGP URLが間違っているのを修正
- Fix: リバーシの対局を正しく共有できないことがある問題を修正
- Fix: 通知をグループ化している際に、人数が正常に表示されないことがある問題を修正
- Fix: 連合なしの状態の読み書きができない問題を修正
### Server ### Server
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
- Enhance: misskey-dev/summaly@5.1.0の取り込み(プレビュー生成処理の効率化) - Enhance: misskey-dev/summaly@5.1.0の取り込み(プレビュー生成処理の効率化)
- Enhance: ドライブのファイルがNSFWかどうか個別に連合されるように (#13756)
- 可能な場合、ノートの添付ファイルのセンシティブ判定がファイル単位になります
- Fix: リモートから配送されたアクティビティにJSON-LD compactionをかける
- Fix: フォローリクエストを作成する際に既存のものは削除するように - Fix: フォローリクエストを作成する際に既存のものは削除するように
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440) (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440)
- Fix: エンドポイント`notes/translate`のエラーを改善 - Fix: エンドポイント`notes/translate`のエラーを改善
@ -62,10 +74,12 @@
- Fix: リプライのみの引用リートと、CWのみの引用リートが純粋なリートとして誤って扱われてしまう問題を修正 - Fix: リプライのみの引用リートと、CWのみの引用リートが純粋なリートとして誤って扱われてしまう問題を修正
- Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように - Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606) (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606)
- Fix: Add Cache-Control to Bull Board
- Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正 - Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正
- Fix: 一部のタイムラインのストリーミングでインスタンスミュートが効かない問題を修正 - Fix: 一部のタイムラインのストリーミングでインスタンスミュートが効かない問題を修正
- Fix: グローバルタイムラインで返信が表示されないことがある問題を修正 - Fix: グローバルタイムラインで返信が表示されないことがある問題を修正
- Fix: リノートをミュートしたユーザの投稿のリノートがミュートされる問題を修正 - Fix: リノートをミュートしたユーザの投稿のリノートがミュートされる問題を修正
- Fix: AP Link等は添付ファイル扱いしないようになど (#13754)
## 2024.3.1 ## 2024.3.1

View file

@ -1,6 +1,6 @@
# syntax = docker/dockerfile:1.4 # syntax = docker/dockerfile:1.4
ARG NODE_VERSION=20.10.0-alpine3.18 ARG NODE_VERSION=20.12.2-alpine3.19
FROM node:${NODE_VERSION} as build FROM node:${NODE_VERSION} as build

4
locales/index.d.ts vendored
View file

@ -5149,6 +5149,10 @@ export interface Locale extends ILocale {
* *
*/ */
"alwaysConfirmFollow": string; "alwaysConfirmFollow": string;
/**
*
*/
"inquiry": string;
"_bubbleGame": { "_bubbleGame": {
/** /**
* *

View file

@ -1283,6 +1283,7 @@ keepOriginalFilename: "オリジナルのファイル名を保持"
keepOriginalFilenameDescription: "この設定をオフにすると、アップロード時にファイル名が自動でランダム文字列に置き換えられます。" keepOriginalFilenameDescription: "この設定をオフにすると、アップロード時にファイル名が自動でランダム文字列に置き換えられます。"
noDescription: "説明文はありません" noDescription: "説明文はありません"
alwaysConfirmFollow: "フォローの際常に確認する" alwaysConfirmFollow: "フォローの際常に確認する"
inquiry: "お問い合わせ"
_bubbleGame: _bubbleGame:
howToPlay: "遊び方" howToPlay: "遊び方"

View file

@ -1,12 +1,12 @@
{ {
"name": "sharkey", "name": "sharkey",
"version": "2024.3.3-devel", "version": "2024.5.0-beta.1",
"codename": "shonk", "codename": "shonk",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://activitypub.software/TransFem-org/Sharkey.git" "url": "https://activitypub.software/TransFem-org/Sharkey.git"
}, },
"packageManager": "pnpm@8.15.4", "packageManager": "pnpm@9.0.6",
"workspaces": [ "workspaces": [
"packages/frontend", "packages/frontend",
"packages/backend", "packages/backend",
@ -48,24 +48,24 @@
"lodash": "4.17.21" "lodash": "4.17.21"
}, },
"dependencies": { "dependencies": {
"cssnano": "6.0.5", "cssnano": "6.1.2",
"execa": "8.0.1", "execa": "8.0.1",
"fast-glob": "3.3.2", "fast-glob": "3.3.2",
"ignore-walk": "6.0.4", "ignore-walk": "6.0.4",
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
"postcss": "8.4.35", "postcss": "8.4.38",
"tar": "6.2.0", "tar": "6.2.1",
"terser": "5.28.1", "terser": "5.30.3",
"typescript": "5.3.3", "typescript": "5.4.5",
"esbuild": "0.19.11", "esbuild": "0.20.2",
"glob": "10.3.10" "glob": "10.3.12"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.11.28", "@types/node": "20.12.7",
"@typescript-eslint/eslint-plugin": "7.1.0", "@typescript-eslint/eslint-plugin": "7.7.1",
"@typescript-eslint/parser": "7.1.0", "@typescript-eslint/parser": "7.7.1",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "13.6.6", "cypress": "13.7.3",
"eslint": "8.57.0", "eslint": "8.57.0",
"ncp": "2.0.0", "ncp": "2.0.0",
"start-server-and-test": "2.0.3" "start-server-and-test": "2.0.3"

View file

@ -12,9 +12,9 @@
"migrate": "pnpm typeorm migration:run -d ormconfig.js", "migrate": "pnpm typeorm migration:run -d ormconfig.js",
"revert": "pnpm typeorm migration:revert -d ormconfig.js", "revert": "pnpm typeorm migration:revert -d ormconfig.js",
"check:connect": "node ./scripts/check_connect.js", "check:connect": "node ./scripts/check_connect.js",
"build": "swc src -d built -D", "build": "swc src -d built -D --strip-leading-paths",
"build:test": "swc test-server -d built-test -D --config-file test-server/.swcrc", "build:test": "swc test-server -d built-test -D --config-file test-server/.swcrc --strip-leading-paths",
"watch:swc": "swc src -d built -D -w", "watch:swc": "swc src -d built -D -w --strip-leading-paths",
"build:tsc": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json", "build:tsc": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
"watch": "node ./scripts/watch.mjs", "watch": "node ./scripts/watch.mjs",
"restart": "pnpm build && pnpm start", "restart": "pnpm build && pnpm start",
@ -65,40 +65,41 @@
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "3.412.0", "@aws-sdk/client-s3": "3.412.0",
"@aws-sdk/lib-storage": "3.412.0", "@aws-sdk/lib-storage": "3.412.0",
"@bull-board/api": "5.14.2", "@bull-board/api": "5.17.0",
"@bull-board/fastify": "5.14.2", "@bull-board/fastify": "5.17.0",
"@bull-board/ui": "5.14.2", "@bull-board/ui": "5.17.0",
"@discordapp/twemoji": "15.0.2", "@discordapp/twemoji": "15.0.3",
"@fastify/accepts": "4.3.0", "@fastify/accepts": "4.3.0",
"@fastify/cookie": "9.3.1", "@fastify/cookie": "9.3.1",
"@fastify/cors": "8.5.0", "@fastify/cors": "9.0.1",
"@fastify/express": "2.3.0", "@fastify/express": "3.0.0",
"@fastify/http-proxy": "9.3.0", "@fastify/http-proxy": "9.5.0",
"@fastify/multipart": "8.1.0", "@fastify/multipart": "8.2.0",
"@fastify/static": "6.12.0", "@fastify/static": "7.0.3",
"@fastify/view": "8.2.0", "@fastify/view": "9.1.0",
"@misskey-dev/sharp-read-bmp": "1.2.0", "@misskey-dev/sharp-read-bmp": "1.2.0",
"@misskey-dev/summaly": "5.1.0", "@misskey-dev/summaly": "5.1.0",
"@nestjs/common": "10.3.3", "@napi-rs/canvas": "^0.1.52",
"@nestjs/core": "10.3.3", "@nestjs/common": "10.3.8",
"@nestjs/testing": "10.3.3", "@nestjs/core": "10.3.8",
"@nestjs/testing": "10.3.8",
"@peertube/http-signature": "1.7.0", "@peertube/http-signature": "1.7.0",
"@simplewebauthn/server": "9.0.3", "@simplewebauthn/server": "10.0.0",
"@sinonjs/fake-timers": "11.2.2", "@sinonjs/fake-timers": "11.2.2",
"@smithy/node-http-handler": "2.1.10", "@smithy/node-http-handler": "2.5.0",
"@swc/cli": "0.1.63", "@swc/cli": "0.3.12",
"@swc/core": "1.3.107", "@swc/core": "1.4.17",
"@transfem-org/sfm-js": "0.24.5", "@transfem-org/sfm-js": "0.24.5",
"@twemoji/parser": "15.0.0", "@twemoji/parser": "15.1.1",
"accepts": "1.3.8", "accepts": "1.3.8",
"ajv": "8.12.0", "ajv": "8.13.0",
"archiver": "6.0.1", "archiver": "7.0.1",
"argon2": "^0.40.1", "argon2": "^0.40.1",
"async-mutex": "0.4.1", "async-mutex": "0.5.0",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
"blurhash": "2.0.5", "blurhash": "2.0.5",
"body-parser": "1.20.2", "body-parser": "1.20.2",
"bullmq": "5.4.0", "bullmq": "5.7.8",
"cacheable-lookup": "7.0.0", "cacheable-lookup": "7.0.0",
"cbor": "9.0.2", "cbor": "9.0.2",
"chalk": "5.3.0", "chalk": "5.3.0",
@ -109,7 +110,7 @@
"content-disposition": "0.5.4", "content-disposition": "0.5.4",
"date-fns": "2.30.0", "date-fns": "2.30.0",
"deep-email-validator": "0.1.21", "deep-email-validator": "0.1.21",
"fastify": "4.25.2", "fastify": "4.26.2",
"fastify-multer": "^2.0.3", "fastify-multer": "^2.0.3",
"fastify-raw-body": "4.3.0", "fastify-raw-body": "4.3.0",
"feed": "4.2.2", "feed": "4.2.2",
@ -117,79 +118,78 @@
"fluent-ffmpeg": "2.1.2", "fluent-ffmpeg": "2.1.2",
"form-data": "4.0.0", "form-data": "4.0.0",
"glob": "10.3.10", "glob": "10.3.10",
"got": "14.2.0", "got": "14.2.1",
"happy-dom": "10.0.3", "happy-dom": "14.7.1",
"hpagent": "1.2.0", "hpagent": "1.2.0",
"htmlescape": "1.1.1", "htmlescape": "1.1.1",
"http-link-header": "1.1.2", "http-link-header": "1.1.3",
"ioredis": "5.3.2", "ioredis": "5.4.1",
"ip-cidr": "3.1.0", "ip-cidr": "3.1.0",
"ipaddr.js": "2.1.0", "ipaddr.js": "2.2.0",
"is-svg": "5.0.0", "is-svg": "5.0.0",
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
"jsdom": "23.2.0", "jsdom": "24.0.0",
"json5": "2.2.3", "json5": "2.2.3",
"jsonld": "8.3.2", "jsonld": "8.3.2",
"jsrsasign": "11.1.0", "jsrsasign": "11.1.0",
"megalodon": "workspace:*", "megalodon": "workspace:*",
"meilisearch": "0.37.0", "meilisearch": "0.38.0",
"microformats-parser": "2.0.2", "microformats-parser": "2.0.2",
"mime-types": "2.1.35", "mime-types": "2.1.35",
"misskey-js": "workspace:*", "misskey-js": "workspace:*",
"misskey-reversi": "workspace:*", "misskey-reversi": "workspace:*",
"ms": "3.0.0-canary.1", "ms": "3.0.0-canary.1",
"nanoid": "5.0.6", "nanoid": "5.0.7",
"nested-property": "4.0.0", "nested-property": "4.0.0",
"node-fetch": "3.3.2", "node-fetch": "3.3.2",
"nodemailer": "6.9.10", "nodemailer": "6.9.13",
"oauth": "0.10.0", "oauth": "0.10.0",
"oauth2orize": "1.12.0", "oauth2orize": "1.12.0",
"oauth2orize-pkce": "0.1.2", "oauth2orize-pkce": "0.1.2",
"os-utils": "0.0.14", "os-utils": "0.0.14",
"otpauth": "9.2.2", "otpauth": "9.2.3",
"parse5": "7.1.2", "parse5": "7.1.2",
"pg": "8.11.3", "pg": "8.11.5",
"pkce-challenge": "4.1.0", "pkce-challenge": "4.1.0",
"probe-image-size": "7.2.3", "probe-image-size": "7.2.3",
"promise-limit": "2.7.0", "promise-limit": "2.7.0",
"pug": "3.0.2", "pug": "3.0.2",
"punycode": "2.3.1", "punycode": "2.3.1",
"pureimage": "0.3.17",
"qrcode": "1.5.3", "qrcode": "1.5.3",
"random-seed": "0.3.0", "random-seed": "0.3.0",
"ratelimiter": "3.4.1", "ratelimiter": "3.4.1",
"re2": "1.20.9", "re2": "1.20.10",
"redis-lock": "0.1.4", "redis-lock": "0.1.4",
"reflect-metadata": "0.2.1", "reflect-metadata": "0.2.2",
"rename": "1.0.4", "rename": "1.0.4",
"rss-parser": "3.13.0", "rss-parser": "3.13.0",
"rxjs": "7.8.1", "rxjs": "7.8.1",
"sanitize-html": "2.12.1", "sanitize-html": "2.13.0",
"secure-json-parse": "2.7.0", "secure-json-parse": "2.7.0",
"sharp": "0.33.2", "sharp": "0.33.3",
"slacc": "0.0.10", "slacc": "0.0.10",
"strict-event-emitter-types": "2.0.0", "strict-event-emitter-types": "2.0.0",
"stringz": "2.1.0", "stringz": "2.1.0",
"systeminformation": "5.22.0", "systeminformation": "5.22.7",
"tinycolor2": "1.6.0", "tinycolor2": "1.6.0",
"tmp": "0.2.3", "tmp": "0.2.3",
"tsc-alias": "1.8.8", "tsc-alias": "1.8.8",
"tsconfig-paths": "4.2.0", "tsconfig-paths": "4.2.0",
"typeorm": "0.3.20", "typeorm": "0.3.20",
"typescript": "5.3.3", "typescript": "5.4.5",
"ulid": "2.3.0", "ulid": "2.3.0",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"vary": "1.1.2", "vary": "1.1.2",
"web-push": "3.6.7", "web-push": "3.6.7",
"ws": "8.16.0", "ws": "8.17.0",
"xev": "3.0.2" "xev": "3.0.2"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "29.7.0", "@jest/globals": "29.7.0",
"@misskey-dev/eslint-plugin": "1.0.0", "@misskey-dev/eslint-plugin": "1.0.0",
"@nestjs/platform-express": "10.3.3", "@nestjs/platform-express": "10.3.8",
"@simplewebauthn/types": "9.0.1", "@simplewebauthn/types": "10.0.0",
"@swc/jest": "0.2.31", "@swc/jest": "0.2.36",
"@types/accepts": "1.3.7", "@types/accepts": "1.3.7",
"@types/archiver": "6.0.2", "@types/archiver": "6.0.2",
"@types/bcryptjs": "2.4.6", "@types/bcryptjs": "2.4.6",
@ -199,20 +199,20 @@
"@types/fluent-ffmpeg": "2.1.24", "@types/fluent-ffmpeg": "2.1.24",
"@types/htmlescape": "^1.1.3", "@types/htmlescape": "^1.1.3",
"@types/http-link-header": "1.0.5", "@types/http-link-header": "1.0.5",
"@types/jest": "29.5.11", "@types/jest": "29.5.12",
"@types/js-yaml": "4.0.9", "@types/js-yaml": "4.0.9",
"@types/jsdom": "21.1.6", "@types/jsdom": "21.1.6",
"@types/jsonld": "1.5.13", "@types/jsonld": "1.5.13",
"@types/jsrsasign": "10.5.12", "@types/jsrsasign": "10.5.14",
"@types/mime-types": "2.1.4", "@types/mime-types": "2.1.4",
"@types/ms": "0.7.34", "@types/ms": "0.7.34",
"@types/node": "20.11.22", "@types/node": "20.12.7",
"@types/node-fetch": "3.0.3", "@types/node-fetch": "3.0.3",
"@types/nodemailer": "6.4.14", "@types/nodemailer": "6.4.15",
"@types/oauth": "0.9.4", "@types/oauth": "0.9.4",
"@types/oauth2orize": "1.11.3", "@types/oauth2orize": "1.11.5",
"@types/oauth2orize-pkce": "0.1.2", "@types/oauth2orize-pkce": "0.1.2",
"@types/pg": "8.11.2", "@types/pg": "8.11.5",
"@types/pug": "2.0.10", "@types/pug": "2.0.10",
"@types/punycode": "2.1.4", "@types/punycode": "2.1.4",
"@types/qrcode": "1.5.5", "@types/qrcode": "1.5.5",
@ -229,8 +229,8 @@
"@types/vary": "1.1.3", "@types/vary": "1.1.3",
"@types/web-push": "3.6.3", "@types/web-push": "3.6.3",
"@types/ws": "8.5.10", "@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "7.1.0", "@typescript-eslint/eslint-plugin": "7.7.1",
"@typescript-eslint/parser": "7.1.0", "@typescript-eslint/parser": "7.7.1",
"aws-sdk-client-mock": "3.0.1", "aws-sdk-client-mock": "3.0.1",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"eslint": "8.57.0", "eslint": "8.57.0",

View file

@ -127,7 +127,7 @@ import { ApMfmService } from './activitypub/ApMfmService.js';
import { ApRendererService } from './activitypub/ApRendererService.js'; import { ApRendererService } from './activitypub/ApRendererService.js';
import { ApRequestService } from './activitypub/ApRequestService.js'; import { ApRequestService } from './activitypub/ApRequestService.js';
import { ApResolverService } from './activitypub/ApResolverService.js'; import { ApResolverService } from './activitypub/ApResolverService.js';
import { LdSignatureService } from './activitypub/LdSignatureService.js'; import { JsonLdService } from './activitypub/JsonLdService.js';
import { RemoteLoggerService } from './RemoteLoggerService.js'; import { RemoteLoggerService } from './RemoteLoggerService.js';
import { RemoteUserResolveService } from './RemoteUserResolveService.js'; import { RemoteUserResolveService } from './RemoteUserResolveService.js';
import { WebfingerService } from './WebfingerService.js'; import { WebfingerService } from './WebfingerService.js';
@ -266,7 +266,7 @@ const $ApMfmService: Provider = { provide: 'ApMfmService', useExisting: ApMfmSer
const $ApRendererService: Provider = { provide: 'ApRendererService', useExisting: ApRendererService }; const $ApRendererService: Provider = { provide: 'ApRendererService', useExisting: ApRendererService };
const $ApRequestService: Provider = { provide: 'ApRequestService', useExisting: ApRequestService }; const $ApRequestService: Provider = { provide: 'ApRequestService', useExisting: ApRequestService };
const $ApResolverService: Provider = { provide: 'ApResolverService', useExisting: ApResolverService }; const $ApResolverService: Provider = { provide: 'ApResolverService', useExisting: ApResolverService };
const $LdSignatureService: Provider = { provide: 'LdSignatureService', useExisting: LdSignatureService }; const $JsonLdService: Provider = { provide: 'JsonLdService', useExisting: JsonLdService };
const $RemoteLoggerService: Provider = { provide: 'RemoteLoggerService', useExisting: RemoteLoggerService }; const $RemoteLoggerService: Provider = { provide: 'RemoteLoggerService', useExisting: RemoteLoggerService };
const $RemoteUserResolveService: Provider = { provide: 'RemoteUserResolveService', useExisting: RemoteUserResolveService }; const $RemoteUserResolveService: Provider = { provide: 'RemoteUserResolveService', useExisting: RemoteUserResolveService };
const $WebfingerService: Provider = { provide: 'WebfingerService', useExisting: WebfingerService }; const $WebfingerService: Provider = { provide: 'WebfingerService', useExisting: WebfingerService };
@ -406,7 +406,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
ApRendererService, ApRendererService,
ApRequestService, ApRequestService,
ApResolverService, ApResolverService,
LdSignatureService, JsonLdService,
RemoteLoggerService, RemoteLoggerService,
RemoteUserResolveService, RemoteUserResolveService,
WebfingerService, WebfingerService,
@ -542,7 +542,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
$ApRendererService, $ApRendererService,
$ApRequestService, $ApRequestService,
$ApResolverService, $ApResolverService,
$LdSignatureService, $JsonLdService,
$RemoteLoggerService, $RemoteLoggerService,
$RemoteUserResolveService, $RemoteUserResolveService,
$WebfingerService, $WebfingerService,
@ -678,7 +678,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
ApRendererService, ApRendererService,
ApRequestService, ApRequestService,
ApResolverService, ApResolverService,
LdSignatureService, JsonLdService,
RemoteLoggerService, RemoteLoggerService,
RemoteUserResolveService, RemoteUserResolveService,
WebfingerService, WebfingerService,
@ -813,7 +813,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
$ApRendererService, $ApRendererService,
$ApRequestService, $ApRequestService,
$ApResolverService, $ApResolverService,
$LdSignatureService, $JsonLdService,
$RemoteLoggerService, $RemoteLoggerService,
$RemoteUserResolveService, $RemoteUserResolveService,
$WebfingerService, $WebfingerService,

View file

@ -22,7 +22,7 @@ import { ModerationLogService } from '@/core/ModerationLogService.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { DriveService } from './DriveService.js'; import { DriveService } from './DriveService.js';
const parseEmojiStrRegexp = /^(\w+)(?:@([\w.-]+))?$/; const parseEmojiStrRegexp = /^([-\w]+)(?:@([\w.-]+))?$/;
@Injectable() @Injectable()
export class CustomEmojiService implements OnApplicationShutdown { export class CustomEmojiService implements OnApplicationShutdown {

View file

@ -6,7 +6,7 @@
import { URL } from 'node:url'; import { URL } from 'node:url';
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import * as parse5 from 'parse5'; import * as parse5 from 'parse5';
import { Window } from 'happy-dom'; import { Window, XMLSerializer } from 'happy-dom';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { intersperse } from '@/misc/prelude/array.js'; import { intersperse } from '@/misc/prelude/array.js';
@ -247,6 +247,8 @@ export class MfmService {
const doc = window.document; const doc = window.document;
const body = doc.createElement('p');
function appendChildren(children: mfm.MfmNode[], targetElement: any): void { function appendChildren(children: mfm.MfmNode[], targetElement: any): void {
if (children) { if (children) {
for (const child of children.map(x => (handlers as any)[x.type](x))) targetElement.appendChild(child); for (const child of children.map(x => (handlers as any)[x.type](x))) targetElement.appendChild(child);
@ -457,9 +459,9 @@ export class MfmService {
}, },
}; };
appendChildren(nodes, doc.body); appendChildren(nodes, body);
return `<p>${doc.body.innerHTML}</p>`; return new XMLSerializer().serializeToString(body);
} }
// the toMastoHtml function was taken from Iceshrimp and written by zotan and modified by marie to work with the current MK version // the toMastoHtml function was taken from Iceshrimp and written by zotan and modified by marie to work with the current MK version

View file

@ -10,7 +10,7 @@ import {
generateRegistrationOptions, verifyAuthenticationResponse, generateRegistrationOptions, verifyAuthenticationResponse,
verifyRegistrationResponse, verifyRegistrationResponse,
} from '@simplewebauthn/server'; } from '@simplewebauthn/server';
import { AttestationFormat, isoCBOR } from '@simplewebauthn/server/helpers'; import { AttestationFormat, isoCBOR, isoUint8Array } from '@simplewebauthn/server/helpers';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { UserSecurityKeysRepository } from '@/models/_.js'; import type { UserSecurityKeysRepository } from '@/models/_.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
@ -49,7 +49,7 @@ export class WebAuthnService {
const instance = await this.metaService.fetch(); const instance = await this.metaService.fetch();
return { return {
origin: this.config.url, origin: this.config.url,
rpId: this.config.host, rpId: this.config.hostname,
rpName: instance.name ?? this.config.host, rpName: instance.name ?? this.config.host,
rpIcon: instance.iconUrl ?? undefined, rpIcon: instance.iconUrl ?? undefined,
}; };
@ -65,13 +65,12 @@ export class WebAuthnService {
const registrationOptions = await generateRegistrationOptions({ const registrationOptions = await generateRegistrationOptions({
rpName: relyingParty.rpName, rpName: relyingParty.rpName,
rpID: relyingParty.rpId, rpID: relyingParty.rpId,
userID: userId, userID: isoUint8Array.fromUTF8String(userId),
userName: userName, userName: userName,
userDisplayName: userDisplayName, userDisplayName: userDisplayName,
attestationType: 'indirect', attestationType: 'indirect',
excludeCredentials: keys.map(key => (<PublicKeyCredentialDescriptorFuture>{ excludeCredentials: keys.map(key => (<{ id: string; transports?: AuthenticatorTransportFuture[]; }>{
id: Buffer.from(key.id, 'base64url'), id: key.id,
type: 'public-key',
transports: key.transports ?? undefined, transports: key.transports ?? undefined,
})), })),
authenticatorSelection: { authenticatorSelection: {
@ -87,7 +86,7 @@ export class WebAuthnService {
@bindThis @bindThis
public async verifyRegistration(userId: MiUser['id'], response: RegistrationResponseJSON): Promise<{ public async verifyRegistration(userId: MiUser['id'], response: RegistrationResponseJSON): Promise<{
credentialID: Uint8Array; credentialID: string;
credentialPublicKey: Uint8Array; credentialPublicKey: Uint8Array;
attestationObject: Uint8Array; attestationObject: Uint8Array;
fmt: AttestationFormat; fmt: AttestationFormat;
@ -144,6 +143,7 @@ export class WebAuthnService {
@bindThis @bindThis
public async initiateAuthentication(userId: MiUser['id']): Promise<PublicKeyCredentialRequestOptionsJSON> { public async initiateAuthentication(userId: MiUser['id']): Promise<PublicKeyCredentialRequestOptionsJSON> {
const relyingParty = await this.getRelyingParty();
const keys = await this.userSecurityKeysRepository.findBy({ const keys = await this.userSecurityKeysRepository.findBy({
userId: userId, userId: userId,
}); });
@ -153,9 +153,9 @@ export class WebAuthnService {
} }
const authenticationOptions = await generateAuthenticationOptions({ const authenticationOptions = await generateAuthenticationOptions({
allowCredentials: keys.map(key => (<PublicKeyCredentialDescriptorFuture>{ rpID: relyingParty.rpId,
id: Buffer.from(key.id, 'base64url'), allowCredentials: keys.map(key => (<{ id: string; transports?: AuthenticatorTransportFuture[]; }>{
type: 'public-key', id: key.id,
transports: key.transports ?? undefined, transports: key.transports ?? undefined,
})), })),
userVerification: 'preferred', userVerification: 'preferred',
@ -219,7 +219,7 @@ export class WebAuthnService {
expectedOrigin: relyingParty.origin, expectedOrigin: relyingParty.origin,
expectedRPID: relyingParty.rpId, expectedRPID: relyingParty.rpId,
authenticator: { authenticator: {
credentialID: Buffer.from(key.id, 'base64url'), credentialID: key.id,
credentialPublicKey: Buffer.from(key.publicKey, 'base64url'), credentialPublicKey: Buffer.from(key.publicKey, 'base64url'),
counter: key.counter, counter: key.counter,
transports: key.transports ? key.transports as AuthenticatorTransportFuture[] : undefined, transports: key.transports ? key.transports as AuthenticatorTransportFuture[] : undefined,

View file

@ -29,7 +29,7 @@ import { CustomEmojiService } from '@/core/CustomEmojiService.js';
import { isNotNull } from '@/misc/is-not-null.js'; import { isNotNull } from '@/misc/is-not-null.js';
import { IdService } from '@/core/IdService.js'; import { IdService } from '@/core/IdService.js';
import { MetaService } from '../MetaService.js'; import { MetaService } from '../MetaService.js';
import { LdSignatureService } from './LdSignatureService.js'; import { JsonLdService } from './JsonLdService.js';
import { ApMfmService } from './ApMfmService.js'; import { ApMfmService } from './ApMfmService.js';
import { CONTEXT } from './misc/contexts.js'; import { CONTEXT } from './misc/contexts.js';
import type { IAccept, IActivity, IAdd, IAnnounce, IApDocument, IApEmoji, IApHashtag, IApImage, IApMention, IBlock, ICreate, IDelete, IFlag, IFollow, IKey, ILike, IMove, IObject, IPost, IQuestion, IReject, IRemove, ITombstone, IUndo, IUpdate } from './type.js'; import type { IAccept, IActivity, IAdd, IAnnounce, IApDocument, IApEmoji, IApHashtag, IApImage, IApMention, IBlock, ICreate, IDelete, IFlag, IFollow, IKey, ILike, IMove, IObject, IPost, IQuestion, IReject, IRemove, ITombstone, IUndo, IUpdate } from './type.js';
@ -61,7 +61,7 @@ export class ApRendererService {
private customEmojiService: CustomEmojiService, private customEmojiService: CustomEmojiService,
private userEntityService: UserEntityService, private userEntityService: UserEntityService,
private driveFileEntityService: DriveFileEntityService, private driveFileEntityService: DriveFileEntityService,
private ldSignatureService: LdSignatureService, private jsonLdService: JsonLdService,
private userKeypairService: UserKeypairService, private userKeypairService: UserKeypairService,
private apMfmService: ApMfmService, private apMfmService: ApMfmService,
private mfmService: MfmService, private mfmService: MfmService,
@ -173,6 +173,7 @@ export class ApRendererService {
url: this.driveFileEntityService.getPublicUrl(file), url: this.driveFileEntityService.getPublicUrl(file),
name: file.comment, name: file.comment,
summary: file.comment, summary: file.comment,
sensitive: file.isSensitive,
}; };
} }
@ -794,9 +795,9 @@ export class ApRendererService {
public async attachLdSignature(activity: any, user: { id: MiUser['id']; host: null; }): Promise<IActivity> { public async attachLdSignature(activity: any, user: { id: MiUser['id']; host: null; }): Promise<IActivity> {
const keypair = await this.userKeypairService.getUserKeypair(user.id); const keypair = await this.userKeypairService.getUserKeypair(user.id);
const ldSignature = this.ldSignatureService.use(); const jsonLd = this.jsonLdService.use();
ldSignature.debug = false; jsonLd.debug = false;
activity = await ldSignature.signRsaSignature2017(activity, keypair.privateKey, `${this.config.url}/users/${user.id}#main-key`); activity = await jsonLd.signRsaSignature2017(activity, keypair.privateKey, `${this.config.url}/users/${user.id}#main-key`);
return activity; return activity;
} }

View file

@ -7,14 +7,14 @@ import * as crypto from 'node:crypto';
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { HttpRequestService } from '@/core/HttpRequestService.js'; import { HttpRequestService } from '@/core/HttpRequestService.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
import { CONTEXT, CONTEXTS } from './misc/contexts.js'; import { CONTEXT, PRELOADED_CONTEXTS } from './misc/contexts.js';
import { validateContentTypeSetAsJsonLD } from './misc/validator.js'; import { validateContentTypeSetAsJsonLD } from './misc/validator.js';
import type { JsonLdDocument } from 'jsonld'; import type { JsonLdDocument } from 'jsonld';
import type { JsonLd, RemoteDocument } from 'jsonld/jsonld-spec.js'; import type { JsonLd as JsonLdObject, RemoteDocument } from 'jsonld/jsonld-spec.js';
// RsaSignature2017 based from https://github.com/transmute-industries/RsaSignature2017 // RsaSignature2017 implementation is based on https://github.com/transmute-industries/RsaSignature2017
class LdSignature { class JsonLd {
public debug = false; public debug = false;
public preLoad = true; public preLoad = true;
public loderTimeout = 5000; public loderTimeout = 5000;
@ -101,8 +101,6 @@ class LdSignature {
@bindThis @bindThis
public async normalize(data: JsonLdDocument): Promise<string> { public async normalize(data: JsonLdDocument): Promise<string> {
const customLoader = this.getLoader(); const customLoader = this.getLoader();
// XXX: Importing jsonld dynamically since Jest frequently fails to import it statically
// https://github.com/misskey-dev/misskey/pull/9894#discussion_r1103753595
return (await import('jsonld')).default.normalize(data, { return (await import('jsonld')).default.normalize(data, {
documentLoader: customLoader, documentLoader: customLoader,
}); });
@ -114,11 +112,11 @@ class LdSignature {
if (!/^https?:\/\//.test(url)) throw new Error(`Invalid URL ${url}`); if (!/^https?:\/\//.test(url)) throw new Error(`Invalid URL ${url}`);
if (this.preLoad) { if (this.preLoad) {
if (url in CONTEXTS) { if (url in PRELOADED_CONTEXTS) {
if (this.debug) console.debug(`HIT: ${url}`); if (this.debug) console.debug(`HIT: ${url}`);
return { return {
contextUrl: undefined, contextUrl: undefined,
document: CONTEXTS[url], document: PRELOADED_CONTEXTS[url],
documentUrl: url, documentUrl: url,
}; };
} }
@ -135,7 +133,7 @@ class LdSignature {
} }
@bindThis @bindThis
private async fetchDocument(url: string): Promise<JsonLd> { private async fetchDocument(url: string): Promise<JsonLdObject> {
const json = await this.httpRequestService.send( const json = await this.httpRequestService.send(
url, url,
{ {
@ -156,7 +154,7 @@ class LdSignature {
} }
}); });
return json as JsonLd; return json as JsonLdObject;
} }
@bindThis @bindThis
@ -168,14 +166,14 @@ class LdSignature {
} }
@Injectable() @Injectable()
export class LdSignatureService { export class JsonLdService {
constructor( constructor(
private httpRequestService: HttpRequestService, private httpRequestService: HttpRequestService,
) { ) {
} }
@bindThis @bindThis
public use(): LdSignature { public use(): JsonLd {
return new LdSignature(this.httpRequestService); return new JsonLd(this.httpRequestService);
} }
} }

View file

@ -570,7 +570,7 @@ const extension_context_definition = {
export const CONTEXT: (string | Context)[] = [...context_iris, extension_context_definition]; export const CONTEXT: (string | Context)[] = [...context_iris, extension_context_definition];
export const CONTEXTS: Record<string, JsonLd> = { export const PRELOADED_CONTEXTS: Record<string, JsonLd> = {
'https://w3id.org/identity/v1': id_v1, 'https://w3id.org/identity/v1': id_v1,
'https://w3id.org/security/v1': security_v1, 'https://w3id.org/security/v1': security_v1,
'https://www.w3.org/ns/activitystreams': activitystreams, 'https://www.w3.org/ns/activitystreams': activitystreams,

View file

@ -18,7 +18,7 @@ import { checkHttps } from '@/misc/check-https.js';
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import { ApResolverService } from '../ApResolverService.js'; import { ApResolverService } from '../ApResolverService.js';
import { ApLoggerService } from '../ApLoggerService.js'; import { ApLoggerService } from '../ApLoggerService.js';
import type { IObject } from '../type.js'; import { isDocument, type IObject } from '../type.js';
@Injectable() @Injectable()
export class ApImageService { export class ApImageService {
@ -41,7 +41,7 @@ export class ApImageService {
* Imageを作成します * Imageを作成します
*/ */
@bindThis @bindThis
public async createImage(actor: MiRemoteUser, value: string | IObject): Promise<MiDriveFile> { public async createImage(actor: MiRemoteUser, value: string | IObject): Promise<MiDriveFile | null> {
// 投稿者が凍結されていたらスキップ // 投稿者が凍結されていたらスキップ
if (actor.isSuspended) { if (actor.isSuspended) {
throw new Error('actor has been suspended'); throw new Error('actor has been suspended');
@ -49,16 +49,18 @@ export class ApImageService {
const image = await this.apResolverService.createResolver().resolve(value); const image = await this.apResolverService.createResolver().resolve(value);
if (!isDocument(image)) return null;
if (image.url == null) { if (image.url == null) {
throw new Error('invalid image: url not provided'); return null;
} }
if (typeof image.url !== 'string') { if (typeof image.url !== 'string') {
throw new Error('invalid image: unexpected type of url: ' + JSON.stringify(image.url, null, 2)); return null;
} }
if (!checkHttps(image.url)) { if (!checkHttps(image.url)) {
throw new Error('invalid image: unexpected schema of url: ' + image.url); return null;
} }
this.logger.info(`Creating the Image: ${image.url}`); this.logger.info(`Creating the Image: ${image.url}`);
@ -94,12 +96,11 @@ export class ApImageService {
/** /**
* Imageを解決します * Imageを解決します
* *
* Misskeyに対象のImageが登録されていればそれを返し * ImageをリモートサーバーからフェッチしてMisskeyに登録しそれを返します
* Misskeyに登録しそれを返します
*/ */
@bindThis @bindThis
public async resolveImage(actor: MiRemoteUser, value: string | IObject): Promise<MiDriveFile> { public async resolveImage(actor: MiRemoteUser, value: string | IObject): Promise<MiDriveFile | null> {
// TODO // TODO: Misskeyに対象のImageが登録されていればそれを返す
// リモートサーバーからフェッチしてきて登録 // リモートサーバーからフェッチしてきて登録
return await this.createImage(actor, value); return await this.createImage(actor, value);

View file

@ -4,7 +4,6 @@
*/ */
import { forwardRef, Inject, Injectable } from '@nestjs/common'; import { forwardRef, Inject, Injectable } from '@nestjs/common';
import promiseLimit from 'promise-limit';
import { In } from 'typeorm'; import { In } from 'typeorm';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { PollsRepository, EmojisRepository, NotesRepository } from '@/models/_.js'; import type { PollsRepository, EmojisRepository, NotesRepository } from '@/models/_.js';
@ -214,15 +213,13 @@ export class ApNoteService {
} }
// 添付ファイル // 添付ファイル
// TODO: attachmentは必ずしもImageではない const files: MiDriveFile[] = [];
// TODO: attachmentは必ずしも配列ではない
const limit = promiseLimit<MiDriveFile>(2); for (const attach of toArray(note.attachment)) {
const files = (await Promise.all(toArray(note.attachment).map(attach => ( attach.sensitive ??= note.sensitive;
limit(() => this.apImageService.resolveImage(actor, { const file = await this.apImageService.resolveImage(actor, attach);
...attach, if (file) files.push(file);
sensitive: note.sensitive, // Noteがsensitiveなら添付もsensitiveにする }
}))
))));
// リプライ // リプライ
const reply: MiNote | null = note.inReplyTo const reply: MiNote | null = note.inReplyTo

View file

@ -25,6 +25,7 @@ export interface IObject {
endTime?: Date; endTime?: Date;
icon?: any; icon?: any;
image?: any; image?: any;
mediaType?: string;
url?: ApObject | string; url?: ApObject | string;
href?: string; href?: string;
tag?: IObject | IObject[]; tag?: IObject | IObject[];
@ -246,14 +247,14 @@ export interface IKey extends IObject {
} }
export interface IApDocument extends IObject { export interface IApDocument extends IObject {
type: 'Document'; type: 'Audio' | 'Document' | 'Image' | 'Page' | 'Video';
name: string | null;
mediaType: string;
} }
export interface IApImage extends IObject { export const isDocument = (object: IObject): object is IApDocument =>
['Audio', 'Document', 'Image', 'Page', 'Video'].includes(getApType(object));
export interface IApImage extends IApDocument {
type: 'Image'; type: 'Image';
name: string | null;
} }
export interface ICreate extends IActivity { export interface ICreate extends IActivity {

View file

@ -257,20 +257,41 @@ export class UserEntityService implements OnModuleInit {
] = await Promise.all([ ] = await Promise.all([
this.followingsRepository.findBy({ followerId: me }) this.followingsRepository.findBy({ followerId: me })
.then(f => new Map(f.map(it => [it.followeeId, it]))), .then(f => new Map(f.map(it => [it.followeeId, it]))),
this.followingsRepository.findBy({ followeeId: me }) this.followingsRepository.createQueryBuilder('f')
.then(it => it.map(it => it.followerId)), .select('f.followerId')
this.followRequestsRepository.findBy({ followerId: me }) .where('f.followeeId = :me', { me })
.then(it => it.map(it => it.followeeId)), .getRawMany<{ f_followerId: string }>()
this.followRequestsRepository.findBy({ followeeId: me }) .then(it => it.map(it => it.f_followerId)),
.then(it => it.map(it => it.followerId)), this.followRequestsRepository.createQueryBuilder('f')
this.blockingsRepository.findBy({ blockerId: me }) .select('f.followeeId')
.then(it => it.map(it => it.blockeeId)), .where('f.followerId = :me', { me })
this.blockingsRepository.findBy({ blockeeId: me }) .getRawMany<{ f_followeeId: string }>()
.then(it => it.map(it => it.blockerId)), .then(it => it.map(it => it.f_followeeId)),
this.mutingsRepository.findBy({ muterId: me }) this.followRequestsRepository.createQueryBuilder('f')
.then(it => it.map(it => it.muteeId)), .select('f.followerId')
this.renoteMutingsRepository.findBy({ muterId: me }) .where('f.followeeId = :me', { me })
.then(it => it.map(it => it.muteeId)), .getRawMany<{ f_followerId: string }>()
.then(it => it.map(it => it.f_followerId)),
this.blockingsRepository.createQueryBuilder('b')
.select('b.blockeeId')
.where('b.blockerId = :me', { me })
.getRawMany<{ b_blockeeId: string }>()
.then(it => it.map(it => it.b_blockeeId)),
this.blockingsRepository.createQueryBuilder('b')
.select('b.blockerId')
.where('b.blockeeId = :me', { me })
.getRawMany<{ b_blockerId: string }>()
.then(it => it.map(it => it.b_blockerId)),
this.mutingsRepository.createQueryBuilder('m')
.select('m.muteeId')
.where('m.muterId = :me', { me })
.getRawMany<{ m_muteeId: string }>()
.then(it => it.map(it => it.m_muteeId)),
this.renoteMutingsRepository.createQueryBuilder('m')
.select('m.muteeId')
.where('m.muterId = :me', { me })
.getRawMany<{ m_muteeId: string }>()
.then(it => it.map(it => it.m_muteeId)),
]); ]);
return new Map( return new Map(
@ -682,18 +703,17 @@ export class UserEntityService implements OnModuleInit {
} }
const _userIds = _users.map(u => u.id); const _userIds = _users.map(u => u.id);
// -- 特に前提条件のない値群を取得
const profilesMap = await this.userProfilesRepository.findBy({ userId: In(_userIds) })
.then(profiles => new Map(profiles.map(p => [p.userId, p])));
// -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得 // -- 実行者の有無や指定スキーマの種別によって要否が異なる値群を取得
let profilesMap: Map<MiUser['id'], MiUserProfile> = new Map();
let userRelations: Map<MiUser['id'], UserRelation> = new Map(); let userRelations: Map<MiUser['id'], UserRelation> = new Map();
let userMemos: Map<MiUser['id'], string | null> = new Map(); let userMemos: Map<MiUser['id'], string | null> = new Map();
let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map(); let pinNotes: Map<MiUser['id'], MiUserNotePining[]> = new Map();
if (options?.schema !== 'UserLite') { if (options?.schema !== 'UserLite') {
profilesMap = await this.userProfilesRepository.findBy({ userId: In(_userIds) })
.then(profiles => new Map(profiles.map(p => [p.userId, p])));
const meId = me ? me.id : null; const meId = me ? me.id : null;
if (meId) { if (meId) {
userMemos = await this.userMemosRepository.findBy({ userId: meId }) userMemos = await this.userMemosRepository.findBy({ userId: meId })

View file

@ -8,9 +8,8 @@
* https://en.wikipedia.org/wiki/Identicon * https://en.wikipedia.org/wiki/Identicon
*/ */
import * as p from 'pureimage'; import { createCanvas } from '@napi-rs/canvas';
import gen from 'random-seed'; import gen from 'random-seed';
import type { WriteStream } from 'node:fs';
const size = 128; // px const size = 128; // px
const n = 5; // resolution const n = 5; // resolution
@ -45,9 +44,9 @@ const sideN = Math.floor(n / 2);
/** /**
* Generate buffer of an identicon by seed * Generate buffer of an identicon by seed
*/ */
export function genIdenticon(seed: string, stream: WriteStream): Promise<void> { export async function genIdenticon(seed: string): Promise<Buffer> {
const rand = gen.create(seed); const rand = gen.create(seed);
const canvas = p.make(size, size, undefined); const canvas = createCanvas(size, size);
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext('2d');
const bgColors = colors[rand(colors.length)]; const bgColors = colors[rand(colors.length)];
@ -101,5 +100,5 @@ export function genIdenticon(seed: string, stream: WriteStream): Promise<void> {
} }
} }
return p.encodePNGToStream(canvas, stream); return await canvas.encode('png');
} }

View file

@ -22,7 +22,7 @@ import { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js';
import { StatusError } from '@/misc/status-error.js'; import { StatusError } from '@/misc/status-error.js';
import { UtilityService } from '@/core/UtilityService.js'; import { UtilityService } from '@/core/UtilityService.js';
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js'; import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
import { LdSignatureService } from '@/core/activitypub/LdSignatureService.js'; import { JsonLdService } from '@/core/activitypub/JsonLdService.js';
import { ApInboxService } from '@/core/activitypub/ApInboxService.js'; import { ApInboxService } from '@/core/activitypub/ApInboxService.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
import { IdentifiableError } from '@/misc/identifiable-error.js'; import { IdentifiableError } from '@/misc/identifiable-error.js';
@ -39,7 +39,7 @@ export class InboxProcessorService {
private apInboxService: ApInboxService, private apInboxService: ApInboxService,
private federatedInstanceService: FederatedInstanceService, private federatedInstanceService: FederatedInstanceService,
private fetchInstanceMetadataService: FetchInstanceMetadataService, private fetchInstanceMetadataService: FetchInstanceMetadataService,
private ldSignatureService: LdSignatureService, private jsonLdService: JsonLdService,
private apPersonService: ApPersonService, private apPersonService: ApPersonService,
private apDbResolverService: ApDbResolverService, private apDbResolverService: ApDbResolverService,
private instanceChart: InstanceChart, private instanceChart: InstanceChart,
@ -122,20 +122,21 @@ export class InboxProcessorService {
} }
// 一致しなくても、でもLD-Signatureがありそうならそっちも見る // 一致しなくても、でもLD-Signatureがありそうならそっちも見る
if (activity.signature && renewKeyFailed) { const ldSignature = activity.signature;
if (activity.signature.type !== 'RsaSignature2017') { if (ldSignature) {
throw new Bull.UnrecoverableError(`skip: unsupported LD-signature type ${activity.signature.type}`); if (ldSignature.type !== 'RsaSignature2017') {
throw new Bull.UnrecoverableError(`skip: unsupported LD-signature type ${ldSignature.type}`);
} }
// activity.signature.creator: https://example.oom/users/user#main-key // ldSignature.creator: https://example.oom/users/user#main-key
// みたいになっててUserを引っ張れば公開キーも入ることを期待する // みたいになっててUserを引っ張れば公開キーも入ることを期待する
if (activity.signature.creator) { if (ldSignature.creator) {
const candicate = activity.signature.creator.replace(/#.*/, ''); const candicate = ldSignature.creator.replace(/#.*/, '');
await this.apPersonService.resolvePerson(candicate).catch(() => null); await this.apPersonService.resolvePerson(candicate).catch(() => null);
} }
// keyIdからLD-Signatureのユーザーを取得 // keyIdからLD-Signatureのユーザーを取得
authUser = await this.apDbResolverService.getAuthUserFromKeyId(activity.signature.creator); authUser = await this.apDbResolverService.getAuthUserFromKeyId(ldSignature.creator);
if (authUser == null) { if (authUser == null) {
throw new Bull.UnrecoverableError('skip: LD-Signatureのユーザーが取得できませんでした'); throw new Bull.UnrecoverableError('skip: LD-Signatureのユーザーが取得できませんでした');
} }
@ -144,9 +145,10 @@ export class InboxProcessorService {
throw new Bull.UnrecoverableError('skip: LD-SignatureのユーザーはpublicKeyを持っていませんでした'); throw new Bull.UnrecoverableError('skip: LD-SignatureのユーザーはpublicKeyを持っていませんでした');
} }
const jsonLd = this.jsonLdService.use();
// LD-Signature検証 // LD-Signature検証
const ldSignature = this.ldSignatureService.use(); const verified = await jsonLd.verifyRsaSignature2017(activity, authUser.key.keyPem).catch(() => false);
const verified = await ldSignature.verifyRsaSignature2017(activity, authUser.key.keyPem).catch(() => false);
if (!verified) { if (!verified) {
throw new Bull.UnrecoverableError('skip: LD-Signatureの検証に失敗しました'); throw new Bull.UnrecoverableError('skip: LD-Signatureの検証に失敗しました');
} }
@ -154,7 +156,7 @@ export class InboxProcessorService {
// アクティビティを正規化 // アクティビティを正規化
delete activity.signature; delete activity.signature;
try { try {
activity = await ldSignature.compact(activity) as IActivity; activity = await jsonLd.compact(activity) as IActivity;
} catch (e) { } catch (e) {
throw new Bull.UnrecoverableError(`skip: failed to compact activity: ${e}`); throw new Bull.UnrecoverableError(`skip: failed to compact activity: ${e}`);
} }

View file

@ -18,7 +18,6 @@ import { DI } from '@/di-symbols.js';
import type Logger from '@/logger.js'; import type Logger from '@/logger.js';
import * as Acct from '@/misc/acct.js'; import * as Acct from '@/misc/acct.js';
import { genIdenticon } from '@/misc/gen-identicon.js'; import { genIdenticon } from '@/misc/gen-identicon.js';
import { createTemp } from '@/misc/create-temp.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { LoggerService } from '@/core/LoggerService.js'; import { LoggerService } from '@/core/LoggerService.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
@ -194,9 +193,7 @@ export class ServerService implements OnApplicationShutdown {
reply.header('Cache-Control', 'public, max-age=86400'); reply.header('Cache-Control', 'public, max-age=86400');
if ((await this.metaService.fetch()).enableIdenticonGeneration) { if ((await this.metaService.fetch()).enableIdenticonGeneration) {
const [temp, cleanup] = await createTemp(); return await genIdenticon(request.params.x);
await genIdenticon(request.params.x, fs.createWriteStream(temp));
return fs.createReadStream(temp).on('close', () => cleanup());
} else { } else {
return reply.redirect('/static-assets/avatar.png'); return reply.redirect('/static-assets/avatar.png');
} }

View file

@ -20,13 +20,188 @@ export const meta = {
res: { res: {
type: 'object', type: 'object',
properties: { properties: {
image: {
type: 'object',
optional: true,
properties: {
link: {
type: 'string',
optional: true,
},
url: {
type: 'string',
optional: false,
},
title: {
type: 'string',
optional: true,
},
},
},
paginationLinks: {
type: 'object',
optional: true,
properties: {
self: {
type: 'string',
optional: true,
},
first: {
type: 'string',
optional: true,
},
next: {
type: 'string',
optional: true,
},
last: {
type: 'string',
optional: true,
},
prev: {
type: 'string',
optional: true,
},
},
},
link: {
type: 'string',
optional: true,
},
title: {
type: 'string',
optional: true,
},
items: { items: {
type: 'array', type: 'array',
optional: false,
items: { items: {
type: 'object', type: 'object',
properties: {
link: {
type: 'string',
optional: true,
},
guid: {
type: 'string',
optional: true,
},
title: {
type: 'string',
optional: true,
},
pubDate: {
type: 'string',
optional: true,
},
creator: {
type: 'string',
optional: true,
},
summary: {
type: 'string',
optional: true,
},
content: {
type: 'string',
optional: true,
},
isoDate: {
type: 'string',
optional: true,
},
categories: {
type: 'array',
optional: true,
items: {
type: 'string',
},
},
contentSnippet: {
type: 'string',
optional: true,
},
enclosure: {
type: 'object',
optional: true,
properties: {
url: {
type: 'string',
optional: false,
},
length: {
type: 'number',
optional: true,
},
type: {
type: 'string',
optional: true,
},
},
},
},
}, },
} },
} feedUrl: {
type: 'string',
optional: true,
},
description: {
type: 'string',
optional: true,
},
itunes: {
type: 'object',
optional: true,
additionalProperties: true,
properties: {
image: {
type: 'string',
optional: true,
},
owner: {
type: 'object',
optional: true,
properties: {
name: {
type: 'string',
optional: true,
},
email: {
type: 'string',
optional: true,
},
},
},
author: {
type: 'string',
optional: true,
},
summary: {
type: 'string',
optional: true,
},
explicit: {
type: 'string',
optional: true,
},
categories: {
type: 'array',
optional: true,
items: {
type: 'string',
},
},
keywords: {
type: 'array',
optional: true,
items: {
type: 'string',
},
},
},
},
},
}, },
} as const; } as const;

View file

@ -97,10 +97,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
} }
const keyInfo = await this.webAuthnService.verifyRegistration(me.id, ps.credential); const keyInfo = await this.webAuthnService.verifyRegistration(me.id, ps.credential);
const keyId = keyInfo.credentialID;
const credentialId = Buffer.from(keyInfo.credentialID).toString('base64url');
await this.userSecurityKeysRepository.insert({ await this.userSecurityKeysRepository.insert({
id: credentialId, id: keyId,
userId: me.id, userId: me.id,
name: ps.name, name: ps.name,
publicKey: Buffer.from(keyInfo.credentialPublicKey).toString('base64url'), publicKey: Buffer.from(keyInfo.credentialPublicKey).toString('base64url'),
@ -117,7 +117,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
})); }));
return { return {
id: credentialId, id: keyId,
name: ps.name, name: ps.name,
}; };
}); });

View file

@ -202,9 +202,18 @@ export class ClientServerService {
// Authenticate // Authenticate
fastify.addHook('onRequest', async (request, reply) => { fastify.addHook('onRequest', async (request, reply) => {
if (request.routeOptions.url == null) {
reply.code(404).send('Not found');
return;
}
// %71ueueとかでリクエストされたら困るため // %71ueueとかでリクエストされたら困るため
const url = decodeURI(request.routeOptions.url); const url = decodeURI(request.routeOptions.url);
if (url === bullBoardPath || url.startsWith(bullBoardPath + '/')) { if (url === bullBoardPath || url.startsWith(bullBoardPath + '/')) {
if (!url.startsWith(bullBoardPath + '/static/')) {
reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
}
const token = request.cookies.token; const token = request.cookies.token;
if (token == null) { if (token == null) {
reply.code(401).send('Login required'); reply.code(401).send('Login required');

View file

@ -3,7 +3,7 @@ extends ./base
block vars block vars
- const user = page.user; - const user = page.user;
- const title = page.title; - const title = page.title;
- const url = `${config.url}/@${user.username}/${page.name}`; - const url = `${config.url}/@${user.username}/pages/${page.name}`;
block title block title
= `${title} | ${instanceName}` = `${title} | ${instanceName}`

View file

@ -39,6 +39,12 @@ describe('MfmService', () => {
const output = '<p>foo <i>bar</i></p>'; const output = '<p>foo <i>bar</i></p>';
assert.equal(mfmService.toHtml(mfm.parse(input)), output); assert.equal(mfmService.toHtml(mfm.parse(input)), output);
}); });
test('escape', () => {
const input = '```\n<p>Hello, world!</p>\n```';
const output = '<p><pre><code>&lt;p&gt;Hello, world!&lt;/p&gt;</code></pre></p>';
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
});
}); });
describe('fromHtml', () => { describe('fromHtml', () => {

View file

@ -13,11 +13,13 @@ import { ApImageService } from '@/core/activitypub/models/ApImageService.js';
import { ApNoteService } from '@/core/activitypub/models/ApNoteService.js'; import { ApNoteService } from '@/core/activitypub/models/ApNoteService.js';
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js'; import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { JsonLdService } from '@/core/activitypub/JsonLdService.js';
import { CONTEXT } from '@/core/activitypub/misc/contexts.js';
import { GlobalModule } from '@/GlobalModule.js'; import { GlobalModule } from '@/GlobalModule.js';
import { CoreModule } from '@/core/CoreModule.js'; import { CoreModule } from '@/core/CoreModule.js';
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import { LoggerService } from '@/core/LoggerService.js'; import { LoggerService } from '@/core/LoggerService.js';
import type { IActor, IApDocument, ICollection, IPost } from '@/core/activitypub/type.js'; import type { IActor, IApDocument, ICollection, IObject, IPost } from '@/core/activitypub/type.js';
import { MiMeta, MiNote } from '@/models/_.js'; import { MiMeta, MiNote } from '@/models/_.js';
import { secureRndstr } from '@/misc/secure-rndstr.js'; import { secureRndstr } from '@/misc/secure-rndstr.js';
import { DownloadService } from '@/core/DownloadService.js'; import { DownloadService } from '@/core/DownloadService.js';
@ -88,6 +90,7 @@ describe('ActivityPub', () => {
let noteService: ApNoteService; let noteService: ApNoteService;
let personService: ApPersonService; let personService: ApPersonService;
let rendererService: ApRendererService; let rendererService: ApRendererService;
let jsonLdService: JsonLdService;
let resolver: MockResolver; let resolver: MockResolver;
const metaInitial = { const metaInitial = {
@ -128,6 +131,7 @@ describe('ActivityPub', () => {
personService = app.get<ApPersonService>(ApPersonService); personService = app.get<ApPersonService>(ApPersonService);
rendererService = app.get<ApRendererService>(ApRendererService); rendererService = app.get<ApRendererService>(ApRendererService);
imageService = app.get<ApImageService>(ApImageService); imageService = app.get<ApImageService>(ApImageService);
jsonLdService = app.get<JsonLdService>(JsonLdService);
resolver = new MockResolver(await app.resolve<LoggerService>(LoggerService)); resolver = new MockResolver(await app.resolve<LoggerService>(LoggerService));
// Prevent ApPersonService from fetching instance, as it causes Jest import-after-test error // Prevent ApPersonService from fetching instance, as it causes Jest import-after-test error
@ -295,7 +299,7 @@ describe('ActivityPub', () => {
await createRandomRemoteUser(resolver, personService), await createRandomRemoteUser(resolver, personService),
imageObject, imageObject,
); );
assert.ok(!driveFile.isLink); assert.ok(driveFile && !driveFile.isLink);
const sensitiveImageObject: IApDocument = { const sensitiveImageObject: IApDocument = {
type: 'Document', type: 'Document',
@ -308,7 +312,7 @@ describe('ActivityPub', () => {
await createRandomRemoteUser(resolver, personService), await createRandomRemoteUser(resolver, personService),
sensitiveImageObject, sensitiveImageObject,
); );
assert.ok(!sensitiveDriveFile.isLink); assert.ok(sensitiveDriveFile && !sensitiveDriveFile.isLink);
}); });
test('cacheRemoteFiles=false disables caching', async () => { test('cacheRemoteFiles=false disables caching', async () => {
@ -324,7 +328,7 @@ describe('ActivityPub', () => {
await createRandomRemoteUser(resolver, personService), await createRandomRemoteUser(resolver, personService),
imageObject, imageObject,
); );
assert.ok(driveFile.isLink); assert.ok(driveFile && driveFile.isLink);
const sensitiveImageObject: IApDocument = { const sensitiveImageObject: IApDocument = {
type: 'Document', type: 'Document',
@ -337,7 +341,7 @@ describe('ActivityPub', () => {
await createRandomRemoteUser(resolver, personService), await createRandomRemoteUser(resolver, personService),
sensitiveImageObject, sensitiveImageObject,
); );
assert.ok(sensitiveDriveFile.isLink); assert.ok(sensitiveDriveFile && sensitiveDriveFile.isLink);
}); });
test('cacheRemoteSensitiveFiles=false only affects sensitive files', async () => { test('cacheRemoteSensitiveFiles=false only affects sensitive files', async () => {
@ -353,7 +357,7 @@ describe('ActivityPub', () => {
await createRandomRemoteUser(resolver, personService), await createRandomRemoteUser(resolver, personService),
imageObject, imageObject,
); );
assert.ok(!driveFile.isLink); assert.ok(driveFile && !driveFile.isLink);
const sensitiveImageObject: IApDocument = { const sensitiveImageObject: IApDocument = {
type: 'Document', type: 'Document',
@ -366,7 +370,57 @@ describe('ActivityPub', () => {
await createRandomRemoteUser(resolver, personService), await createRandomRemoteUser(resolver, personService),
sensitiveImageObject, sensitiveImageObject,
); );
assert.ok(sensitiveDriveFile.isLink); assert.ok(sensitiveDriveFile && sensitiveDriveFile.isLink);
});
test('Link is not an attachment files', async () => {
const linkObject: IObject = {
type: 'Link',
href: 'https://example.com/',
};
const driveFile = await imageService.createImage(
await createRandomRemoteUser(resolver, personService),
linkObject,
);
assert.strictEqual(driveFile, null);
});
});
describe('JSON-LD', () =>{
test('Compaction', async () => {
const jsonLd = jsonLdService.use();
const object = {
'@context': [
'https://www.w3.org/ns/activitystreams',
{
_misskey_quote: 'https://misskey-hub.net/ns#_misskey_quote',
unknown: 'https://example.org/ns#unknown',
undefined: null,
},
],
id: 'https://example.com/notes/42',
type: 'Note',
attributedTo: 'https://example.com/users/1',
to: ['https://www.w3.org/ns/activitystreams#Public'],
content: 'test test foo',
_misskey_quote: 'https://example.com/notes/1',
unknown: 'test test bar',
undefined: 'test test baz',
};
const compacted = await jsonLd.compact(object);
assert.deepStrictEqual(compacted, {
'@context': CONTEXT,
id: 'https://example.com/notes/42',
type: 'Note',
attributedTo: 'https://example.com/users/1',
to: 'as:Public',
content: 'test test foo',
_misskey_quote: 'https://example.com/notes/1',
'https://example.org/ns#unknown': 'test test bar',
// undefined: 'test test baz',
});
}); });
}); });
}); });

View file

@ -27,7 +27,7 @@ export function galleryPost(isSensitive = false) {
id: 'somepostid', id: 'somepostid',
createdAt: '2016-12-28T22:49:51.000Z', createdAt: '2016-12-28T22:49:51.000Z',
updatedAt: '2016-12-28T22:49:51.000Z', updatedAt: '2016-12-28T22:49:51.000Z',
userid: 'someuserid', userId: 'someuserid',
user: userDetailed(), user: userDetailed(),
title: 'Some post title', title: 'Some post title',
description: 'Some post description', description: 'Some post description',
@ -75,9 +75,8 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi
avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true', avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true',
avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay', avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay',
avatarDecorations: [], avatarDecorations: [],
emojis: [], emojis: {},
bannerBlurhash: 'eQA^IW^-MH8w9tE8I=S^o{$*R4RikXtSxutRozjEnNR.RQadoyozog', bannerBlurhash: 'eQA^IW^-MH8w9tE8I=S^o{$*R4RikXtSxutRozjEnNR.RQadoyozog',
bannerColor: '#000000',
bannerUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true', bannerUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true',
birthday: '2014-06-20', birthday: '2014-06-20',
createdAt: '2016-12-28T22:49:51.000Z', createdAt: '2016-12-28T22:49:51.000Z',
@ -119,11 +118,16 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi
publicReactions: false, publicReactions: false,
securityKeys: false, securityKeys: false,
twoFactorEnabled: false, twoFactorEnabled: false,
usePasswordLessLogin: false,
twoFactorBackupCodesStock: 'none', twoFactorBackupCodesStock: 'none',
updatedAt: null, updatedAt: null,
lastFetchedAt: null,
uri: null, uri: null,
url: null, url: null,
movedTo: null,
alsoKnownAs: null,
notify: 'none', notify: 'none',
memo: null
}; };
} }

View file

@ -82,23 +82,16 @@ function h<T extends estree.Node>(
return Object.assign(props || {}, { type }) as T; return Object.assign(props || {}, { type }) as T;
} }
declare global { declare namespace h.JSX {
namespace JSX { type Element = estree.Node;
type Element = estree.Node; type IntrinsicElements = {
type ElementClass = never; [T in keyof typeof generator as ToKebab<SplitCamel<Uncapitalize<T>>>]: {
type ElementAttributesProperty = never; [K in keyof Omit<
type ElementChildrenAttribute = never; Parameters<(typeof generator)[T]>[0],
type IntrinsicAttributes = never; 'type'
type IntrinsicClassAttributes<T> = never; >]?: Parameters<(typeof generator)[T]>[0][K];
type IntrinsicElements = {
[T in keyof typeof generator as ToKebab<SplitCamel<Uncapitalize<T>>>]: {
[K in keyof Omit<
Parameters<(typeof generator)[T]>[0],
'type'
>]?: Parameters<(typeof generator)[T]>[0][K];
};
}; };
} };
} }
function toStories(component: string): Promise<string> { function toStories(component: string): Promise<string> {
@ -388,6 +381,7 @@ function toStories(component: string): Promise<string> {
'/* eslint-disable @typescript-eslint/explicit-function-return-type */\n' + '/* eslint-disable @typescript-eslint/explicit-function-return-type */\n' +
'/* eslint-disable import/no-default-export */\n' + '/* eslint-disable import/no-default-export */\n' +
'/* eslint-disable import/no-duplicates */\n' + '/* eslint-disable import/no-duplicates */\n' +
'/* eslint-disable import/order */\n' +
generate(program, { generator }) + generate(program, { generator }) +
(hasImplStories ? readFileSync(`${implStories}.ts`, 'utf-8') : ''), (hasImplStories ? readFileSync(`${implStories}.ts`, 'utf-8') : ''),
{ {

View file

@ -34,7 +34,7 @@ const config = {
disableTelemetry: true, disableTelemetry: true,
}, },
async viteFinal(config) { async viteFinal(config) {
const replacePluginForIsChromatic = config.plugins?.findIndex((plugin) => plugin && (plugin as Partial<Plugin>)?.name === 'replace') ?? -1; const replacePluginForIsChromatic = config.plugins?.findIndex((plugin: Plugin) => plugin && plugin.name === 'replace') ?? -1;
if (~replacePluginForIsChromatic) { if (~replacePluginForIsChromatic) {
config.plugins?.splice(replacePluginForIsChromatic, 1); config.plugins?.splice(replacePluginForIsChromatic, 1);
} }

View file

@ -6,7 +6,8 @@
import { type SharedOptions, http, HttpResponse } from 'msw'; import { type SharedOptions, http, HttpResponse } from 'msw';
export const onUnhandledRequest = ((req, print) => { export const onUnhandledRequest = ((req, print) => {
if (req.url.hostname !== 'localhost' || /^\/(?:client-assets\/|fluent-emojis?\/|iframe.html$|node_modules\/|src\/|sb-|static-assets\/|vite\/)/.test(req.url.pathname)) { const url = new URL(req.url);
if (url.hostname !== 'localhost' || /^\/(?:client-assets\/|fluent-emojis?\/|iframe.html$|node_modules\/|src\/|sb-|static-assets\/|vite\/)/.test(url.pathname)) {
return return
} }
print.warning() print.warning()

View file

@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true" as="image" type="image/png" crossorigin="anonymous"> <link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true" as="image" type="image/png" crossorigin="anonymous">
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true" as="image" type="image/jpeg" crossorigin="anonymous"> <link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true" as="image" type="image/jpeg" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/@tabler/icons-webfont@2.44.0/tabler-icons.min.css"> <link rel="stylesheet" href="https://unpkg.com/@tabler/icons-webfont@3.3.0/tabler-icons.min.css">
<link rel="stylesheet" href="https://unpkg.com/@fontsource/m-plus-rounded-1c/index.css"> <link rel="stylesheet" href="https://unpkg.com/@fontsource/m-plus-rounded-1c/index.css">
<style> <style>
html { html {

View file

@ -17,7 +17,7 @@
"lint": "pnpm typecheck && pnpm eslint" "lint": "pnpm typecheck && pnpm eslint"
}, },
"dependencies": { "dependencies": {
"@discordapp/twemoji": "15.0.2", "@discordapp/twemoji": "15.0.3",
"@github/webauthn-json": "2.1.1", "@github/webauthn-json": "2.1.1",
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3", "@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
"@misskey-dev/browser-image-resizer": "2024.1.0", "@misskey-dev/browser-image-resizer": "2024.1.0",
@ -27,22 +27,22 @@
"@rollup/pluginutils": "5.1.0", "@rollup/pluginutils": "5.1.0",
"@transfem-org/sfm-js": "0.24.5", "@transfem-org/sfm-js": "0.24.5",
"@syuilo/aiscript": "0.18.0", "@syuilo/aiscript": "0.18.0",
"@twemoji/parser": "15.0.0", "@twemoji/parser": "15.1.1",
"@vitejs/plugin-vue": "5.0.4", "@vitejs/plugin-vue": "5.0.4",
"@vue/compiler-sfc": "3.4.21", "@vue/compiler-sfc": "3.4.26",
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.4", "aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.4",
"astring": "1.8.6", "astring": "1.8.6",
"broadcast-channel": "7.0.0", "broadcast-channel": "7.0.0",
"buraha": "0.0.1", "buraha": "0.0.1",
"canvas-confetti": "1.9.2", "canvas-confetti": "1.9.3",
"chart.js": "4.4.2", "chart.js": "4.4.2",
"chartjs-adapter-date-fns": "3.0.0", "chartjs-adapter-date-fns": "3.0.0",
"chartjs-chart-matrix": "2.0.1", "chartjs-chart-matrix": "2.0.1",
"chartjs-plugin-gradient": "0.6.1", "chartjs-plugin-gradient": "0.6.1",
"chartjs-plugin-zoom": "2.0.1", "chartjs-plugin-zoom": "2.0.1",
"chromatic": "11.0.0", "chromatic": "11.3.0",
"compare-versions": "6.1.0", "compare-versions": "6.1.0",
"cropperjs": "2.0.0-beta.4", "cropperjs": "2.0.0-beta.5",
"date-fns": "2.30.0", "date-fns": "2.30.0",
"escape-regexp": "0.0.1", "escape-regexp": "0.0.1",
"estree-walker": "3.0.3", "estree-walker": "3.0.3",
@ -58,85 +58,85 @@
"misskey-reversi": "workspace:*", "misskey-reversi": "workspace:*",
"photoswipe": "5.4.3", "photoswipe": "5.4.3",
"punycode": "2.3.1", "punycode": "2.3.1",
"rollup": "4.12.0", "rollup": "4.17.2",
"sanitize-html": "2.12.1", "sanitize-html": "2.13.0",
"sass": "1.71.1", "sass": "1.76.0",
"shiki": "1.2.0", "shiki": "1.4.0",
"strict-event-emitter-types": "2.0.0", "strict-event-emitter-types": "2.0.0",
"textarea-caret": "3.1.0", "textarea-caret": "3.1.0",
"three": "0.162.0", "three": "0.164.1",
"throttle-debounce": "5.0.0", "throttle-debounce": "5.0.0",
"tinycolor2": "1.6.0", "tinycolor2": "1.6.0",
"tsc-alias": "1.8.8", "tsc-alias": "1.8.8",
"tsconfig-paths": "4.2.0", "tsconfig-paths": "4.2.0",
"typescript": "5.3.3", "typescript": "5.4.5",
"uuid": "9.0.1", "uuid": "9.0.1",
"v-code-diff": "1.9.0", "v-code-diff": "1.11.0",
"vite": "5.1.4", "vite": "5.2.11",
"vue": "3.4.21", "vue": "3.4.26",
"vuedraggable": "next" "vuedraggable": "next"
}, },
"devDependencies": { "devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0", "@misskey-dev/eslint-plugin": "1.0.0",
"@misskey-dev/summaly": "5.0.3", "@misskey-dev/summaly": "5.1.0",
"@storybook/addon-actions": "8.0.0-beta.6", "@storybook/addon-actions": "8.0.9",
"@storybook/addon-essentials": "8.0.0-beta.6", "@storybook/addon-essentials": "8.0.9",
"@storybook/addon-interactions": "8.0.0-beta.6", "@storybook/addon-interactions": "8.0.9",
"@storybook/addon-links": "8.0.0-beta.6", "@storybook/addon-links": "8.0.9",
"@storybook/addon-mdx-gfm": "8.0.0-beta.6", "@storybook/addon-mdx-gfm": "8.0.9",
"@storybook/addon-storysource": "8.0.0-beta.6", "@storybook/addon-storysource": "8.0.9",
"@storybook/blocks": "8.0.0-beta.6", "@storybook/blocks": "8.0.9",
"@storybook/components": "8.0.0-beta.6", "@storybook/components": "8.0.9",
"@storybook/core-events": "8.0.0-beta.6", "@storybook/core-events": "8.0.9",
"@storybook/manager-api": "8.0.0-beta.6", "@storybook/manager-api": "8.0.9",
"@storybook/preview-api": "8.0.0-beta.6", "@storybook/preview-api": "8.0.9",
"@storybook/react": "8.0.0-beta.6", "@storybook/react": "8.0.9",
"@storybook/react-vite": "8.0.0-beta.6", "@storybook/react-vite": "8.0.9",
"@storybook/test": "8.0.0-beta.6", "@storybook/test": "8.0.9",
"@storybook/theming": "8.0.0-beta.6", "@storybook/theming": "8.0.9",
"@storybook/types": "8.0.0-beta.6", "@storybook/types": "8.0.9",
"@storybook/vue3": "8.0.0-beta.6", "@storybook/vue3": "8.0.9",
"@storybook/vue3-vite": "8.0.0-beta.6", "@storybook/vue3-vite": "8.0.9",
"@testing-library/vue": "8.0.2", "@testing-library/vue": "8.0.3",
"@types/escape-regexp": "0.0.3", "@types/escape-regexp": "0.0.3",
"@types/estree": "1.0.5", "@types/estree": "1.0.5",
"@types/matter-js": "0.19.6", "@types/matter-js": "0.19.6",
"@types/micromatch": "4.0.6", "@types/micromatch": "4.0.7",
"@types/node": "20.11.22", "@types/node": "20.12.7",
"@types/punycode": "2.1.4", "@types/punycode": "2.1.4",
"@types/sanitize-html": "2.11.0", "@types/sanitize-html": "2.11.0",
"@types/throttle-debounce": "5.0.2", "@types/throttle-debounce": "5.0.2",
"@types/tinycolor2": "1.4.6", "@types/tinycolor2": "1.4.6",
"@types/uuid": "9.0.8", "@types/uuid": "9.0.8",
"@types/ws": "8.5.10", "@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "7.1.0", "@typescript-eslint/eslint-plugin": "7.7.1",
"@typescript-eslint/parser": "7.1.0", "@typescript-eslint/parser": "7.7.1",
"@vitest/coverage-v8": "0.34.6", "@vitest/coverage-v8": "0.34.6",
"@vue/runtime-core": "3.4.21", "@vue/runtime-core": "3.4.26",
"acorn": "8.11.3", "acorn": "8.11.3",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "13.6.6", "cypress": "13.8.1",
"eslint": "8.57.0", "eslint": "8.57.0",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"eslint-plugin-vue": "9.22.0", "eslint-plugin-vue": "9.25.0",
"fast-glob": "3.3.2", "fast-glob": "3.3.2",
"happy-dom": "13.6.2", "happy-dom": "14.7.1",
"intersection-observer": "0.12.2", "intersection-observer": "0.12.2",
"micromatch": "4.0.5", "micromatch": "4.0.5",
"msw": "2.1.7", "msw": "2.2.14",
"msw-storybook-addon": "2.0.0-beta.1", "msw-storybook-addon": "2.0.1",
"nodemon": "3.1.0", "nodemon": "3.1.0",
"prettier": "3.2.5", "prettier": "3.2.5",
"react": "18.2.0", "react": "18.3.1",
"react-dom": "18.2.0", "react-dom": "18.3.1",
"start-server-and-test": "2.0.3", "start-server-and-test": "2.0.3",
"storybook": "8.0.0-beta.6", "storybook": "8.0.9",
"storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme", "storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme",
"vite-plugin-turbosnap": "1.0.3", "vite-plugin-turbosnap": "1.0.3",
"vitest": "0.34.6", "vitest": "0.34.6",
"vitest-fetch-mock": "0.2.2", "vitest-fetch-mock": "0.2.2",
"vue-component-type-helpers": "1.8.27", "vue-component-type-helpers": "2.0.16",
"vue-eslint-parser": "9.4.2", "vue-eslint-parser": "9.4.2",
"vue-tsc": "1.8.27" "vue-tsc": "2.0.16"
} }
} }

View file

@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<div class="detail"> <div class="detail">
<div> <div>
<Mfm :text="report.comment"/> <Mfm :text="report.comment" :linkNavigationBehavior="'window'"/>
</div> </div>
<hr/> <hr/>
<div>{{ i18n.ts.reporter }}: <MkA :to="`/admin/user/${report.reporter.id}`" class="_link" :behavior="'window'">@{{ report.reporter.username }}</MkA></div> <div>{{ i18n.ts.reporter }}: <MkA :to="`/admin/user/${report.reporter.id}`" class="_link" :behavior="'window'">@{{ report.reporter.username }}</MkA></div>

View file

@ -4,7 +4,10 @@
*/ */
/* eslint-disable @typescript-eslint/explicit-function-return-type */ /* eslint-disable @typescript-eslint/explicit-function-return-type */
import { action } from '@storybook/addon-actions';
import { StoryObj } from '@storybook/vue3'; import { StoryObj } from '@storybook/vue3';
import { HttpResponse, http } from 'msw';
import { commonHandlers } from '../../.storybook/mocks.js';
import { userDetailed } from '../../.storybook/fakes.js'; import { userDetailed } from '../../.storybook/fakes.js';
import MkAccountMoved from './MkAccountMoved.vue'; import MkAccountMoved from './MkAccountMoved.vue';
export const Default = { export const Default = {
@ -29,10 +32,18 @@ export const Default = {
}; };
}, },
args: { args: {
username: userDetailed().username, movedTo: userDetailed().id,
host: userDetailed().host,
}, },
parameters: { parameters: {
layout: 'centered', layout: 'centered',
msw: {
handlers: [
...commonHandlers,
http.post('/api/users/show', async ({ request }) => {
action('POST /api/users/show')(await request.json());
return HttpResponse.json(userDetailed());
}),
],
},
}, },
} satisfies StoryObj<typeof MkAccountMoved>; } satisfies StoryObj<typeof MkAccountMoved>;

View file

@ -4,7 +4,10 @@
*/ */
/* eslint-disable @typescript-eslint/explicit-function-return-type */ /* eslint-disable @typescript-eslint/explicit-function-return-type */
import { action } from '@storybook/addon-actions';
import { StoryObj } from '@storybook/vue3'; import { StoryObj } from '@storybook/vue3';
import { HttpResponse, http } from 'msw';
import { commonHandlers } from '../../.storybook/mocks.js';
import MkAnnouncementDialog from './MkAnnouncementDialog.vue'; import MkAnnouncementDialog from './MkAnnouncementDialog.vue';
export const Default = { export const Default = {
render(args) { render(args) {
@ -23,8 +26,13 @@ export const Default = {
...this.args, ...this.args,
}; };
}, },
events() {
return {
closed: action('closed'),
};
},
}, },
template: '<MkAnnouncementDialog v-bind="props" />', template: '<MkAnnouncementDialog v-bind="props" v-on="events" />',
}; };
}, },
args: { args: {
@ -38,10 +46,20 @@ export const Default = {
imageUrl: null, imageUrl: null,
display: 'dialog', display: 'dialog',
needConfirmationToRead: false, needConfirmationToRead: false,
silence: false,
forYou: true, forYou: true,
}, },
}, },
parameters: { parameters: {
layout: 'centered', layout: 'centered',
msw: {
handlers: [
...commonHandlers,
http.post('/api/i/read-announcement', async ({ request }) => {
action('POST /api/i/read-announcement')(await request.json());
return HttpResponse.json();
}),
],
},
}, },
} satisfies StoryObj<typeof MkAnnouncementDialog>; } satisfies StoryObj<typeof MkAnnouncementDialog>;

View file

@ -44,6 +44,8 @@ SPDX-License-Identifier: AGPL-3.0-only
:instant="true" :instant="true"
:initialText="c.form?.text" :initialText="c.form?.text"
:initialCw="c.form?.cw" :initialCw="c.form?.cw"
:initialVisibility="c.form?.visibility"
:initialLocalOnly="c.form?.localOnly"
/> />
</div> </div>
<MkFolder v-else-if="c.type === 'folder'" :defaultOpen="c.opened"> <MkFolder v-else-if="c.type === 'folder'" :defaultOpen="c.opened">
@ -111,6 +113,8 @@ function openPostForm() {
os.post({ os.post({
initialText: form.text, initialText: form.text,
initialCw: form.cw, initialCw: form.cw,
initialVisibility: form.visibility,
initialLocalOnly: form.localOnly,
instant: true, instant: true,
}); });
} }

View file

@ -4,19 +4,11 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div v-if="meta" :class="$style.root" :style="{ backgroundImage: `url(${ meta.backgroundImageUrl })` }"></div> <div v-if="instance" :class="$style.root" :style="{ backgroundImage: `url(${ instance.backgroundImageUrl })` }"></div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { instance } from '@/instance.js';
import * as Misskey from 'misskey-js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const meta = ref<Misskey.entities.MetaResponse>();
misskeyApi('meta', { detail: true }).then(gotMeta => {
meta.value = gotMeta;
});
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<component <component
:is="self ? 'MkA' : 'a'" ref="el" style="word-break: break-all;" class="_link" :[attr]="self ? url.substring(local.length) : url" :rel="rel ?? 'nofollow noopener'" :target="target" :is="self ? 'MkA' : 'a'" ref="el" style="word-break: break-all;" class="_link" :[attr]="self ? url.substring(local.length) : url" :rel="rel ?? 'nofollow noopener'" :target="target"
:behavior="props.navigationBehavior"
:title="url" :title="url"
@click.stop @click.stop
> >
@ -20,10 +21,12 @@ import { url as local } from '@/config.js';
import { useTooltip } from '@/scripts/use-tooltip.js'; import { useTooltip } from '@/scripts/use-tooltip.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { isEnabledUrlPreview } from '@/instance.js'; import { isEnabledUrlPreview } from '@/instance.js';
import { MkABehavior } from '@/components/global/MkA.vue';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
url: string; url: string;
rel?: null | string; rel?: null | string;
navigationBehavior?: MkABehavior;
}>(), { }>(), {
}); });

View file

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<MkA v-user-preview="canonical" :class="[$style.root, { [$style.isMe]: isMe }]" :to="url" :style="{ background: bgCss }"> <MkA v-user-preview="canonical" :class="[$style.root, { [$style.isMe]: isMe }]" :to="url" :style="{ background: bgCss }" :behavior="navigationBehavior">
<img :class="$style.icon" :src="avatarUrl" alt=""> <img :class="$style.icon" :src="avatarUrl" alt="">
<span> <span>
<span>@{{ username }}</span> <span>@{{ username }}</span>
@ -21,10 +21,12 @@ import { host as localHost } from '@/config.js';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { defaultStore } from '@/store.js'; import { defaultStore } from '@/store.js';
import { getStaticImageUrl } from '@/scripts/media-proxy.js'; import { getStaticImageUrl } from '@/scripts/media-proxy.js';
import { MkABehavior } from '@/components/global/MkA.vue';
const props = defineProps<{ const props = defineProps<{
username: string; username: string;
host: string; host: string;
navigationBehavior?: MkABehavior;
}>(); }>();
const canonical = props.host === localHost ? `@${props.username}` : `@${props.username}@${toUnicode(props.host)}`; const canonical = props.host === localHost ? `@${props.username}` : `@${props.username}@${toUnicode(props.host)}`;

View file

@ -61,8 +61,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<span v-else-if="notification.type === 'achievementEarned'">{{ i18n.ts._notification.achievementEarned }}</span> <span v-else-if="notification.type === 'achievementEarned'">{{ i18n.ts._notification.achievementEarned }}</span>
<span v-else-if="notification.type === 'test'">{{ i18n.ts._notification.testNotification }}</span> <span v-else-if="notification.type === 'test'">{{ i18n.ts._notification.testNotification }}</span>
<MkA v-else-if="notification.type === 'follow' || notification.type === 'mention' || notification.type === 'reply' || notification.type === 'renote' || notification.type === 'quote' || notification.type === 'reaction' || notification.type === 'receiveFollowRequest' || notification.type === 'followRequestAccepted'" v-user-preview="notification.user.id" :class="$style.headerName" :to="userPage(notification.user)"><MkUserName :user="notification.user"/></MkA> <MkA v-else-if="notification.type === 'follow' || notification.type === 'mention' || notification.type === 'reply' || notification.type === 'renote' || notification.type === 'quote' || notification.type === 'reaction' || notification.type === 'receiveFollowRequest' || notification.type === 'followRequestAccepted'" v-user-preview="notification.user.id" :class="$style.headerName" :to="userPage(notification.user)"><MkUserName :user="notification.user"/></MkA>
<span v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'">{{ i18n.tsx._notification.likedBySomeUsers({ n: notification.reactions.length }) }}</span> <span v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'">{{ i18n.tsx._notification.likedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }}</span>
<span v-else-if="notification.type === 'reaction:grouped'">{{ i18n.tsx._notification.reactedBySomeUsers({ n: notification.reactions.length }) }}</span> <span v-else-if="notification.type === 'reaction:grouped'">{{ i18n.tsx._notification.reactedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }}</span>
<span v-else-if="notification.type === 'renote:grouped'">{{ i18n.tsx._notification.renotedBySomeUsers({ n: notification.users.length }) }}</span> <span v-else-if="notification.type === 'renote:grouped'">{{ i18n.tsx._notification.renotedBySomeUsers({ n: notification.users.length }) }}</span>
<span v-else-if="notification.type === 'app'">{{ notification.header }}</span> <span v-else-if="notification.type === 'app'">{{ notification.header }}</span>
<span v-else-if="notification.type === 'edited'">{{ i18n.ts._notification.edited }}</span> <span v-else-if="notification.type === 'edited'">{{ i18n.ts._notification.edited }}</span>
@ -76,7 +76,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkA> </MkA>
<MkA v-else-if="notification.type === 'renote' || notification.type === 'renote:grouped'" :class="$style.text" :to="notePage(notification.note)" :title="getNoteSummary(notification.note.renote)"> <MkA v-else-if="notification.type === 'renote' || notification.type === 'renote:grouped'" :class="$style.text" :to="notePage(notification.note)" :title="getNoteSummary(notification.note.renote)">
<i class="ph-quotes ph-bold ph-lg" :class="$style.quote"></i> <i class="ph-quotes ph-bold ph-lg" :class="$style.quote"></i>
<Mfm :text="getNoteSummary(notification.note.renote)" :plain="true" :nowrap="true" :author="notification.note.renote.user"/> <Mfm :text="getNoteSummary(notification.note.renote)" :plain="true" :nowrap="true" :author="notification.note.renote?.user"/>
<i class="ph-quotes ph-bold ph-lg" :class="$style.quote"></i> <i class="ph-quotes ph-bold ph-lg" :class="$style.quote"></i>
</MkA> </MkA>
<MkA v-else-if="notification.type === 'reply'" :class="$style.text" :to="notePage(notification.note)" :title="getNoteSummary(notification.note)"> <MkA v-else-if="notification.type === 'reply'" :class="$style.text" :to="notePage(notification.note)" :title="getNoteSummary(notification.note)">
@ -184,6 +184,11 @@ const rejectFollowRequest = () => {
followRequestDone.value = true; followRequestDone.value = true;
misskeyApi('following/requests/reject', { userId: props.notification.user.id }); misskeyApi('following/requests/reject', { userId: props.notification.user.id });
}; };
function getActualReactedUsersCount(notification: Misskey.entities.Notification) {
if (notification.type !== 'reaction:grouped') return 0;
return new Set(notification.reactions.map((reaction) => reaction.user.id)).size;
}
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -158,6 +158,7 @@ const props = withDefaults(defineProps<{
initialVisibleUsers: () => [], initialVisibleUsers: () => [],
autofocus: true, autofocus: true,
mock: false, mock: false,
initialLocalOnly: undefined,
}); });
provide('mock', props.mock); provide('mock', props.mock);
@ -187,8 +188,8 @@ watch(showPreview, () => defaultStore.set('showPreview', showPreview.value));
const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction); const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction);
watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value)); watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value));
const cw = ref<string | null>(props.initialCw ?? null); const cw = ref<string | null>(props.initialCw ?? null);
const localOnly = ref<boolean>(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly); const localOnly = ref(props.initialLocalOnly ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly));
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof Misskey.noteVisibilities[number]); const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility));
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]); const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
if (props.initialVisibleUsers) { if (props.initialVisibleUsers) {
props.initialVisibleUsers.forEach(pushVisibleUser); props.initialVisibleUsers.forEach(pushVisibleUser);
@ -524,6 +525,9 @@ async function toggleLocalOnly() {
} }
localOnly.value = !localOnly.value; localOnly.value = !localOnly.value;
if (defaultStore.state.rememberNoteVisibility) {
defaultStore.set('localOnly', localOnly.value);
}
} }
async function toggleReactionAcceptance() { async function toggleReactionAcceptance() {

View file

@ -15,7 +15,7 @@ import * as Misskey from 'misskey-js';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import MkPostForm from '@/components/MkPostForm.vue'; import MkPostForm from '@/components/MkPostForm.vue';
const props = defineProps<{ const props = withDefaults(defineProps<{
reply?: Misskey.entities.Note; reply?: Misskey.entities.Note;
renote?: Misskey.entities.Note; renote?: Misskey.entities.Note;
channel?: any; // TODO channel?: any; // TODO
@ -32,7 +32,9 @@ const props = defineProps<{
fixed?: boolean; fixed?: boolean;
autofocus?: boolean; autofocus?: boolean;
editId?: Misskey.entities.Note["id"]; editId?: Misskey.entities.Note["id"];
}>(); }>(), {
initialLocalOnly: undefined,
});
const emit = defineEmits<{ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;

View file

@ -51,13 +51,16 @@ export const Empty = {
expect(buttons.at(-1)).toBeEnabled(); expect(buttons.at(-1)).toBeEnabled();
}, },
args: { args: {
// @ts-expect-error serverRules is for test
serverRules: [], serverRules: [],
tosUrl: null, tosUrl: null,
}, },
decorators: [ decorators: [
(_, context) => ({ (_, context) => ({
setup() { setup() {
// @ts-expect-error serverRules is for test
instance.serverRules = context.args.serverRules; instance.serverRules = context.args.serverRules;
// @ts-expect-error tosUrl is for test
instance.tosUrl = context.args.tosUrl; instance.tosUrl = context.args.tosUrl;
onBeforeUnmount(() => { onBeforeUnmount(() => {
// FIXME: 呼び出されない // FIXME: 呼び出されない
@ -76,6 +79,7 @@ export const ServerRulesOnly = {
...Empty, ...Empty,
args: { args: {
...Empty.args, ...Empty.args,
// @ts-expect-error serverRules is for test
serverRules: [ serverRules: [
'ルール', 'ルール',
], ],
@ -85,6 +89,7 @@ export const TOSOnly = {
...Empty, ...Empty,
args: { args: {
...Empty.args, ...Empty.args,
// @ts-expect-error tosUrl is for test
tosUrl: 'https://example.com/tos', tosUrl: 'https://example.com/tos',
}, },
} satisfies StoryObj<typeof MkSignupServerRules>; } satisfies StoryObj<typeof MkSignupServerRules>;
@ -92,6 +97,7 @@ export const ServerRulesAndTOS = {
...Empty, ...Empty,
args: { args: {
...Empty.args, ...Empty.args,
// @ts-expect-error serverRules is for test
serverRules: ServerRulesOnly.args.serverRules, serverRules: ServerRulesOnly.args.serverRules,
tosUrl: TOSOnly.args.tosUrl, tosUrl: TOSOnly.args.tosUrl,
}, },

View file

@ -4,19 +4,19 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div v-if="meta" :class="$style.root"> <div v-if="instance" :class="$style.root">
<div :class="[$style.main, $style.panel]"> <div :class="[$style.main, $style.panel]">
<img :src="instance.iconUrl || '/apple-touch-icon.png'" alt="" :class="$style.mainIcon"/> <img :src="instance.iconUrl || '/apple-touch-icon.png'" alt="" :class="$style.mainIcon"/>
<button class="_button _acrylic" :class="$style.mainMenu" @click="showMenu"><i class="ph-dots-three ph-bold ph-lg"></i></button> <button class="_button _acrylic" :class="$style.mainMenu" @click="showMenu"><i class="ph-dots-three ph-bold ph-lg"></i></button>
<div :class="$style.mainFg"> <div :class="$style.mainFg">
<h1 :class="$style.mainTitle"> <h1 :class="$style.mainTitle">
<!-- 背景色によってはロゴが見えなくなるのでとりあえず無効に --> <!-- 背景色によってはロゴが見えなくなるのでとりあえず無効に -->
<!-- <img class="logo" v-if="meta.logoImageUrl" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> --> <!-- <img class="logo" v-if="instance.logoImageUrl" :src="instance.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> -->
<span>{{ instanceName }}</span> <span>{{ instanceName }}</span>
</h1> </h1>
<div :class="$style.mainAbout"> <div :class="$style.mainAbout">
<!-- eslint-disable-next-line vue/no-v-html --> <!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="sanitizeHtml(meta.description) || i18n.ts.headlineMisskey"></div> <div v-html="sanitizeHtml(instance.description) || i18n.ts.headlineMisskey"></div>
</div> </div>
<div v-if="instance.disableRegistration" :class="$style.mainWarn"> <div v-if="instance.disableRegistration" :class="$style.mainWarn">
<MkInfo warn>{{ i18n.ts.invitationRequiredToRegister }}</MkInfo> <MkInfo warn>{{ i18n.ts.invitationRequiredToRegister }}</MkInfo>
@ -69,14 +69,10 @@ import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import MkNumber from '@/components/MkNumber.vue'; import MkNumber from '@/components/MkNumber.vue';
import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue'; import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue';
import { openInstanceMenu } from '@/ui/_common_/common';
const meta = ref<Misskey.entities.MetaResponse | null>(null);
const stats = ref<Misskey.entities.StatsResponse | null>(null); const stats = ref<Misskey.entities.StatsResponse | null>(null);
misskeyApi('meta', { detail: true }).then(_meta => {
meta.value = _meta;
});
misskeyApi('stats', {}).then((res) => { misskeyApi('stats', {}).then((res) => {
stats.value = res; stats.value = res;
}); });
@ -94,49 +90,7 @@ function signup() {
} }
function showMenu(ev) { function showMenu(ev) {
os.popupMenu([{ openInstanceMenu(ev);
text: i18n.ts.instanceInfo,
icon: 'ph-info ph-bold ph-lg',
action: () => {
os.pageWindow('/about');
},
}, {
text: i18n.ts.aboutMisskey,
icon: 'sk-icons sk-shark ph-bold',
action: () => {
os.pageWindow('/about-sharkey');
},
}, { type: 'divider' }, (instance.impressumUrl) ? {
text: i18n.ts.impressum,
icon: 'ph-newspaper-clipping ph-bold ph-lg',
action: () => {
window.open(instance.impressumUrl!, '_blank', 'noopener');
},
} : undefined, (instance.tosUrl) ? {
text: i18n.ts.termsOfService,
icon: 'ph-notebook ph-bold ph-lg',
action: () => {
window.open(instance.tosUrl!, '_blank', 'noopener');
},
} : undefined, (instance.privacyPolicyUrl) ? {
text: i18n.ts.privacyPolicy,
icon: 'ph-shield ph-bold ph-lg',
action: () => {
window.open(instance.privacyPolicyUrl!, '_blank', 'noopener');
},
} : undefined, (instance.donationUrl) ? {
text: i18n.ts.donation,
icon: 'ph-hand-coins ph-bold ph-lg',
action: () => {
window.open(instance.donationUrl, '_blank', 'noopener');
},
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl && !instance.donationUrl) ? undefined : { type: 'divider' }, {
text: i18n.ts.help,
icon: 'ph-question ph-bold ph-lg',
action: () => {
window.open('https://misskey-hub.net/docs/for-users/', '_blank', 'noopener');
},
}], ev.currentTarget ?? ev.target);
} }
function exploreOtherServers() { function exploreOtherServers() {

View file

@ -9,8 +9,12 @@ SPDX-License-Identifier: AGPL-3.0-only
</a> </a>
</template> </template>
<script lang="ts">
export type MkABehavior = 'window' | 'browser' | null;
</script>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, shallowRef } from 'vue'; import { computed, inject, shallowRef } from 'vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js'; import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import { url } from '@/config.js'; import { url } from '@/config.js';
@ -20,12 +24,14 @@ import { useRouter } from '@/router/supplier.js';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
to: string; to: string;
activeClass?: null | string; activeClass?: null | string;
behavior?: null | 'window' | 'browser'; behavior?: MkABehavior;
}>(), { }>(), {
activeClass: null, activeClass: null,
behavior: null, behavior: null,
}); });
const behavior = props.behavior ?? inject<MkABehavior>('linkNavigationBehavior', null);
const el = shallowRef<HTMLElement>(); const el = shallowRef<HTMLElement>();
defineExpose({ $el: el }); defineExpose({ $el: el });
@ -80,15 +86,13 @@ function openWindow() {
} }
function nav(ev: MouseEvent) { function nav(ev: MouseEvent) {
if (props.behavior === 'browser') { if (behavior === 'browser') {
location.href = props.to; location.href = props.to;
return; return;
} }
if (props.behavior) { if (behavior === 'window') {
if (props.behavior === 'window') { return openWindow();
return openWindow();
}
} }
if (ev.shiftKey) { if (ev.shiftKey) {

View file

@ -4,8 +4,10 @@
*/ */
/* eslint-disable @typescript-eslint/explicit-function-return-type */ /* eslint-disable @typescript-eslint/explicit-function-return-type */
import { expect, userEvent, waitFor, within } from '@storybook/test';
import { StoryObj } from '@storybook/vue3'; import { StoryObj } from '@storybook/vue3';
import MkAd from './MkAd.vue'; import MkAd from './MkAd.vue';
import { i18n } from '@/i18n.js';
let lock: Promise<undefined> | undefined; let lock: Promise<undefined> | undefined;
@ -30,7 +32,6 @@ const common = {
template: '<MkAd v-bind="props" />', template: '<MkAd v-bind="props" />',
}; };
}, },
/* FIXME: disabled because it still didnt pass after applying #11267
async play({ canvasElement, args }) { async play({ canvasElement, args }) {
if (lock) { if (lock) {
console.warn('This test is unexpectedly running twice in parallel, fix it!'); console.warn('This test is unexpectedly running twice in parallel, fix it!');
@ -44,7 +45,7 @@ const common = {
try { try {
const canvas = within(canvasElement); const canvas = within(canvasElement);
const a = canvas.getByRole<HTMLAnchorElement>('link'); const a = canvas.getByRole<HTMLAnchorElement>('link');
await expect(a.href).toMatch(/^https?:\/\/.*#test$/); // await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
const img = within(a).getByRole('img'); const img = within(a).getByRole('img');
await expect(img).toBeInTheDocument(); await expect(img).toBeInTheDocument();
let buttons = canvas.getAllByRole<HTMLButtonElement>('button'); let buttons = canvas.getAllByRole<HTMLButtonElement>('button');
@ -52,13 +53,14 @@ const common = {
const i = buttons[0]; const i = buttons[0];
await expect(i).toBeInTheDocument(); await expect(i).toBeInTheDocument();
await userEvent.click(i); await userEvent.click(i);
await waitFor(() => expect(canvasElement).toHaveTextContent(i18n.ts._ad.back)); // await expect(canvasElement).toHaveTextContent(i18n.ts._ad.back);
await expect(a).not.toBeInTheDocument(); await expect(a).not.toBeInTheDocument();
await expect(i).not.toBeInTheDocument(); await expect(i).not.toBeInTheDocument();
buttons = canvas.getAllByRole<HTMLButtonElement>('button'); buttons = canvas.getAllByRole<HTMLButtonElement>('button');
await expect(buttons).toHaveLength(args.__hasReduce ? 2 : 1); const hasReduceFrequency = args.specify?.ratio !== 0;
const reduce = args.__hasReduce ? buttons[0] : null; await expect(buttons).toHaveLength(hasReduceFrequency ? 2 : 1);
const back = buttons[args.__hasReduce ? 1 : 0]; const reduce = hasReduceFrequency ? buttons[0] : null;
const back = buttons[hasReduceFrequency ? 1 : 0];
if (reduce) { if (reduce) {
await expect(reduce).toBeInTheDocument(); await expect(reduce).toBeInTheDocument();
await expect(reduce).toHaveTextContent(i18n.ts._ad.reduceFrequencyOfThisAd); await expect(reduce).toHaveTextContent(i18n.ts._ad.reduceFrequencyOfThisAd);
@ -80,15 +82,16 @@ const common = {
lock = undefined; lock = undefined;
} }
}, },
*/
args: { args: {
prefer: [], prefer: [],
specify: { specify: {
id: 'someadid', id: 'someadid',
radio: 1, ratio: 1,
url: '#test', url: '#test',
place: '',
imageUrl: '',
dayOfWeek: 7,
}, },
__hasReduce: true,
}, },
parameters: { parameters: {
layout: 'centered', layout: 'centered',
@ -138,6 +141,5 @@ export const ZeroRatio = {
...Square.args.specify, ...Square.args.specify,
ratio: 0, ratio: 0,
}, },
__hasReduce: false,
}, },
} satisfies StoryObj<typeof MkAd>; } satisfies StoryObj<typeof MkAd>;

View file

@ -33,7 +33,7 @@ const common = {
}, },
decorators: [ decorators: [
(Story, context) => ({ (Story, context) => ({
// eslint-disable-next-line quotes // @ts-expect-error size is for test
template: `<div :style="{ display: 'grid', width: '${context.args.size}px', height: '${context.args.size}px' }"><story/></div>`, template: `<div :style="{ display: 'grid', width: '${context.args.size}px', height: '${context.args.size}px' }"><story/></div>`,
}), }),
], ],
@ -45,6 +45,7 @@ export const ProfilePage = {
...common, ...common,
args: { args: {
...common.args, ...common.args,
// @ts-expect-error size is for test
size: 120, size: 120,
indicator: true, indicator: true,
}, },

View file

@ -28,6 +28,7 @@ export const Default = {
}; };
}, },
args: { args: {
// @ts-expect-error text is for test
text: 'This is a condensed line.', text: 'This is a condensed line.',
}, },
parameters: { parameters: {
@ -41,4 +42,5 @@ export const ContainerIs100px = {
template: '<div style="width: 100px;"><story/></div>', template: '<div style="width: 100px;"><story/></div>',
}), }),
], ],
// @ts-expect-error text is for test
} satisfies StoryObj<typeof MkCondensedLine>; } satisfies StoryObj<typeof MkCondensedLine>;

View file

@ -3,8 +3,11 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { Meta } from '@storybook/vue3';
import MkError from './MkError.vue';
export const argTypes = { export const argTypes = {
retry: { onRetry: {
action: 'retry', action: 'retry',
}, },
}; } satisfies Meta<typeof MkError>['argTypes'];

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { VNode, h, defineAsyncComponent, SetupContext } from 'vue'; import { VNode, h, defineAsyncComponent, SetupContext, provide } from 'vue';
import * as mfm from '@transfem-org/sfm-js'; import * as mfm from '@transfem-org/sfm-js';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkUrl from '@/components/global/MkUrl.vue'; import MkUrl from '@/components/global/MkUrl.vue';
@ -16,7 +16,7 @@ import MkCode from '@/components/MkCode.vue';
import MkCodeInline from '@/components/MkCodeInline.vue'; import MkCodeInline from '@/components/MkCodeInline.vue';
import MkGoogle from '@/components/MkGoogle.vue'; import MkGoogle from '@/components/MkGoogle.vue';
import MkSparkle from '@/components/MkSparkle.vue'; import MkSparkle from '@/components/MkSparkle.vue';
import MkA from '@/components/global/MkA.vue'; import MkA, { MkABehavior } from '@/components/global/MkA.vue';
import { host } from '@/config.js'; import { host } from '@/config.js';
import { defaultStore } from '@/store.js'; import { defaultStore } from '@/store.js';
import { nyaize as doNyaize } from '@/scripts/nyaize.js'; import { nyaize as doNyaize } from '@/scripts/nyaize.js';
@ -44,6 +44,7 @@ type MfmProps = {
enableEmojiMenu?: boolean; enableEmojiMenu?: boolean;
enableEmojiMenuReaction?: boolean; enableEmojiMenuReaction?: boolean;
isAnim?: boolean; isAnim?: boolean;
linkNavigationBehavior?: MkABehavior;
}; };
type MfmEvents = { type MfmEvents = {
@ -52,6 +53,8 @@ type MfmEvents = {
// eslint-disable-next-line import/no-default-export // eslint-disable-next-line import/no-default-export
export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) { export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEvents>['emit'] }) {
provide('linkNavigationBehavior', props.linkNavigationBehavior);
const isNote = props.isNote ?? true; const isNote = props.isNote ?? true;
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat ? props.author.speakAsCat : false : false : false; const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat ? props.author.speakAsCat : false : false : false;

View file

@ -33,7 +33,6 @@ export const Empty = {
await waitFor(async () => await wait); await waitFor(async () => await wait);
}, },
args: { args: {
static: true,
tabs: [], tabs: [],
}, },
parameters: { parameters: {
@ -71,8 +70,8 @@ export const IconOnly = {
...Icon.args, ...Icon.args,
tabs: [ tabs: [
{ {
...Icon.args.tabs[0], key: Icon.args.tabs[0].key,
title: undefined, icon: Icon.args.tabs[0].icon,
iconOnly: true, iconOnly: true,
}, },
], ],

View file

@ -38,7 +38,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts"> <script lang="ts">
export type Tab = { export type Tab = {
key: string; key: string;
title: string;
onClick?: (ev: MouseEvent) => void; onClick?: (ev: MouseEvent) => void;
} & ( } & (
| { | {

View file

@ -60,7 +60,7 @@ export const RelativeFuture = {
export const AbsoluteFuture = { export const AbsoluteFuture = {
...Empty, ...Empty,
async play({ canvasElement, args }) { async play({ canvasElement, args }) {
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time)); await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
}, },
args: { args: {
...Empty.args, ...Empty.args,
@ -97,7 +97,7 @@ export const RelativeNow = {
export const AbsoluteNow = { export const AbsoluteNow = {
...Empty, ...Empty,
async play({ canvasElement, args }) { async play({ canvasElement, args }) {
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time)); await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
}, },
args: { args: {
...Empty.args, ...Empty.args,
@ -136,7 +136,7 @@ export const RelativeOneHourAgo = {
export const AbsoluteOneHourAgo = { export const AbsoluteOneHourAgo = {
...Empty, ...Empty,
async play({ canvasElement, args }) { async play({ canvasElement, args }) {
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time)); await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
}, },
args: { args: {
...Empty.args, ...Empty.args,
@ -175,7 +175,7 @@ export const RelativeOneDayAgo = {
export const AbsoluteOneDayAgo = { export const AbsoluteOneDayAgo = {
...Empty, ...Empty,
async play({ canvasElement, args }) { async play({ canvasElement, args }) {
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time)); await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
}, },
args: { args: {
...Empty.args, ...Empty.args,
@ -214,7 +214,7 @@ export const RelativeOneWeekAgo = {
export const AbsoluteOneWeekAgo = { export const AbsoluteOneWeekAgo = {
...Empty, ...Empty,
async play({ canvasElement, args }) { async play({ canvasElement, args }) {
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time)); await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
}, },
args: { args: {
...Empty.args, ...Empty.args,
@ -253,7 +253,7 @@ export const RelativeOneMonthAgo = {
export const AbsoluteOneMonthAgo = { export const AbsoluteOneMonthAgo = {
...Empty, ...Empty,
async play({ canvasElement, args }) { async play({ canvasElement, args }) {
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time)); await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
}, },
args: { args: {
...Empty.args, ...Empty.args,
@ -292,7 +292,7 @@ export const RelativeOneYearAgo = {
export const AbsoluteOneYearAgo = { export const AbsoluteOneYearAgo = {
...Empty, ...Empty,
async play({ canvasElement, args }) { async play({ canvasElement, args }) {
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time)); await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
}, },
args: { args: {
...Empty.args, ...Empty.args,

View file

@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<component <component
:is="self ? 'MkA' : 'a'" ref="el" :class="$style.root" class="_link" :[attr]="self ? props.url.substring(local.length) : props.url" :rel="rel ?? 'nofollow noopener'" :target="target" :is="self ? 'MkA' : 'a'" ref="el" :class="$style.root" class="_link" :[attr]="self ? props.url.substring(local.length) : props.url" :rel="rel ?? 'nofollow noopener'" :target="target"
:behavior="props.navigationBehavior"
@contextmenu.stop="() => {}" @contextmenu.stop="() => {}"
@click.stop @click.stop
> >
@ -32,11 +33,13 @@ import * as os from '@/os.js';
import { useTooltip } from '@/scripts/use-tooltip.js'; import { useTooltip } from '@/scripts/use-tooltip.js';
import { safeURIDecode } from '@/scripts/safe-uri-decode.js'; import { safeURIDecode } from '@/scripts/safe-uri-decode.js';
import { isEnabledUrlPreview } from '@/instance.js'; import { isEnabledUrlPreview } from '@/instance.js';
import { MkABehavior } from '@/components/global/MkA.vue';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
url: string; url: string;
rel?: string; rel?: string;
showUrlPreview?: boolean; showUrlPreview?: boolean;
navigationBehavior?: MkABehavior;
}>(), { }>(), {
showUrlPreview: true, showUrlPreview: true,
}); });

View file

@ -30,7 +30,7 @@ export const Default = {
}; };
}, },
async play({ canvasElement }) { async play({ canvasElement }) {
await expect(canvasElement).toHaveTextContent(userDetailed().name); await expect(canvasElement).toHaveTextContent(userDetailed().name as string);
}, },
args: { args: {
user: userDetailed(), user: userDetailed(),

View file

@ -28,7 +28,7 @@ if (providedAt > cachedAt) {
// TODO: instanceをリアクティブにするかは再考の余地あり // TODO: instanceをリアクティブにするかは再考の余地あり
export const instance: Misskey.entities.MetaResponse = reactive(cachedMeta ?? {}); export const instance: Misskey.entities.MetaDetailed = reactive(cachedMeta ?? {});
export const serverErrorImageUrl = computed(() => instance.serverErrorImageUrl ?? DEFAULT_SERVER_ERROR_IMAGE_URL); export const serverErrorImageUrl = computed(() => instance.serverErrorImageUrl ?? DEFAULT_SERVER_ERROR_IMAGE_URL);
@ -38,17 +38,17 @@ export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFA
export const isEnabledUrlPreview = computed(() => instance.enableUrlPreview ?? true); export const isEnabledUrlPreview = computed(() => instance.enableUrlPreview ?? true);
export async function fetchInstance(force = false): Promise<void> { export async function fetchInstance(force = false): Promise<Misskey.entities.MetaDetailed> {
if (!force) { if (!force) {
const cachedAt = miLocalStorage.getItem('instanceCachedAt') ? parseInt(miLocalStorage.getItem('instanceCachedAt')!) : 0; const cachedAt = miLocalStorage.getItem('instanceCachedAt') ? parseInt(miLocalStorage.getItem('instanceCachedAt')!) : 0;
if (Date.now() - cachedAt < 1000 * 60 * 60) { if (Date.now() - cachedAt < 1000 * 60 * 60) {
return; return instance;
} }
} }
const meta = await misskeyApi('meta', { const meta = await misskeyApi('meta', {
detail: false, detail: true,
}); });
for (const [k, v] of Object.entries(meta)) { for (const [k, v] of Object.entries(meta)) {
@ -57,4 +57,6 @@ export async function fetchInstance(force = false): Promise<void> {
miLocalStorage.setItem('instance', JSON.stringify(instance)); miLocalStorage.setItem('instance', JSON.stringify(instance));
miLocalStorage.setItem('instanceCachedAt', Date.now().toString()); miLocalStorage.setItem('instanceCachedAt', Date.now().toString());
return instance;
} }

View file

@ -432,7 +432,7 @@ async function assignRole() {
if (canceled) return; if (canceled) return;
const { canceled: canceled2, result: period } = await os.select({ const { canceled: canceled2, result: period } = await os.select({
title: i18n.ts.period, title: i18n.ts.period + ': ' + roles.find(r => r.id === roleId)!.name,
items: [{ items: [{
value: 'indefinitely', text: i18n.ts.indefinitely, value: 'indefinitely', text: i18n.ts.indefinitely,
}, { }, {

View file

@ -119,7 +119,7 @@ async function assign() {
const user = await os.selectUser({ includeSelf: true }); const user = await os.selectUser({ includeSelf: true });
const { canceled: canceled2, result: period } = await os.select({ const { canceled: canceled2, result: period } = await os.select({
title: i18n.ts.period, title: i18n.ts.period + ': ' + role.name,
items: [{ items: [{
value: 'indefinitely', text: i18n.ts.indefinitely, value: 'indefinitely', text: i18n.ts.indefinitely,
}, { }, {

View file

@ -0,0 +1,24 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
<template #header><MkPageHeader/></template>
<MkSpacer :contentMax="600" :marginMin="20">
<div>{{ instance.maintainerEmail }}</div>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { instance } from '@/instance.js';
definePageMetadata(() => ({
title: i18n.ts.inquiry,
icon: 'ti ti-help-circle',
}));
</script>

View file

@ -163,11 +163,11 @@ var cursor = 0
text: "←" text: "←"
disabled: !(results.len > 1 && (results.len - cursor) > 1) disabled: !(results.len > 1 && (results.len - cursor) > 1)
onClick: back onClick: back
} { }, {
text: "→" text: "→"
disabled: !(results.len > 1 && cursor > 0) disabled: !(results.len > 1 && cursor > 0)
onClick: forward onClick: forward
} { }, {
text: "引き直す" text: "引き直す"
onClick: do onClick: do
}] }]
@ -196,17 +196,17 @@ let qas = [{
choices: ['シドニー', 'キャンベラ', 'メルボルン'] choices: ['シドニー', 'キャンベラ', 'メルボルン']
a: 'キャンベラ' a: 'キャンベラ'
aDescription: '最大の都市はシドニーですが首都はキャンベラです。' aDescription: '最大の都市はシドニーですが首都はキャンベラです。'
} { }, {
q: '国土面積2番目の国は' q: '国土面積2番目の国は'
choices: ['カナダ', 'アメリカ', '中国'] choices: ['カナダ', 'アメリカ', '中国']
a: 'カナダ' a: 'カナダ'
aDescription: '大きい順にロシア、カナダ、アメリカ、中国です。' aDescription: '大きい順にロシア、カナダ、アメリカ、中国です。'
} { }, {
q: '二重内陸国ではないのは?' q: '二重内陸国ではないのは?'
choices: ['リヒテンシュタイン', 'ウズベキスタン', 'レソト'] choices: ['リヒテンシュタイン', 'ウズベキスタン', 'レソト']
a: 'レソト' a: 'レソト'
aDescription: 'レソトは(一重)内陸国です。' aDescription: 'レソトは(一重)内陸国です。'
} { }, {
q: '閘門がない運河は?' q: '閘門がない運河は?'
choices: ['キール運河', 'スエズ運河', 'パナマ運河'] choices: ['キール運河', 'スエズ運河', 'パナマ運河']
a: 'スエズ運河' a: 'スエズ運河'
@ -244,9 +244,9 @@ each (let qa, qas) {
}) })
Ui:C:container({ Ui:C:container({
children: [] children: []
} \`{qa.id}:a\`) }, \`{qa.id}:a\`)
] ]
} qa.id)) }, qa.id))
} }
@finish() { @finish() {

View file

@ -15,11 +15,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkAsUi v-if="root" :component="root" :components="components"/> <MkAsUi v-if="root" :component="root" :components="components"/>
</div> </div>
<div class="actions _panel"> <div class="actions _panel">
<MkButton v-if="flash.isLiked" v-tooltip="i18n.ts.unlike" asLike class="button" rounded primary @click="unlike()"><i class="ph-heart ph-bold ph-lg"></i><span v-if="flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton> <div class="items">
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ph-heart ph-bold ph-lg"></i><span v-if="flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton> <MkButton v-tooltip="i18n.ts.reload" class="button" rounded @click="reset"><i class="ti ti-reload"></i></MkButton>
<MkButton v-tooltip="i18n.ts.shareWithNote" class="button" rounded @click="shareWithNote"><i class="ph-repeat ph-bold ph-lg ti-fw"></i></MkButton> </div>
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ph-share-network ph-bold ph-lg ti-fw"></i></MkButton> <div class="items">
<MkButton v-if="isSupportShare()" v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ph-share-network ph-bold ph-lg ti-fw"></i></MkButton> <MkButton v-if="flash.isLiked" v-tooltip="i18n.ts.unlike" asLike class="button" rounded primary @click="unlike()"><i class="ph-heart ph-bold ph-lg"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ph-heart ph-bold ph-lg"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ph-link ph-bold ph-lg ti-fw"></i></MkButton>
<MkButton v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ph-share-network ph-bold ph-lg ti-fw"></i></MkButton>
</div>
</div> </div>
</div> </div>
<div v-else :class="$style.ready"> <div v-else :class="$style.ready">
@ -49,7 +53,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkA v-if="$i && $i.id === flash.userId" :to="`/play/${flash.id}/edit`" style="color: var(--accent);">{{ i18n.ts._play.editThisPage }}</MkA> <MkA v-if="$i && $i.id === flash.userId" :to="`/play/${flash.id}/edit`" style="color: var(--accent);">{{ i18n.ts._play.editThisPage }}</MkA>
<MkAd :prefer="['horizontal', 'horizontal-big']"/> <MkAd :prefer="['horizontal', 'horizontal-big']"/>
</div> </div>
<MkError v-else-if="error" @retry="fetchPage()"/> <MkError v-else-if="error" @retry="fetchFlash()"/>
<MkLoading v-else/> <MkLoading v-else/>
</Transition> </Transition>
</MkSpacer> </MkSpacer>
@ -94,12 +98,33 @@ function fetchFlash() {
}); });
} }
function share(ev: MouseEvent) {
if (!flash.value) return;
os.popupMenu([
{
text: i18n.ts.shareWithNote,
icon: 'ph-repeat ph-bold ph-lg ti-fw',
action: shareWithNote,
},
...(isSupportShare() ? [{
text: i18n.ts.share,
icon: 'ph-share-network ph-bold ph-lg ti-fw',
action: shareWithNavigator,
}] : []),
], ev.currentTarget ?? ev.target);
}
function copyLink() { function copyLink() {
if (!flash.value) return;
copyToClipboard(`${url}/play/${flash.value.id}`); copyToClipboard(`${url}/play/${flash.value.id}`);
os.success(); os.success();
} }
function share() { function shareWithNavigator() {
if (!flash.value) return;
navigator.share({ navigator.share({
title: flash.value.title, title: flash.value.title,
text: flash.value.summary, text: flash.value.summary,
@ -108,21 +133,28 @@ function share() {
} }
function shareWithNote() { function shareWithNote() {
if (!flash.value) return;
os.post({ os.post({
initialText: `${flash.value.title} ${url}/play/${flash.value.id}`, initialText: `${flash.value.title}\n${url}/play/${flash.value.id}`,
instant: true,
}); });
} }
function like() { function like() {
if (!flash.value) return;
os.apiWithDialog('flash/like', { os.apiWithDialog('flash/like', {
flashId: flash.value.id, flashId: flash.value.id,
}).then(() => { }).then(() => {
flash.value.isLiked = true; flash.value!.isLiked = true;
flash.value.likedCount++; flash.value!.likedCount++;
}); });
} }
async function unlike() { async function unlike() {
if (!flash.value) return;
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'warning', type: 'warning',
text: i18n.ts.unlikeConfirm, text: i18n.ts.unlikeConfirm,
@ -131,8 +163,8 @@ async function unlike() {
os.apiWithDialog('flash/unlike', { os.apiWithDialog('flash/unlike', {
flashId: flash.value.id, flashId: flash.value.id,
}).then(() => { }).then(() => {
flash.value.isLiked = false; flash.value!.isLiked = false;
flash.value.likedCount--; flash.value!.likedCount--;
}); });
} }
@ -152,6 +184,7 @@ function start() {
async function run() { async function run() {
if (aiscript.value) aiscript.value.abort(); if (aiscript.value) aiscript.value.abort();
if (!flash.value) return;
aiscript.value = new Interpreter({ aiscript.value = new Interpreter({
...createAiScriptEnv({ ...createAiScriptEnv({
@ -193,12 +226,17 @@ async function run() {
} }
} }
onDeactivated(() => { function reset() {
if (aiscript.value) aiscript.value.abort(); if (aiscript.value) aiscript.value.abort();
started.value = false;
}
onDeactivated(() => {
reset();
}); });
onUnmounted(() => { onUnmounted(() => {
if (aiscript.value) aiscript.value.abort(); reset();
}); });
const headerActions = computed(() => []); const headerActions = computed(() => []);
@ -265,11 +303,19 @@ definePageMetadata(() => ({
} }
> .actions { > .actions {
display: flex;
justify-content: center;
gap: 12px;
margin-top: 16px; margin-top: 16px;
padding: 16px;
> .items {
display: flex;
justify-content: center;
gap: 12px;
padding: 16px;
border-bottom: 1px solid var(--divider);
&:last-child {
border-bottom: none;
}
}
} }
} }
} }

View file

@ -151,6 +151,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
import { deepClone } from '@/scripts/clone.js'; import { deepClone } from '@/scripts/clone.js';
import { useInterval } from '@/scripts/use-interval.js'; import { useInterval } from '@/scripts/use-interval.js';
import { signinRequired } from '@/account.js'; import { signinRequired } from '@/account.js';
import { url } from '@/config.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
import { userPage } from '@/filters/user.js'; import { userPage } from '@/filters/user.js';
@ -442,7 +443,7 @@ function autoplay() {
function share() { function share() {
os.post({ os.post({
initialText: `#MisskeyReversi ${location.href}`, initialText: `#MisskeyReversi\n${url}/reversi/g/${game.value.id}`,
instant: true, instant: true,
}); });
} }

View file

@ -42,11 +42,11 @@ import XTimeline from './welcome.timeline.vue';
import MarqueeText from '@/components/MkMarquee.vue'; import MarqueeText from '@/components/MkMarquee.vue';
import MkFeaturedPhotos from '@/components/MkFeaturedPhotos.vue'; import MkFeaturedPhotos from '@/components/MkFeaturedPhotos.vue';
import misskeysvg from '/client-assets/sharkey.svg'; import misskeysvg from '/client-assets/sharkey.svg';
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js'; import { misskeyApiGet } from '@/scripts/misskey-api.js';
import MkVisitorDashboard from '@/components/MkVisitorDashboard.vue'; import MkVisitorDashboard from '@/components/MkVisitorDashboard.vue';
import { getProxiedImageUrl } from '@/scripts/media-proxy.js'; import { getProxiedImageUrl } from '@/scripts/media-proxy.js';
import { instance as meta } from '@/instance.js';
const meta = ref<Misskey.entities.MetaResponse>();
const instances = ref<Misskey.entities.FederationInstance[]>(); const instances = ref<Misskey.entities.FederationInstance[]>();
function getInstanceIcon(instance: Misskey.entities.FederationInstance): string { function getInstanceIcon(instance: Misskey.entities.FederationInstance): string {
@ -56,10 +56,6 @@ function getInstanceIcon(instance: Misskey.entities.FederationInstance): string
return getProxiedImageUrl(instance.iconUrl, 'preview'); return getProxiedImageUrl(instance.iconUrl, 'preview');
} }
misskeyApi('meta', { detail: true }).then(_meta => {
meta.value = _meta;
});
misskeyApiGet('federation/instances', { misskeyApiGet('federation/instances', {
sort: '+pubSub', sort: '+pubSub',
limit: 20, limit: 20,

View file

@ -4,8 +4,8 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div v-if="meta"> <div v-if="instance">
<XSetup v-if="meta.requireSetup"/> <XSetup v-if="instance.requireSetup"/>
<XEntrance v-else/> <XEntrance v-else/>
</div> </div>
</template> </template>
@ -16,13 +16,13 @@ import * as Misskey from 'misskey-js';
import XSetup from './welcome.setup.vue'; import XSetup from './welcome.setup.vue';
import XEntrance from './welcome.entrance.a.vue'; import XEntrance from './welcome.entrance.a.vue';
import { instanceName } from '@/config.js'; import { instanceName } from '@/config.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
import { fetchInstance } from '@/instance.js';
const meta = ref<Misskey.entities.MetaResponse | null>(null); const instance = ref<Misskey.entities.MetaDetailed | null>(null);
misskeyApi('meta', { detail: true }).then(res => { fetchInstance(true).then((res) => {
meta.value = res; instance.value = res;
}); });
const headerActions = computed(() => []); const headerActions = computed(() => []);

View file

@ -197,6 +197,9 @@ const routes: RouteDef[] = [{
path: '/about', path: '/about',
component: page(() => import('@/pages/about.vue')), component: page(() => import('@/pages/about.vue')),
hash: 'initialTab', hash: 'initialTab',
}, {
path: '/contact',
component: page(() => import('@/pages/contact.vue')),
}, { }, {
path: '/about-sharkey', path: '/about-sharkey',
component: page(() => import('@/pages/about-sharkey.vue')), component: page(() => import('@/pages/about-sharkey.vue')),

View file

@ -6,6 +6,7 @@
import { utils, values } from '@syuilo/aiscript'; import { utils, values } from '@syuilo/aiscript';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import { ref, Ref } from 'vue'; import { ref, Ref } from 'vue';
import * as Misskey from 'misskey-js';
export type AsUiComponentBase = { export type AsUiComponentBase = {
id: string; id: string;
@ -115,23 +116,24 @@ export type AsUiFolder = AsUiComponentBase & {
opened?: boolean; opened?: boolean;
}; };
type PostFormPropsForAsUi = {
text: string;
cw?: string;
visibility?: (typeof Misskey.noteVisibilities)[number];
localOnly?: boolean;
};
export type AsUiPostFormButton = AsUiComponentBase & { export type AsUiPostFormButton = AsUiComponentBase & {
type: 'postFormButton'; type: 'postFormButton';
text?: string; text?: string;
primary?: boolean; primary?: boolean;
rounded?: boolean; rounded?: boolean;
form?: { form?: PostFormPropsForAsUi;
text: string;
cw?: string;
};
}; };
export type AsUiPostForm = AsUiComponentBase & { export type AsUiPostForm = AsUiComponentBase & {
type: 'postForm'; type: 'postForm';
form?: { form?: PostFormPropsForAsUi;
text: string;
cw?: string;
};
}; };
export type AsUiComponent = AsUiRoot | AsUiContainer | AsUiText | AsUiMfm | AsUiButton | AsUiButtons | AsUiSwitch | AsUiTextarea | AsUiTextInput | AsUiNumberInput | AsUiSelect | AsUiFolder | AsUiPostFormButton | AsUiPostForm; export type AsUiComponent = AsUiRoot | AsUiContainer | AsUiText | AsUiMfm | AsUiButton | AsUiButtons | AsUiSwitch | AsUiTextarea | AsUiTextInput | AsUiNumberInput | AsUiSelect | AsUiFolder | AsUiPostFormButton | AsUiPostForm;
@ -447,6 +449,24 @@ function getFolderOptions(def: values.Value | undefined): Omit<AsUiFolder, 'id'
}; };
} }
function getPostFormProps(form: values.VObj): PostFormPropsForAsUi {
const text = form.value.get('text');
utils.assertString(text);
const cw = form.value.get('cw');
if (cw) utils.assertString(cw);
const visibility = form.value.get('visibility');
if (visibility) utils.assertString(visibility);
const localOnly = form.value.get('localOnly');
if (localOnly) utils.assertBoolean(localOnly);
return {
text: text.value,
cw: cw?.value,
visibility: (visibility?.value && (Misskey.noteVisibilities as readonly string[]).includes(visibility.value)) ? visibility.value as typeof Misskey.noteVisibilities[number] : undefined,
localOnly: localOnly?.value,
};
}
function getPostFormButtonOptions(def: values.Value | undefined, call: (fn: values.VFn, args: values.Value[]) => Promise<values.Value>): Omit<AsUiPostFormButton, 'id' | 'type'> { function getPostFormButtonOptions(def: values.Value | undefined, call: (fn: values.VFn, args: values.Value[]) => Promise<values.Value>): Omit<AsUiPostFormButton, 'id' | 'type'> {
utils.assertObject(def); utils.assertObject(def);
@ -459,22 +479,11 @@ function getPostFormButtonOptions(def: values.Value | undefined, call: (fn: valu
const form = def.value.get('form'); const form = def.value.get('form');
if (form) utils.assertObject(form); if (form) utils.assertObject(form);
const getForm = () => {
const text = form!.value.get('text');
utils.assertString(text);
const cw = form!.value.get('cw');
if (cw) utils.assertString(cw);
return {
text: text.value,
cw: cw?.value,
};
};
return { return {
text: text?.value, text: text?.value,
primary: primary?.value, primary: primary?.value,
rounded: rounded?.value, rounded: rounded?.value,
form: form ? getForm() : { form: form ? getPostFormProps(form) : {
text: '', text: '',
}, },
}; };
@ -486,19 +495,8 @@ function getPostFormOptions(def: values.Value | undefined, call: (fn: values.VFn
const form = def.value.get('form'); const form = def.value.get('form');
if (form) utils.assertObject(form); if (form) utils.assertObject(form);
const getForm = () => {
const text = form!.value.get('text');
utils.assertString(text);
const cw = form!.value.get('cw');
if (cw) utils.assertString(cw);
return {
text: text.value,
cw: cw?.value,
};
};
return { return {
form: form ? getForm() : { form: form ? getPostFormProps(form) : {
text: '', text: '',
}, },
}; };

View file

@ -526,10 +526,9 @@ export function getNoteMenu(props: {
}; };
} }
type Visibility = 'public' | 'home' | 'followers' | 'specified'; type Visibility = (typeof Misskey.noteVisibilities)[number];
// defaultStore.state.visibilityがstringなためstringも受け付けている function smallerVisibility(a: Visibility, b: Visibility): Visibility {
function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility {
if (a === 'specified' || b === 'specified') return 'specified'; if (a === 'specified' || b === 'specified') return 'specified';
if (a === 'followers' || b === 'followers') return 'followers'; if (a === 'followers' || b === 'followers') return 'followers';
if (a === 'home' || b === 'home') return 'home'; if (a === 'home' || b === 'home') return 'home';

View file

@ -272,7 +272,7 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter
text: r.name, text: r.name,
action: async () => { action: async () => {
const { canceled, result: period } = await os.select({ const { canceled, result: period } = await os.select({
title: i18n.ts.period, title: i18n.ts.period + ': ' + r.name,
items: [{ items: [{
value: 'indefinitely', text: i18n.ts.indefinitely, value: 'indefinitely', text: i18n.ts.indefinitely,
}, { }, {

View file

@ -106,7 +106,7 @@ export const defaultStore = markRaw(new Storage('base', {
}, },
defaultNoteVisibility: { defaultNoteVisibility: {
where: 'account', where: 'account',
default: 'public', default: 'public' as (typeof Misskey.noteVisibilities)[number],
}, },
defaultNoteLocalOnly: { defaultNoteLocalOnly: {
where: 'account', where: 'account',
@ -178,7 +178,7 @@ export const defaultStore = markRaw(new Storage('base', {
}, },
visibility: { visibility: {
where: 'deviceAccount', where: 'deviceAccount',
default: 'public' as 'public' | 'home' | 'followers' | 'specified', default: 'public' as (typeof Misskey.noteVisibilities)[number],
}, },
localOnly: { localOnly: {
where: 'deviceAccount', where: 'deviceAccount',

View file

@ -79,7 +79,12 @@ export function openInstanceMenu(ev: MouseEvent) {
text: i18n.ts.tools, text: i18n.ts.tools,
icon: 'ph-toolbox ph-bold ph-lg', icon: 'ph-toolbox ph-bold ph-lg',
children: toolsMenuItems(), children: toolsMenuItems(),
}, { type: 'divider' }, (instance.impressumUrl) ? { }, { type: 'divider' }, {
type: 'link',
text: i18n.ts.inquiry,
icon: 'ph-question ph-bold ph-lg',
to: '/contact',
}, (instance.impressumUrl) ? {
text: i18n.ts.impressum, text: i18n.ts.impressum,
icon: 'ph-newspaper-clipping ph-bold ph-lg', icon: 'ph-newspaper-clipping ph-bold ph-lg',
action: () => { action: () => {
@ -104,8 +109,8 @@ export function openInstanceMenu(ev: MouseEvent) {
window.open(instance.donationUrl, '_blank', 'noopener'); window.open(instance.donationUrl, '_blank', 'noopener');
}, },
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl && !instance.donationUrl) ? undefined : { type: 'divider' }, { } : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl && !instance.donationUrl) ? undefined : { type: 'divider' }, {
text: i18n.ts.help, text: i18n.ts.document,
icon: 'ph-question ph-bold ph-lg', icon: 'ph-libghtbulb ph-bold ph-lg',
action: () => { action: () => {
window.open('https://misskey-hub.net/docs/for-users/', '_blank', 'noopener'); window.open('https://misskey-hub.net/docs/for-users/', '_blank', 'noopener');
}, },

View file

@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import MarqueeText from '@/components/MkMarquee.vue'; import MarqueeText from '@/components/MkMarquee.vue';
import { useInterval } from '@/scripts/use-interval.js'; import { useInterval } from '@/scripts/use-interval.js';
import { shuffle } from '@/scripts/shuffle.js'; import { shuffle } from '@/scripts/shuffle.js';
@ -42,13 +43,13 @@ const props = defineProps<{
refreshIntervalSec?: number; refreshIntervalSec?: number;
}>(); }>();
const items = ref([]); const items = ref<Misskey.entities.FetchRssResponse['items']>([]);
const fetching = ref(true); const fetching = ref(true);
const key = ref(0); const key = ref(0);
const tick = () => { const tick = () => {
window.fetch(`/api/fetch-rss?url=${props.url}`, {}).then(res => { window.fetch(`/api/fetch-rss?url=${props.url}`, {}).then(res => {
res.json().then(feed => { res.json().then((feed: Misskey.entities.FetchRssResponse) => {
if (props.shuffle) { if (props.shuffle) {
shuffle(feed.items); shuffle(feed.items);
} }

View file

@ -68,11 +68,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, provide, ref, computed } from 'vue'; import { onMounted, provide, ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import XCommon from './_common_/common.vue'; import XCommon from './_common_/common.vue';
import { instanceName } from '@/config.js'; import { instanceName } from '@/config.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import XSigninDialog from '@/components/MkSigninDialog.vue'; import XSigninDialog from '@/components/MkSigninDialog.vue';
import XSignupDialog from '@/components/MkSignupDialog.vue'; import XSignupDialog from '@/components/MkSignupDialog.vue';
@ -112,7 +110,6 @@ const isTimelineAvailable = ref(instance.policies?.ltlAvailable || instance.poli
const showMenu = ref(false); const showMenu = ref(false);
const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD); const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD);
const narrow = ref(window.innerWidth < 1280); const narrow = ref(window.innerWidth < 1280);
const meta = ref<Misskey.entities.MetaResponse>();
const keymap = computed(() => { const keymap = computed(() => {
return { return {
@ -126,10 +123,6 @@ const keymap = computed(() => {
}; };
}); });
misskeyApi('meta', { detail: true }).then(res => {
meta.value = res;
});
function signin() { function signin() {
os.popup(XSigninDialog, { os.popup(XSigninDialog, {
autoSet: true, autoSet: true,

View file

@ -24,6 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch, computed } from 'vue'; import { ref, watch, computed } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js'; import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import { GetFormResultType } from '@/scripts/form.js'; import { GetFormResultType } from '@/scripts/form.js';
import MkContainer from '@/components/MkContainer.vue'; import MkContainer from '@/components/MkContainer.vue';
@ -64,7 +65,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
emit, emit,
); );
const rawItems = ref([]); const rawItems = ref<Misskey.entities.FetchRssResponse['items']>([]);
const items = computed(() => rawItems.value.slice(0, widgetProps.maxEntries)); const items = computed(() => rawItems.value.slice(0, widgetProps.maxEntries));
const fetching = ref(true); const fetching = ref(true);
const fetchEndpoint = computed(() => { const fetchEndpoint = computed(() => {
@ -79,8 +80,8 @@ const tick = () => {
window.fetch(fetchEndpoint.value, {}) window.fetch(fetchEndpoint.value, {})
.then(res => res.json()) .then(res => res.json())
.then(feed => { .then((feed: Misskey.entities.FetchRssResponse) => {
rawItems.value = feed.items ?? []; rawItems.value = feed.items;
fetching.value = false; fetching.value = false;
}); });
}; };

View file

@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch, computed } from 'vue'; import { ref, watch, computed } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js'; import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import MarqueeText from '@/components/MkMarquee.vue'; import MarqueeText from '@/components/MkMarquee.vue';
import { GetFormResultType } from '@/scripts/form.js'; import { GetFormResultType } from '@/scripts/form.js';
@ -87,7 +88,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
emit, emit,
); );
const rawItems = ref([]); const rawItems = ref<Misskey.entities.FetchRssResponse['items']>([]);
const items = computed(() => { const items = computed(() => {
const newItems = rawItems.value.slice(0, widgetProps.maxEntries); const newItems = rawItems.value.slice(0, widgetProps.maxEntries);
if (widgetProps.shuffle) { if (widgetProps.shuffle) {
@ -110,8 +111,8 @@ const tick = () => {
window.fetch(fetchEndpoint.value, {}) window.fetch(fetchEndpoint.value, {})
.then(res => res.json()) .then(res => res.json())
.then(feed => { .then((feed: Misskey.entities.FetchRssResponse) => {
rawItems.value = feed.items ?? []; rawItems.value = feed.items;
fetching.value = false; fetching.value = false;
key.value++; key.value++;
}); });

View file

@ -52,6 +52,22 @@ const devConfig = {
'/_info_card_': httpUrl, '/_info_card_': httpUrl,
'/bios': httpUrl, '/bios': httpUrl,
'/cli': httpUrl, '/cli': httpUrl,
'/inbox': httpUrl,
'/notes': {
target: httpUrl,
headers: {
'Accept': 'application/activity+json',
},
},
'/users': {
target: httpUrl,
headers: {
'Accept': 'application/activity+json',
},
},
'/.well-known': {
target: httpUrl,
},
}, },
}, },
build: { build: {

View file

@ -1,7 +1,7 @@
{ {
"type": "module", "type": "module",
"name": "misskey-js", "name": "misskey-js",
"version": "2024.3.1", "version": "2024.5.0-beta.1",
"description": "Misskey SDK for JavaScript", "description": "Misskey SDK for JavaScript",
"main": "./built/index.js", "main": "./built/index.js",
"types": "./built/index.d.ts", "types": "./built/index.d.ts",
@ -33,13 +33,13 @@
"url": "git+https://github.com/misskey-dev/misskey.js.git" "url": "git+https://github.com/misskey-dev/misskey.js.git"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "7.39.1", "@microsoft/api-extractor": "7.43.1",
"@misskey-dev/eslint-plugin": "1.0.0", "@misskey-dev/eslint-plugin": "1.0.0",
"@swc/jest": "0.2.31", "@swc/jest": "0.2.36",
"@types/jest": "29.5.12", "@types/jest": "29.5.12",
"@types/node": "20.11.22", "@types/node": "20.12.7",
"@typescript-eslint/eslint-plugin": "7.1.0", "@typescript-eslint/eslint-plugin": "7.7.1",
"@typescript-eslint/parser": "7.1.0", "@typescript-eslint/parser": "7.7.1",
"eslint": "8.57.0", "eslint": "8.57.0",
"jest": "29.7.0", "jest": "29.7.0",
"jest-fetch-mock": "3.0.3", "jest-fetch-mock": "3.0.3",
@ -49,9 +49,9 @@
"nodemon": "3.1.0", "nodemon": "3.1.0",
"execa": "8.0.1", "execa": "8.0.1",
"tsd": "0.30.7", "tsd": "0.30.7",
"typescript": "5.3.3", "typescript": "5.4.5",
"esbuild": "0.19.11", "esbuild": "0.19.11",
"glob": "10.3.10" "glob": "10.3.12"
}, },
"files": [ "files": [
"built" "built"

View file

@ -26949,7 +26949,52 @@ export type operations = {
200: { 200: {
content: { content: {
'application/json': { 'application/json': {
items: Record<string, never>[]; image?: {
link?: string;
url: string;
title?: string;
};
paginationLinks?: {
self?: string;
first?: string;
next?: string;
last?: string;
prev?: string;
};
link?: string;
title?: string;
items: {
link?: string;
guid?: string;
title?: string;
pubDate?: string;
creator?: string;
summary?: string;
content?: string;
isoDate?: string;
categories?: string[];
contentSnippet?: string;
enclosure?: {
url: string;
length?: number;
type?: string;
};
}[];
feedUrl?: string;
description?: string;
itunes?: {
image?: string;
owner?: {
name?: string;
email?: string;
};
author?: string;
summary?: string;
explicit?: string;
categories?: string[];
keywords?: string[];
[key: string]: unknown;
};
}; };
}; };
}; };

View file

@ -9,18 +9,18 @@
"lint": "pnpm typecheck && pnpm eslint" "lint": "pnpm typecheck && pnpm eslint"
}, },
"dependencies": { "dependencies": {
"esbuild": "0.19.11", "esbuild": "0.20.2",
"idb-keyval": "6.2.1", "idb-keyval": "6.2.1",
"misskey-js": "workspace:*" "misskey-js": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0", "@misskey-dev/eslint-plugin": "1.0.0",
"@typescript-eslint/parser": "7.1.0", "@typescript-eslint/parser": "7.7.1",
"@typescript/lib-webworker": "npm:@types/serviceworker@0.0.67", "@typescript/lib-webworker": "npm:@types/serviceworker@0.0.67",
"eslint": "8.57.0", "eslint": "8.57.0",
"eslint-plugin-import": "2.29.1", "eslint-plugin-import": "2.29.1",
"nodemon": "3.1.0", "nodemon": "3.1.0",
"typescript": "5.3.3" "typescript": "5.4.5"
}, },
"type": "module" "type": "module"
} }

File diff suppressed because it is too large Load diff