Compare commits

..

15 Commits

Author SHA1 Message Date
07e2ab5d44
autogen: locale index & api types
Some checks failed
Publish Docker Image (Misskey) TeamCity build failed
2024-10-28 15:47:56 +09:00
かっこかり
ccff928964
🎨
https://github.com/misskey-dev/misskey/pull/14828 のデザイン修正
2024-10-28 15:39:09 +09:00
かっこかり
bc9ab4a191
enhance(frontend): 外部アプリ認証画面の改良 2024-10-28 15:38:59 +09:00
9c40d0edda
Merge upstream 2024-10-28 15:23:29 +09:00
dependabot[bot]
8c96cede66
chore(deps): bump actions/setup-node from 4.0.4 to 4.1.0 (MisskeyIO#780)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.0.4 to 4.1.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v4.0.4...v4.1.0)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-25 16:00:23 +09:00
あわわわとーにゅ
3d78015933
fix(announcement): 個別ユーザーへのお知らせ編集ダイアログでチュートリアル受講のパラメータが反映されない問題を修正 (MisskeyIO#779) 2024-10-24 11:29:22 +09:00
あわわわとーにゅ
7f9832164c
Bump up version to 2024.5.0-io.3d (MisskeyIO#777) 2024-10-23 06:55:41 +09:00
あわわわとーにゅ
f33e1b5e87
update deps (MisskeyIO#775) 2024-10-23 05:48:11 +09:00
あわわわとーにゅ
6e07857b1c
security(ghsa-gq5q-c77c-v236): Block recursive proxy (MisskeyIO#776)
[ghsa-gq5q-c77c-v236](https://github.com/misskey-dev/misskey/security/advisories/ghsa-gq5q-c77c-v236)

Co-authored-by: 饺子w (Yumechi) <35571479+eternal-flame-AD@users.noreply.github.com>
2024-10-23 04:03:23 +09:00
あわわわとーにゅ
30ad8544de
Bump up version to 2024.5.0-io.3c (MisskeyIO#772) 2024-10-21 10:54:18 +09:00
あわわわとーにゅ
bfc87ab415
update deps (MisskeyIO#770) 2024-10-21 10:53:59 +09:00
あわわわとーにゅ
e51b237c59
feat(frontend/reactions): リアクションのミュートで通知からもミュートされるように (MisskeyIO#771) 2024-10-21 09:34:33 +09:00
あわわわとーにゅ
ea6b9f40d2
fix(frontend/customemoji): リアクション以外の部分ではフォールバック画像にならないように (MisskeyIO#769) 2024-10-21 09:34:14 +09:00
riku6460
88912d0f8c
fix(frontend): Captcha のエラーハンドリングを修正 (MisskeyIO#768) 2024-10-21 01:05:39 +09:00
あわわわとーにゅ
65854911bc
fix(frontend/reaction): リアクションのミュートのボタンのアイコンが逆になっている問題を修正 (MisskeyIO#767) 2024-10-21 01:04:52 +09:00
47 changed files with 6451 additions and 4711 deletions

View File

@ -57,7 +57,7 @@ jobs:
- name: Install FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
@ -117,7 +117,7 @@ jobs:
with:
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

View File

@ -20,7 +20,7 @@ jobs:
- run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version-file: '.node-version'
cache: 'pnpm'

View File

@ -29,7 +29,7 @@ jobs:
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4.0.4
- uses: actions/setup-node@v4.1.0
with:
node-version-file: '.node-version'
cache: 'pnpm'
@ -55,7 +55,7 @@ jobs:
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4.0.4
- uses: actions/setup-node@v4.1.0
with:
node-version-file: '.node-version'
cache: 'pnpm'
@ -80,7 +80,7 @@ jobs:
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4.0.4
- uses: actions/setup-node@v4.1.0
with:
node-version-file: '.node-version'
cache: 'pnpm'

View File

@ -37,7 +37,7 @@ jobs:
with:
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

View File

@ -30,7 +30,7 @@ jobs:
- run: corepack enable
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

View File

@ -27,7 +27,7 @@ jobs:
with:
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

View File

@ -28,7 +28,7 @@ jobs:
with:
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.4
uses: actions/setup-node@v4.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

26
locales/index.d.ts vendored
View File

@ -48,6 +48,20 @@ export interface Locale extends ILocale {
*
*/
"password": string;
/**
*
*/
"initialPasswordForSetup": string;
/**
*
*/
"initialPasswordIsIncorrect": string;
/**
* Misskeyを自分でインストールした場合は使
* Misskeyのホスティングサービスなどを使用している場合は使
*
*/
"initialPasswordForSetupDescription": string;
/**
*
*/
@ -8757,14 +8771,26 @@ export interface Locale extends ILocale {
*
*/
"callback": string;
/**
*
*/
"accepted": string;
/**
*
*/
"denied": string;
/**
*
*/
"scopeUser": string;
/**
*
*/
"pleaseLogin": string;
/**
* URLに遷移します
*/
"byClickingYouWillBeRedirectedToThisUrl": string;
};
"_antennaSources": {
/**

View File

@ -28,7 +28,8 @@ const primaries = {
const clean = (text) => text.replace(new RegExp(String.fromCodePoint(0x08), 'g'), '');
export function build() {
const locales = languages.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(new URL(`${c}.yml`, import.meta.url), 'utf-8'))) || {}, a), {});
const metaUrl = import.meta.url;
const locales = languages.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(new URL(`${c}.yml`, metaUrl), 'utf-8'))) || {}, a), {});
// 空文字列が入ることがあり、フォールバックが動作しなくなるのでプロパティごと消す
const removeEmpty = (obj) => {

View File

@ -8,6 +8,9 @@ search: "検索"
notifications: "通知"
username: "ユーザー名"
password: "パスワード"
initialPasswordForSetup: "初期設定開始用パスワード"
initialPasswordIsIncorrect: "初期設定開始用のパスワードが違います。"
initialPasswordForSetupDescription: "Misskeyを自分でインストールした場合は、設定ファイルに入力したパスワードを使用してください。\nMisskeyのホスティングサービスなどを使用している場合は、提供されたパスワードを使用してください。\nパスワードを設定していない場合は、空欄にしたまま続行してください。"
forgotPassword: "パスワードを忘れた"
fetchingAsApObject: "連合に照会中"
ok: "OK"
@ -2293,8 +2296,11 @@ _auth:
permissionAsk: "このアプリは次の権限を要求しています"
pleaseGoBack: "アプリケーションに戻ってやっていってください"
callback: "アプリケーションに戻っています"
accepted: "アクセスを許可しました"
denied: "アクセスを拒否しました"
scopeUser: "以下のユーザーとして操作しています"
pleaseLogin: "アプリケーションにアクセス許可を与えるには、ログインが必要です。"
byClickingYouWillBeRedirectedToThisUrl: "アクセスを許可すると、自動で以下のURLに遷移します"
_antennaSources:
all: "全てのノート"

View File

@ -34,20 +34,18 @@
"generate-api-json": "pnpm build && node ./scripts/generate_api_json.js"
},
"optionalDependencies": {
"@swc/core-android-arm64": "1.3.11",
"@swc/core-darwin-arm64": "1.5.7",
"@swc/core-darwin-x64": "1.5.7",
"@swc/core-freebsd-x64": "1.3.11",
"@swc/core-linux-arm-gnueabihf": "1.5.7",
"@swc/core-linux-arm64-gnu": "1.5.7",
"@swc/core-linux-arm64-musl": "1.5.7",
"@swc/core-linux-x64-gnu": "1.5.7",
"@swc/core-linux-x64-musl": "1.5.7",
"@swc/core-win32-arm64-msvc": "1.5.7",
"@swc/core-win32-ia32-msvc": "1.5.7",
"@swc/core-win32-x64-msvc": "1.5.7",
"@tensorflow/tfjs": "4.19.0",
"@tensorflow/tfjs-node": "4.19.0",
"@swc/core-darwin-arm64": "1.7.39",
"@swc/core-darwin-x64": "1.7.39",
"@swc/core-linux-arm-gnueabihf": "1.7.39",
"@swc/core-linux-arm64-gnu": "1.7.39",
"@swc/core-linux-arm64-musl": "1.7.39",
"@swc/core-linux-x64-gnu": "1.7.39",
"@swc/core-linux-x64-musl": "1.7.39",
"@swc/core-win32-arm64-msvc": "1.7.39",
"@swc/core-win32-ia32-msvc": "1.7.39",
"@swc/core-win32-x64-msvc": "1.7.39",
"@tensorflow/tfjs": "4.22.0",
"@tensorflow/tfjs-node": "4.22.0",
"bufferutil": "4.0.8",
"slacc-android-arm-eabi": "0.0.10",
"slacc-android-arm64": "0.0.10",
@ -66,34 +64,34 @@
},
"dependencies": {
"@authenio/samlify-node-xmllint": "2.0.0",
"@aws-sdk/client-s3": "3.627.0",
"@aws-sdk/lib-storage": "3.627.0",
"@bull-board/api": "5.21.3",
"@bull-board/fastify": "5.21.3",
"@bull-board/ui": "5.21.3",
"@discordapp/twemoji": "15.0.3",
"@elastic/elasticsearch": "^8.14.0",
"@fastify/accepts": "4.3.0",
"@fastify/cookie": "9.3.1",
"@fastify/cors": "9.0.1",
"@fastify/express": "3.0.0",
"@fastify/formbody": "7.4.0",
"@fastify/http-proxy": "9.5.0",
"@fastify/multipart": "8.3.0",
"@fastify/static": "7.0.4",
"@fastify/view": "9.1.0",
"@aws-sdk/client-s3": "3.676.0",
"@aws-sdk/lib-storage": "3.676.0",
"@bull-board/api": "6.2.4",
"@bull-board/fastify": "6.2.4",
"@bull-board/ui": "6.2.4",
"@discordapp/twemoji": "15.1.0",
"@elastic/elasticsearch": "8.15.1",
"@fastify/accepts": "5.0.1",
"@fastify/cookie": "11.0.1",
"@fastify/cors": "10.0.1",
"@fastify/express": "4.0.1",
"@fastify/formbody": "8.0.1",
"@fastify/http-proxy": "10.0.1",
"@fastify/multipart": "9.0.1",
"@fastify/static": "8.0.2",
"@fastify/view": "10.0.1",
"@misskey-dev/sharp-read-bmp": "1.2.0",
"@misskey-dev/summaly": "5.1.0",
"@napi-rs/canvas": "0.1.53",
"@nestjs/common": "10.3.10",
"@nestjs/core": "10.3.10",
"@nestjs/testing": "10.3.10",
"@napi-rs/canvas": "0.1.58",
"@nestjs/common": "10.4.5",
"@nestjs/core": "10.4.5",
"@nestjs/testing": "10.4.5",
"@peertube/http-signature": "1.7.0",
"@simplewebauthn/server": "10.0.1",
"@sinonjs/fake-timers": "11.2.2",
"@smithy/node-http-handler": "3.1.4",
"@swc/cli": "0.3.12",
"@swc/core": "1.5.7",
"@simplewebauthn/server": "11.0.0",
"@sinonjs/fake-timers": "11.3.1",
"@smithy/node-http-handler": "3.2.5",
"@swc/cli": "0.4.0",
"@swc/core": "1.7.39",
"@twemoji/parser": "15.1.1",
"accepts": "1.3.8",
"ajv": "8.17.1",
@ -101,41 +99,41 @@
"async-mutex": "0.5.0",
"bcryptjs": "2.4.3",
"blurhash": "2.0.5",
"body-parser": "1.20.2",
"bullmq": "5.12.3",
"body-parser": "1.20.3",
"bullmq": "5.21.2",
"cacheable-lookup": "7.0.0",
"cbor": "9.0.2",
"chalk": "5.3.0",
"chalk-template": "1.1.0",
"chokidar": "3.6.0",
"chokidar": "4.0.1",
"cli-highlight": "2.1.11",
"color-convert": "2.0.1",
"content-disposition": "0.5.4",
"date-fns": "3.6.0",
"date-fns": "4.1.0",
"deep-email-validator": "0.1.21",
"fastify": "4.28.1",
"fastify-http-errors-enhanced": "5.0.4",
"fastify-raw-body": "4.3.0",
"fastify": "5.0.0",
"fastify-http-errors-enhanced": "6.0.0",
"fastify-raw-body": "5.0.0",
"feed": "4.2.2",
"file-type": "19.4.0",
"file-type": "19.6.0",
"fluent-ffmpeg": "2.1.3",
"form-data": "4.0.0",
"got": "14.4.2",
"happy-dom": "14.12.3",
"form-data": "4.0.1",
"got": "14.4.3",
"happy-dom": "15.7.4",
"hpagent": "1.2.0",
"htmlescape": "1.1.1",
"http-link-header": "1.1.3",
"ioredis": "5.4.1",
"ip-cidr": "3.1.0",
"ip-cidr": "4.0.2",
"ipaddr.js": "2.2.0",
"is-svg": "5.1.0",
"jose": "5.6.3",
"jose": "5.9.6",
"js-yaml": "4.1.0",
"jsdom": "24.1.1",
"jsdom": "25.0.1",
"json5": "2.2.3",
"jsonld": "8.3.2",
"jsrsasign": "11.1.0",
"meilisearch": "0.41.0",
"meilisearch": "0.44.1",
"mfm-js": "0.24.0",
"microformats-parser": "2.0.2",
"mime-types": "2.1.35",
@ -146,17 +144,17 @@
"nested-property": "4.0.0",
"node-fetch": "3.3.2",
"node-forge": "1.3.1",
"nodemailer": "6.9.14",
"nodemailer": "6.9.15",
"nsfwjs": "2.4.2",
"oauth": "0.10.0",
"oauth2orize": "1.12.0",
"oauth2orize-pkce": "0.1.2",
"os-utils": "0.0.14",
"otpauth": "9.3.1",
"parse5": "7.1.2",
"pg": "8.12.0",
"pino": "9.3.2",
"pino-pretty": "11.2.2",
"otpauth": "9.3.4",
"parse5": "7.2.0",
"pg": "8.13.0",
"pino": "9.5.0",
"pino-pretty": "11.3.0",
"pkce-challenge": "4.1.0",
"probe-image-size": "7.2.3",
"promise-limit": "2.7.0",
@ -165,26 +163,26 @@
"qrcode": "1.5.4",
"random-seed": "0.3.0",
"ratelimiter": "3.4.1",
"re2": "1.21.3",
"re2": "1.21.4",
"redis-lock": "0.1.4",
"reflect-metadata": "0.2.2",
"rename": "1.0.4",
"rss-parser": "3.13.0",
"rxjs": "7.8.1",
"samlify": "2.8.11",
"sanitize-html": "2.13.0",
"sanitize-html": "2.13.1",
"secure-json-parse": "2.7.0",
"sharp": "0.33.4",
"sharp": "0.33.5",
"slacc": "0.0.10",
"strict-event-emitter-types": "2.0.0",
"stringz": "2.1.0",
"systeminformation": "5.23.4",
"systeminformation": "5.23.5",
"tinycolor2": "1.6.0",
"tmp": "0.2.3",
"tsc-alias": "1.8.10",
"tsconfig-paths": "4.2.0",
"typeorm": "0.3.20",
"typescript": "5.5.4",
"typescript": "5.6.3",
"ulid": "2.3.0",
"vary": "1.1.2",
"web-push": "3.6.7",
@ -195,58 +193,58 @@
"devDependencies": {
"@jest/globals": "29.7.0",
"@misskey-dev/eslint-plugin": "1.0.0",
"@nestjs/platform-express": "10.3.10",
"@simplewebauthn/types": "10.0.0",
"@nestjs/platform-express": "10.4.5",
"@simplewebauthn/types": "11.0.0",
"@swc/jest": "0.2.36",
"@types/accepts": "1.3.7",
"@types/archiver": "6.0.2",
"@types/bcryptjs": "2.4.6",
"@types/body-parser": "1.19.5",
"@types/color-convert": "2.0.3",
"@types/color-convert": "2.0.4",
"@types/content-disposition": "0.5.8",
"@types/fluent-ffmpeg": "2.1.25",
"@types/fluent-ffmpeg": "2.1.26",
"@types/htmlescape": "^1.1.3",
"@types/http-link-header": "1.0.7",
"@types/jest": "29.5.12",
"@types/jest": "29.5.13",
"@types/js-yaml": "4.0.9",
"@types/jsdom": "21.1.7",
"@types/jsonld": "1.5.15",
"@types/jsrsasign": "10.5.14",
"@types/mime-types": "2.1.4",
"@types/ms": "0.7.34",
"@types/node": "22.2.0",
"@types/node": "22.7.8",
"@types/node-forge": "1.3.11",
"@types/nodemailer": "6.4.15",
"@types/oauth": "0.9.5",
"@types/nodemailer": "6.4.16",
"@types/oauth": "0.9.6",
"@types/oauth2orize": "1.11.5",
"@types/oauth2orize-pkce": "0.1.2",
"@types/pg": "8.11.6",
"@types/pg": "8.11.10",
"@types/pug": "2.0.10",
"@types/punycode": "2.1.4",
"@types/qrcode": "1.5.5",
"@types/random-seed": "0.3.5",
"@types/ratelimiter": "3.4.6",
"@types/rename": "1.0.7",
"@types/sanitize-html": "2.11.0",
"@types/sanitize-html": "2.13.0",
"@types/semver": "7.5.8",
"@types/simple-oauth2": "5.0.7",
"@types/sinonjs__fake-timers": "8.1.5",
"@types/tinycolor2": "1.4.6",
"@types/tmp": "0.2.6",
"@types/vary": "1.1.3",
"@types/web-push": "3.6.3",
"@types/web-push": "3.6.4",
"@types/ws": "8.5.12",
"@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/parser": "7.10.0",
"aws-sdk-client-mock": "4.0.1",
"aws-sdk-client-mock": "4.1.0",
"cross-env": "7.0.3",
"eslint": "8.57.0",
"eslint-plugin-import": "2.29.1",
"execa": "9.3.0",
"eslint": "8.57.1",
"eslint-plugin-import": "2.31.0",
"execa": "9.4.1",
"fkill": "^9.0.0",
"jest": "29.7.0",
"jest-mock": "29.7.0",
"nodemon": "3.1.4",
"nodemon": "3.1.7",
"pid-port": "1.0.0",
"simple-oauth2": "5.1.0"
}

View File

@ -266,10 +266,7 @@ export class FileInfoService {
}
private async *asyncIterateFrames(cwd: string, command: FFmpeg.FfmpegCommand): AsyncGenerator<string, void> {
const watcher = new FSWatcher({
cwd,
disableGlobbing: true,
});
const watcher = new FSWatcher({ cwd });
let finished = false;
command.once('end', () => {
finished = true;

View File

@ -96,8 +96,8 @@ export class WebAuthnService {
@bindThis
public async verifyRegistration(userId: MiUser['id'], response: RegistrationResponseJSON): Promise<{
credentialID: string;
credentialPublicKey: Uint8Array;
id: string;
publicKey: Uint8Array;
attestationObject: Uint8Array;
fmt: AttestationFormat;
counter: number;
@ -139,15 +139,15 @@ export class WebAuthnService {
const { registrationInfo } = verification;
return {
credentialID: registrationInfo.credentialID,
credentialPublicKey: registrationInfo.credentialPublicKey,
id: registrationInfo.credential.id,
publicKey: registrationInfo.credential.publicKey,
attestationObject: registrationInfo.attestationObject,
fmt: registrationInfo.fmt,
counter: registrationInfo.counter,
counter: registrationInfo.credential.counter,
userVerified: registrationInfo.userVerified,
credentialDeviceType: registrationInfo.credentialDeviceType,
credentialBackedUp: registrationInfo.credentialBackedUp,
transports: response.response.transports,
transports: registrationInfo.credential.transports,
};
}
@ -228,9 +228,9 @@ export class WebAuthnService {
expectedChallenge: challenge,
expectedOrigin: relyingParty.origin,
expectedRPID: relyingParty.rpId,
authenticator: {
credentialID: key.id,
credentialPublicKey: Buffer.from(key.publicKey, 'base64url'),
credential: {
id: key.id,
publicKey: Buffer.from(key.publicKey, 'base64url'),
counter: key.counter,
transports: key.transports ? key.transports as AuthenticatorTransportFuture[] : undefined,
},

View File

@ -8,7 +8,7 @@ import type { onRequestHookHandler } from 'fastify';
export const handleRequestRedirectToOmitSearch: onRequestHookHandler = (request, reply, done) => {
const index = request.url.indexOf('?');
if (~index) {
reply.redirect(301, request.url.slice(0, index));
reply.redirect(request.url.slice(0, index), 301);
}
done();
};

View File

@ -82,7 +82,7 @@ export class FileServerService {
.catch(err => this.errorHandler(request, reply, err));
});
fastify.get<{ Params: { key: string; } }>('/files/:key/*', async (request, reply) => {
return await reply.redirect(301, `${this.config.url}/files/${request.params.key}`);
return reply.redirect(`${this.config.url}/files/${request.params.key}`, 301);
});
done();
});
@ -147,12 +147,12 @@ export class FileServerService {
url.searchParams.set('static', '1');
file.cleanup();
return await reply.redirect(301, url.toString());
return await reply.redirect(url.toString(), 301);
} else if (file.mime.startsWith('video/')) {
const externalThumbnail = this.videoProcessingService.getExternalVideoThumbnailUrl(file.url);
if (externalThumbnail) {
file.cleanup();
return await reply.redirect(301, externalThumbnail);
return await reply.redirect(externalThumbnail, 301);
}
image = await this.videoProcessingService.generateVideoThumbnail(file.path);
@ -167,7 +167,7 @@ export class FileServerService {
url.searchParams.set('url', file.url);
file.cleanup();
return await reply.redirect(301, url.toString());
return await reply.redirect(url.toString(), 301);
}
}
@ -313,12 +313,18 @@ export class FileServerService {
url.searchParams.append(key, value);
}
return await reply.redirect(
301,
return reply.redirect(
url.toString(),
301,
);
}
if (!request.headers['user-agent']) {
throw new StatusError('User-Agent is required', 400, 'User-Agent is required');
} else if (request.headers['user-agent'].toLowerCase().indexOf('misskey/') !== -1) {
throw new StatusError('Refusing to proxy a request from another proxy', 403, 'Proxy is recursive');
}
// Create temp file
const file = await this.getStreamAndTypeFromUrl(url);
if (file === '404') {

View File

@ -155,7 +155,7 @@ export class ServerService implements OnApplicationShutdown {
if (emoji == null) {
if ('fallback' in request.query) {
return await reply.redirect('/static-assets/emoji-unknown.png');
return reply.redirect('/static-assets/emoji-unknown.png');
} else {
reply.code(404);
return;
@ -176,9 +176,9 @@ export class ServerService implements OnApplicationShutdown {
if ('static' in request.query) url.searchParams.set('static', '1');
}
return await reply.redirect(
301,
return reply.redirect(
url.toString(),
301,
);
});

View File

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

View File

@ -211,7 +211,10 @@ export function genOpenapiSpec(config: Config, includeSelfRef = false) {
spec.paths['/' + endpoint.name] = {
...(endpoint.meta.allowGet ? {
get: info,
get: {
...info,
operationId: info.operationId + '_get',
},
} : {}),
post: info,
};

View File

@ -17,34 +17,34 @@
"lint": "pnpm typecheck && pnpm eslint"
},
"dependencies": {
"@discordapp/twemoji": "15.0.3",
"@discordapp/twemoji": "15.1.0",
"@github/webauthn-json": "2.1.1",
"@isaacs/ttlcache": "1.4.1",
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
"@misskey-dev/browser-image-resizer": "2024.1.0",
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-replace": "5.0.7",
"@rollup/plugin-typescript": "11.1.6",
"@rollup/pluginutils": "5.1.0",
"@syuilo/aiscript": "0.18.0",
"@tabler/icons-webfont": "3.12.0",
"@rollup/plugin-replace": "6.0.1",
"@rollup/plugin-typescript": "12.1.1",
"@rollup/pluginutils": "5.1.2",
"@syuilo/aiscript": "0.19.0",
"@tabler/icons-webfont": "3.19.0",
"@twemoji/parser": "15.1.1",
"@vitejs/plugin-vue": "5.1.2",
"@vue/compiler-sfc": "3.4.15",
"@vitejs/plugin-vue": "5.1.4",
"@vue/compiler-sfc": "3.5.12",
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.9",
"astring": "1.8.6",
"astring": "1.9.0",
"broadcast-channel": "7.0.0",
"buraha": "0.0.1",
"canvas-confetti": "1.9.3",
"chart.js": "4.4.3",
"chart.js": "4.4.5",
"chartjs-adapter-date-fns": "3.0.0",
"chartjs-chart-matrix": "2.0.1",
"chartjs-plugin-gradient": "0.6.1",
"chartjs-plugin-zoom": "2.0.1",
"chromatic": "11.7.0",
"chromatic": "11.14.0",
"compare-versions": "6.1.1",
"cropperjs": "2.0.0-rc.0",
"date-fns": "3.6.0",
"date-fns": "4.1.0",
"escape-regexp": "0.0.1",
"estree-walker": "3.0.3",
"eventemitter3": "5.0.1",
@ -59,86 +59,86 @@
"misskey-reversi": "workspace:*",
"photoswipe": "5.4.4",
"punycode": "2.3.1",
"rollup": "4.20.0",
"sanitize-html": "2.13.0",
"sass": "1.77.8",
"shiki": "1.12.1",
"rollup": "4.24.0",
"sanitize-html": "2.13.1",
"sass": "1.80.3",
"shiki": "1.22.0",
"strict-event-emitter-types": "2.0.0",
"textarea-caret": "3.1.0",
"three": "0.167.1",
"three": "0.169.0",
"throttle-debounce": "5.0.2",
"tinycolor2": "1.6.0",
"tsc-alias": "1.8.10",
"tsconfig-paths": "4.2.0",
"typescript": "5.5.4",
"typescript": "5.6.3",
"uuid": "10.0.0",
"v-code-diff": "1.12.1",
"vite": "5.4.0",
"vue": "3.4.15",
"v-code-diff": "1.13.1",
"vite": "5.4.9",
"vue": "3.5.12",
"vuedraggable": "next"
},
"devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0",
"@misskey-dev/summaly": "5.1.0",
"@storybook/addon-actions": "8.2.8",
"@storybook/addon-essentials": "8.2.8",
"@storybook/addon-interactions": "8.2.8",
"@storybook/addon-links": "8.2.8",
"@storybook/addon-mdx-gfm": "8.2.8",
"@storybook/addon-storysource": "8.2.8",
"@storybook/blocks": "8.2.8",
"@storybook/components": "8.2.8",
"@storybook/core-events": "8.2.8",
"@storybook/manager-api": "8.2.8",
"@storybook/preview-api": "8.2.8",
"@storybook/react": "8.2.8",
"@storybook/react-vite": "8.2.8",
"@storybook/test": "8.2.8",
"@storybook/theming": "8.2.8",
"@storybook/types": "8.2.8",
"@storybook/vue3": "8.2.8",
"@storybook/vue3-vite": "8.2.8",
"@storybook/addon-actions": "8.3.6",
"@storybook/addon-essentials": "8.3.6",
"@storybook/addon-interactions": "8.3.6",
"@storybook/addon-links": "8.3.6",
"@storybook/addon-mdx-gfm": "8.3.6",
"@storybook/addon-storysource": "8.3.6",
"@storybook/blocks": "8.3.6",
"@storybook/components": "8.3.6",
"@storybook/core-events": "8.3.6",
"@storybook/manager-api": "8.3.6",
"@storybook/preview-api": "8.3.6",
"@storybook/react": "8.3.6",
"@storybook/react-vite": "8.3.6",
"@storybook/test": "8.3.6",
"@storybook/theming": "8.3.6",
"@storybook/types": "8.3.6",
"@storybook/vue3": "8.3.6",
"@storybook/vue3-vite": "8.3.6",
"@testing-library/vue": "8.1.0",
"@types/canvas-confetti": "^1.6.4",
"@types/escape-regexp": "0.0.3",
"@types/estree": "1.0.5",
"@types/estree": "1.0.6",
"@types/matter-js": "0.19.7",
"@types/micromatch": "4.0.9",
"@types/node": "22.2.0",
"@types/node": "22.7.8",
"@types/punycode": "2.1.4",
"@types/sanitize-html": "2.11.0",
"@types/sanitize-html": "2.13.0",
"@types/throttle-debounce": "5.0.2",
"@types/tinycolor2": "1.4.6",
"@types/uuid": "10.0.0",
"@types/ws": "8.5.12",
"@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/parser": "7.10.0",
"@vitest/coverage-v8": "0.34.6",
"@vue/runtime-core": "3.4.15",
"acorn": "8.12.1",
"@vitest/coverage-v8": "2.1.3",
"@vue/runtime-core": "3.5.12",
"acorn": "8.13.0",
"cross-env": "7.0.3",
"cypress": "13.13.2",
"eslint": "8.57.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-vue": "9.27.0",
"cypress": "13.15.0",
"eslint": "8.57.1",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-vue": "9.29.1",
"fast-glob": "3.3.2",
"happy-dom": "14.12.3",
"happy-dom": "15.7.4",
"intersection-observer": "0.12.2",
"micromatch": "4.0.7",
"msw": "2.3.5",
"micromatch": "4.0.8",
"msw": "2.5.0",
"msw-storybook-addon": "2.0.3",
"nodemon": "3.1.4",
"nodemon": "3.1.7",
"prettier": "3.3.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"start-server-and-test": "2.0.5",
"storybook": "8.2.8",
"start-server-and-test": "2.0.8",
"storybook": "8.3.6",
"storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme",
"vite-plugin-turbosnap": "1.0.3",
"vitest": "0.34.6",
"vitest-fetch-mock": "0.2.2",
"vue-component-type-helpers": "2.0.29",
"vitest": "2.1.3",
"vitest-fetch-mock": "0.3.0",
"vue-component-type-helpers": "2.1.6",
"vue-eslint-parser": "9.4.3",
"vue-tsc": "2.0.29"
"vue-tsc": "2.1.6"
}
}

View File

@ -10,7 +10,7 @@ import '@/style.scss';
import { mainBoot } from '@/boot/main-boot.js';
import { subBoot } from '@/boot/sub-boot.js';
const subBootPaths = ['/share', '/auth', '/miauth', '/signup-complete', '/onboarding'];
const subBootPaths = ['/share', '/auth', '/miauth', '/signup-complete', '/onboarding', '/oauth'];
if (subBootPaths.some(i => location.pathname === i || location.pathname.startsWith(i + '/'))) {
subBoot();

View File

@ -5,10 +5,10 @@
import { defineAsyncComponent, reactive, ref } from 'vue';
import * as Misskey from 'misskey-js';
import type { MenuButton } from '@/types/menu.js';
import { showSuspendedDialog } from '@/scripts/show-suspended-dialog.js';
import { i18n } from '@/i18n.js';
import { miLocalStorage } from '@/local-storage.js';
import { MenuButton } from '@/types/menu.js';
import { del, get, set } from '@/scripts/idb-proxy.js';
import { apiUrl } from '@/config.js';
import { waiting, popup, popupMenu, success, alert } from '@/os.js';
@ -296,10 +296,22 @@ export async function openAccountMenu(opts: {
text: i18n.ts.addAccount,
children: [{
text: i18n.ts.existingAccount,
action: () => { showSigninDialog(); },
action: () => {
getAccountWithSigninDialog().then(res => {
if (res != null) {
success();
}
});
},
}, {
text: i18n.ts.createAccount,
action: () => { createAccount(); },
action: () => {
getAccountWithSignupDialog().then(res => {
if (res != null) {
switchAccountWithToken(res.token);
}
});
},
}],
}, {
type: 'link' as const,
@ -316,6 +328,40 @@ export async function openAccountMenu(opts: {
}
}
export function getAccountWithSigninDialog(): Promise<{ id: string, token: string } | null> {
return new Promise((resolve) => {
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {}, {
done: async (res: Misskey.entities.SigninFlowResponse & { finished: true }) => {
await addAccount(res.id, res.i);
resolve({ id: res.id, token: res.i });
},
cancelled: () => {
resolve(null);
},
closed: () => {
dispose();
},
});
});
}
export function getAccountWithSignupDialog(): Promise<{ id: string, token: string } | null> {
return new Promise((resolve) => {
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSignupDialog.vue')), {}, {
done: async (res: Misskey.entities.SignupResponse) => {
await addAccount(res.id, res.token);
resolve({ id: res.id, token: res.token });
},
cancelled: () => {
resolve(null);
},
closed: () => {
dispose();
},
});
});
}
if (_DEV_) {
(window as any).$i = $i;
}

View File

@ -0,0 +1,7 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import MkAuthConfirm from './MkAuthConfirm.vue';
void MkAuthConfirm;

View File

@ -0,0 +1,450 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div :class="$style.wrapper">
<Transition
mode="out-in"
:enterActiveClass="$style.transition_enterActive"
:leaveActiveClass="$style.transition_leaveActive"
:enterFromClass="$style.transition_enterFrom"
:leaveToClass="$style.transition_leaveTo"
:inert="_waiting"
>
<div v-if="phase === 'accountSelect'" key="accountSelect" :class="$style.root" class="_gaps">
<div :class="$style.header" class="_gaps_s">
<div :class="$style.iconFallback">
<i class="ti ti-user"></i>
</div>
<div :class="$style.headerText">{{ i18n.ts.pleaseSelectAccount }}</div>
</div>
<div :class="$style.accountSelectorRoot">
<div :class="$style.accountSelectorLabel">{{ i18n.ts.selectAccount }}</div>
<div :class="$style.accountSelectorList">
<template v-for="[id, user] in users">
<input :id="'account-' + id" v-model="selectedUser" type="radio" name="accountSelector" :value="id" :class="$style.accountSelectorRadio"/>
<label :for="'account-' + id" :class="$style.accountSelectorItem">
<MkAvatar :user="user" :class="$style.accountSelectorAvatar"/>
<div :class="$style.accountSelectorBody">
<MkUserName :user="user" :class="$style.accountSelectorName"/>
<MkAcct :user="user" :class="$style.accountSelectorAcct"/>
</div>
</label>
</template>
<button class="_button" :class="[$style.accountSelectorItem, $style.accountSelectorAddAccountRoot]" @click="clickAddAccount">
<div :class="[$style.accountSelectorAvatar, $style.accountSelectorAddAccountAvatar]">
<i class="ti ti-user-plus"></i>
</div>
<div :class="[$style.accountSelectorBody, $style.accountSelectorName]">{{ i18n.ts.addAccount }}</div>
</button>
</div>
</div>
<div class="_buttonsCenter">
<MkButton rounded gradate :disabled="selectedUser === null" @click="clickChooseAccount">{{ i18n.ts.continue }} <i class="ti ti-arrow-right"></i></MkButton>
</div>
</div>
<div v-else-if="phase === 'consent'" key="consent" :class="$style.root" class="_gaps">
<div :class="$style.header" class="_gaps_s">
<img v-if="icon" :class="$style.icon" :src="getProxiedImageUrl(icon, 'preview')"/>
<div v-else :class="$style.iconFallback">
<i class="ti ti-apps"></i>
</div>
<div :class="$style.headerText">{{ name ? i18n.tsx._auth.shareAccess({ name }) : i18n.ts._auth.shareAccessAsk }}</div>
</div>
<div v-if="permissions && permissions.length > 0" class="_gaps_s" :class="$style.permissionRoot">
<div>{{ name ? i18n.tsx._auth.permission({ name }) : i18n.ts._auth.permissionAsk }}</div>
<div :class="$style.permissionListWrapper">
<ul :class="$style.permissionList">
<li v-for="p in permissions" :key="p">{{ i18n.ts._permissions[p] }}</li>
</ul>
</div>
</div>
<slot name="consentAdditionalInfo"></slot>
<div :class="$style.accountSelectorRoot">
<div :class="$style.accountSelectorLabel">
{{ i18n.ts._auth.scopeUser }} <button class="_textButton" @click="clickBackToAccountSelect">{{ i18n.ts.switchAccount }}</button>
</div>
<div :class="$style.accountSelectorList">
<div :class="[$style.accountSelectorItem, $style.static]">
<MkAvatar :user="users.get(selectedUser!)!" :class="$style.accountSelectorAvatar"/>
<div :class="$style.accountSelectorBody">
<MkUserName :user="users.get(selectedUser!)!" :class="$style.accountSelectorName"/>
<MkAcct :user="users.get(selectedUser!)!" :class="$style.accountSelectorAcct"/>
</div>
</div>
</div>
</div>
<div class="_buttonsCenter">
<MkButton rounded @click="clickCancel">{{ i18n.ts.reject }}</MkButton>
<MkButton rounded gradate @click="clickAccept">{{ i18n.ts.accept }}</MkButton>
</div>
</div>
<div v-else-if="phase === 'success'" key="success" :class="$style.root" class="_gaps_s">
<div :class="$style.header" class="_gaps_s">
<div :class="$style.iconFallback">
<i class="ti ti-check"></i>
</div>
<div :class="$style.headerText">{{ i18n.ts._auth.accepted }}</div>
<div :class="$style.headerTextSub">{{ i18n.ts._auth.pleaseGoBack }}</div>
</div>
</div>
<div v-else-if="phase === 'denied'" key="denied" :class="$style.root" class="_gaps_s">
<div :class="$style.header" class="_gaps_s">
<div :class="$style.iconFallback">
<i class="ti ti-x"></i>
</div>
<div :class="$style.headerText">{{ i18n.ts._auth.denied }}</div>
</div>
</div>
<div v-else-if="phase === 'failed'" key="failed" :class="$style.root" class="_gaps_s">
<div :class="$style.header" class="_gaps_s">
<div :class="$style.iconFallback">
<i class="ti ti-x"></i>
</div>
<div :class="$style.headerText">{{ i18n.ts.somethingHappened }}</div>
</div>
</div>
</Transition>
<div v-if="_waiting" :class="$style.waitingRoot">
<MkLoading/>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import { $i, getAccounts, getAccountWithSigninDialog, getAccountWithSignupDialog } from '@/account.js';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { getProxiedImageUrl } from '@/scripts/media-proxy.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const props = defineProps<{
name?: string;
icon?: string;
permissions?: (typeof Misskey.permissions[number])[];
manualWaiting?: boolean;
waitOnDeny?: boolean;
}>();
const emit = defineEmits<{
(ev: 'accept', token: string): void;
(ev: 'deny', token: string): void;
}>();
const waiting = ref(true);
const _waiting = computed(() => waiting.value || props.manualWaiting);
const phase = ref<'accountSelect' | 'consent' | 'success' | 'denied' | 'failed'>('accountSelect');
const selectedUser = ref<string | null>(null);
const users = ref(new Map<string, Misskey.entities.UserDetailed & { token: string; }>());
async function init() {
waiting.value = true;
users.value.clear();
if ($i) {
users.value.set($i.id, $i);
}
const accounts = await getAccounts();
const accountIdsToFetch = accounts.map(a => a.id).filter(id => !users.value.has(id));
if (accountIdsToFetch.length > 0) {
const usersRes = await misskeyApi('users/show', {
userIds: accountIdsToFetch,
});
for (const user of usersRes) {
if (users.value.has(user.id)) continue;
users.value.set(user.id, {
...user,
token: accounts.find(a => a.id === user.id)!.token,
});
}
}
waiting.value = false;
}
init();
function clickAddAccount(ev: MouseEvent) {
selectedUser.value = null;
os.popupMenu([{
text: i18n.ts.existingAccount,
action: () => {
getAccountWithSigninDialog().then(async (res) => {
if (res != null) {
os.success();
await init();
if (users.value.has(res.id)) {
selectedUser.value = res.id;
}
}
});
},
}, {
text: i18n.ts.createAccount,
action: () => {
getAccountWithSignupDialog().then(async (res) => {
if (res != null) {
os.success();
await init();
if (users.value.has(res.id)) {
selectedUser.value = res.id;
}
}
});
},
}], ev.currentTarget ?? ev.target);
}
function clickChooseAccount() {
if (selectedUser.value === null) return;
phase.value = 'consent';
}
function clickBackToAccountSelect() {
selectedUser.value = null;
phase.value = 'accountSelect';
}
function clickCancel() {
if (selectedUser.value === null) return;
const user = users.value.get(selectedUser.value)!;
const token = user.token;
if (props.waitOnDeny) {
waiting.value = true;
}
emit('deny', token);
}
async function clickAccept() {
if (selectedUser.value === null) return;
const user = users.value.get(selectedUser.value)!;
const token = user.token;
waiting.value = true;
emit('accept', token);
}
function showUI(state: 'success' | 'denied' | 'failed') {
phase.value = state;
waiting.value = false;
}
defineExpose({
showUI,
});
</script>
<style lang="scss" module>
.transition_enterActive,
.transition_leaveActive {
transition: opacity 0.3s cubic-bezier(0,0,.35,1), transform 0.3s cubic-bezier(0,0,.35,1);
}
.transition_enterFrom {
opacity: 0;
transform: translateX(50px);
}
.transition_leaveTo {
opacity: 0;
transform: translateX(-50px);
}
.wrapper {
overflow-x: hidden;
overflow-x: clip;
position: relative;
width: 100%;
height: 100%;
}
.waitingRoot {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: color-mix(in srgb, var(--MI_THEME-panel), transparent 50%);
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
cursor: wait;
}
.root {
position: relative;
box-sizing: border-box;
width: 100%;
padding: 48px 24px;
}
.header {
margin: 0 auto;
max-width: 320px;
}
.icon,
.iconFallback {
display: block;
margin: 0 auto;
width: 54px;
height: 54px;
}
.icon {
border-radius: 50%;
border: 1px solid var(--MI_THEME-divider);
background-color: #fff;
object-fit: contain;
}
.iconFallback {
border-radius: 50%;
background-color: var(--MI_THEME-accentedBg);
color: var(--MI_THEME-accent);
text-align: center;
line-height: 54px;
font-size: 18px;
}
.headerText,
.headerTextSub {
text-align: center;
word-break: normal;
word-break: auto-phrase;
}
.headerText {
font-size: 16px;
font-weight: 700;
}
.permissionRoot {
padding: 16px;
border-radius: var(--MI-radius);
background-color: var(--MI_THEME-bg);
}
.permissionListWrapper {
max-height: 350px;
overflow-y: auto;
padding: 12px;
border-radius: var(--MI-radius);
background-color: var(--MI_THEME-panel);
}
.permissionList {
margin: 0 0 0 1.5em;
padding: 0;
font-size: 90%;
}
.accountSelectorLabel {
font-size: 0.85em;
opacity: 0.7;
margin-bottom: 8px;
}
.accountSelectorList {
border-radius: var(--MI-radius);
border: 1px solid var(--MI_THEME-divider);
overflow: hidden;
overflow: clip;
}
.accountSelectorRadio {
position: absolute;
clip: rect(0, 0, 0, 0);
pointer-events: none;
&:focus-visible + .accountSelectorItem {
outline: 2px solid var(--MI_THEME-accent);
outline-offset: -4px;
}
&:checked:focus-visible + .accountSelectorItem {
outline-color: #fff;
}
&:checked + .accountSelectorItem {
background: var(--MI_THEME-accent);
color: #fff;
}
}
.accountSelectorItem {
display: flex;
align-items: center;
padding: 8px;
font-size: 14px;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
&:hover {
background: var(--MI_THEME-buttonHoverBg);
}
&.static {
cursor: unset;
&:hover {
background: none;
}
}
}
.accountSelectorAddAccountRoot {
width: 100%;
}
.accountSelectorBody {
padding: 0 8px;
min-width: 0;
}
.accountSelectorAvatar {
width: 45px;
height: 45px;
}
.accountSelectorAddAccountAvatar {
background-color: var(--MI_THEME-accentedBg);
color: var(--MI_THEME-accent);
font-size: 16px;
line-height: 45px;
text-align: center;
border-radius: 50%;
}
.accountSelectorName {
display: block;
font-weight: bold;
}
.accountSelectorAcct {
opacity: 0.5;
}
</style>

View File

@ -100,8 +100,8 @@ async function requestRender() {
sitekey: props.sitekey,
theme: defaultStore.state.darkMode ? 'dark' : 'light',
callback: callback,
'expired-callback': callback,
'error-callback': callback,
'expired-callback': () => callback(undefined),
'error-callback': () => callback(undefined),
});
} else if (props.provider === 'mcaptcha' && props.instanceUrl && props.sitekey) {
const { default: Widget } = await import('@mcaptcha/vanilla-glue');

View File

@ -46,6 +46,7 @@ const emit = defineEmits<{
(event: 'close'): void;
(event: 'closed'): void;
(event: 'ok'): void;
(event: 'esc'): void;
}>();
const modal = shallowRef<InstanceType<typeof MkModal>>();

View File

@ -175,7 +175,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</button>
</div>
<MkButton v-if="reactionTabType" :class="$style.reactionMuteButton" @click="reactionMuteToggle(reactionTabTypeTrimLocal)">
<i :class="!mutedReactions.includes(reactionTabTypeTrimLocal) ? 'ti ti-mood-happy' : 'ti ti-mood-off'"/>
<i :class="!mutedReactions.includes(reactionTabTypeTrimLocal) ? 'ti ti-mood-off' : 'ti ti-mood-happy'"/>
{{ !mutedReactions.includes(reactionTabTypeTrimLocal) ? i18n.ts.muteThisReaction : i18n.ts.unmuteThisReaction }}
</MkButton>
<MkPagination v-if="reactionTabType" :key="reactionTabType" :pagination="reactionsPagination" :disableAutoLoad="true">

View File

@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<MkPullToRefresh :refresher="() => reload()">
<MkPagination ref="pagingComponent" :pagination="pagination">
<MkPagination ref="pagingComponent" :pagination="pagination" :filter="filterMutedNotification">
<template #empty>
<div class="_fullinfo">
<img :src="infoImageUrl" class="_ghost"/>
@ -34,6 +34,7 @@ import { i18n } from '@/i18n.js';
import { notificationTypes } from '@/const.js';
import { infoImageUrl } from '@/instance.js';
import { defaultStore } from '@/store.js';
import { filterMutedNotification } from '@/scripts/filter-muted-notification.js';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import * as Misskey from 'misskey-js';
@ -63,7 +64,7 @@ function onNotification(notification) {
useStream().send('readNotification');
}
if (!isMuted) {
if (!isMuted && filterMutedNotification(notification)) {
pagingComponent.value?.prepend(notification);
}
}

View File

@ -84,6 +84,7 @@ const props = withDefaults(defineProps<{
pagination: Paging;
disableAutoLoad?: boolean;
displayLimit?: number;
filter?: (item: MisskeyEntity) => boolean;
}>(), {
displayLimit: 20,
});
@ -178,6 +179,8 @@ async function init(): Promise<void> {
limit: props.pagination.limit ?? 10,
allowPartial: true,
}).then(res => {
res = res.filter(item => !props.filter || props.filter(item));
for (let i = 0; i < res.length; i++) {
const item = res[i];
if (i === 3) item._shouldInsertAd_ = true;
@ -219,6 +222,8 @@ const fetchMore = async (): Promise<void> => {
untilId: items.value[items.value.length - 1].id,
}),
}).then(res => {
res = res.filter(item => !props.filter || props.filter(item));
for (let i = 0; i < res.length; i++) {
const item = res[i];
if (i === 10) item._shouldInsertAd_ = true;
@ -283,6 +288,8 @@ const fetchMoreAhead = async (): Promise<void> => {
sinceId: items.value[0].id,
}),
}).then(res => {
res = res.filter(item => !props.filter || props.filter(item));
if (res.length === 0) {
items.value = res.concat(items.value);
more.value = false;

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkCustomEmoji v-if="reaction[0] === ':'" ref="elRef" :name="reaction" :normal="true" :noStyle="noStyle" :url="emojiUrl"/>
<MkCustomEmoji v-if="reaction[0] === ':'" ref="elRef" :name="reaction" :normal="true" :noStyle="noStyle" :url="emojiUrl" :fallbackToImage="true"/>
<MkEmoji v-else ref="elRef" :emoji="reaction" :normal="true" :noStyle="noStyle"/>
</template>

View File

@ -48,6 +48,7 @@ const props = withDefaults(defineProps<{
const emit = defineEmits<{
(ev: 'done', res: Misskey.entities.SigninResponse): void;
(ev: 'cancelled'): void;
(ev: 'closed'): void;
}>();

View File

@ -120,6 +120,7 @@ async function done(): Promise<void> {
imageUrl: null,
display: display.value,
needConfirmationToRead: needConfirmationToRead.value,
needEnrollmentTutorialToRead: needEnrollmentTutorialToRead.value,
closeDuration: closeDuration.value,
displayOrder: displayOrder.value,
silence: silence.value,

View File

@ -4,7 +4,8 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<img v-if="errored" src="/client-assets/dummy.png" :alt="alt" :title="alt" decoding="async" :class="[$style.root, { [$style.normal]: normal, [$style.noStyle]: noStyle }]"/>
<span v-if="errored && !fallbackToImage">:{{ customEmojiName }}:</span>
<img v-else-if="errored" src="/client-assets/dummy.png" :alt="alt" :title="alt" decoding="async" :class="[$style.root, { [$style.normal]: normal, [$style.noStyle]: noStyle }]"/>
<img
v-else
:class="[$style.root, { [$style.normal]: normal, [$style.noStyle]: noStyle }]"
@ -39,6 +40,7 @@ const props = defineProps<{
useOriginalSize?: boolean;
menu?: boolean;
menuReaction?: boolean;
fallbackToImage?: boolean;
}>();
const react = inject<((name: string) => void) | null>('react', null);

View File

@ -4,95 +4,79 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :contentMax="800">
<div v-if="$i">
<div v-if="state == 'waiting'">
<MkLoading/>
<div>
<MkAnimBg style="position: fixed; top: 0;"/>
<div :class="$style.formContainer">
<div :class="$style.form">
<MkAuthConfirm
ref="authRoot"
:name="name"
:icon="icon || undefined"
:permissions="_permissions"
@accept="onAccept"
@deny="onDeny"
>
<template #consentAdditionalInfo>
<div v-if="callback != null" class="_gaps_s" :class="$style.redirectRoot">
<div>{{ i18n.ts._auth.byClickingYouWillBeRedirectedToThisUrl }}</div>
<div class="_monospace" :class="$style.redirectUrl">{{ callback }}</div>
</div>
<div v-if="state == 'denied'">
<p>{{ i18n.ts._auth.denied }}</p>
</div>
<div v-else-if="state == 'accepted'" class="accepted">
<p v-if="callback">{{ i18n.ts._auth.callback }}<MkEllipsis/></p>
<p v-else>{{ i18n.ts._auth.pleaseGoBack }}</p>
</div>
<div v-else>
<div v-if="_permissions.length > 0">
<p v-if="name">{{ i18n.tsx._auth.permission({ name }) }}</p>
<p v-else>{{ i18n.ts._auth.permissionAsk }}</p>
<ul>
<li v-for="p in _permissions" :key="p">{{ i18n.ts._permissions[p] }}</li>
</ul>
</div>
<div v-if="name">{{ i18n.tsx._auth.shareAccess({ name }) }}</div>
<div v-else>{{ i18n.ts._auth.shareAccessAsk }}</div>
<div :class="$style.buttons">
<MkButton inline @click="deny">{{ i18n.ts.cancel }}</MkButton>
<MkButton inline primary @click="accept">{{ i18n.ts.accept }}</MkButton>
</template>
</MkAuthConfirm>
</div>
</div>
</div>
<div v-else>
<p :class="$style.loginMessage">{{ i18n.ts._auth.pleaseLogin }}</p>
<MkSignin @login="onLogin"/>
</div>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue';
import MkSignin from '@/components/MkSignin.vue';
import MkButton from '@/components/MkButton.vue';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { $i, login } from '@/account.js';
import { computed, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js';
import MkAnimBg from '@/components/MkAnimBg.vue';
import MkAuthConfirm from '@/components/MkAuthConfirm.vue';
import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const props = defineProps<{
session: string;
callback?: string;
name: string;
icon: string;
permission: string; //
name?: string;
icon?: string;
permission?: string; //
}>();
const _permissions = props.permission ? props.permission.split(',') : [];
const _permissions = computed(() => {
return (props.permission ? props.permission.split(',').filter((p): p is typeof Misskey.permissions[number] => (Misskey.permissions as readonly string[]).includes(p)) : []);
});
const state = ref<string | null>(null);
const authRoot = useTemplateRef('authRoot');
async function accept(): Promise<void> {
state.value = 'waiting';
async function onAccept(token: string) {
await misskeyApi('miauth/gen-token', {
session: props.session,
name: props.name,
iconUrl: props.icon,
permission: _permissions,
permission: _permissions.value,
}, token).catch(() => {
authRoot.value?.showUI('failed');
});
state.value = 'accepted';
if (props.callback) {
if (props.callback && props.callback !== '') {
const cbUrl = new URL(props.callback);
if (['javascript:', 'file:', 'data:', 'mailto:', 'tel:'].includes(cbUrl.protocol)) throw new Error('invalid url');
cbUrl.searchParams.set('session', props.session);
location.href = cbUrl.href;
location.href = cbUrl.toString();
} else {
authRoot.value?.showUI('success');
}
}
function deny(): void {
state.value = 'denied';
function onDeny() {
authRoot.value?.showUI('denied');
}
function onLogin(res): void {
login(res.i);
}
const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(() => ({
title: 'MiAuth',
icon: 'ti ti-apps',
@ -100,15 +84,38 @@ definePageMetadata(() => ({
</script>
<style lang="scss" module>
.buttons {
margin-top: 16px;
display: flex;
gap: 8px;
flex-wrap: wrap;
.formContainer {
min-height: 100svh;
padding: 32px 32px calc(env(safe-area-inset-bottom, 0px) + 32px) 32px;
box-sizing: border-box;
display: grid;
place-content: center;
}
.loginMessage {
text-align: center;
margin: 8px 0 24px;
.form {
position: relative;
z-index: 10;
border-radius: var(--MI-radius);
background-color: var(--MI_THEME-panel);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
overflow: clip;
max-width: 500px;
width: calc(100vw - 64px);
height: min(65svh, calc(100svh - calc(env(safe-area-inset-bottom, 0px) + 64px)));
overflow-y: scroll;
}
.redirectRoot {
padding: 16px;
border-radius: var(--MI-radius);
background-color: var(--MI_THEME-bg);
}
.redirectUrl {
font-size: 90%;
padding: 12px;
border-radius: var(--MI-radius);
background-color: var(--MI_THEME-panel);
overflow-x: scroll;
}
</style>

View File

@ -4,40 +4,28 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
<template #header><MkPageHeader/></template>
<MkSpacer :contentMax="800">
<div v-if="$i">
<div v-if="permissions.length > 0">
<p v-if="name">{{ i18n.tsx._auth.permission({ name }) }}</p>
<p v-else>{{ i18n.ts._auth.permissionAsk }}</p>
<ul>
<li v-for="p in permissions" :key="p">{{ i18n.ts._permissions[p] }}</li>
</ul>
<div>
<MkAnimBg style="position: fixed; top: 0;"/>
<div :class="$style.formContainer">
<div :class="$style.form">
<MkAuthConfirm
ref="authRoot"
:name="name"
:permissions="permissions"
:waitOnDeny="true"
@accept="onAccept"
@deny="onDeny"
/>
</div>
<div v-if="name">{{ i18n.tsx._auth.shareAccess({ name }) }}</div>
<div v-else>{{ i18n.ts._auth.shareAccessAsk }}</div>
<form :class="$style.buttons" action="/oauth/decision" accept-charset="utf-8" method="post">
<input name="login_token" class="mk-input-token-hidden" type="hidden" :value="$i.token"/>
<input name="transaction_id" class="mk-input-tr-id-hidden" type="hidden" :value="transactionIdMeta?.content"/>
<MkButton inline name="cancel" value="cancel">{{ i18n.ts.cancel }}</MkButton>
<MkButton inline primary>{{ i18n.ts.accept }}</MkButton>
</form>
</div>
<div v-else>
<p :class="$style.loginMessage">{{ i18n.ts._auth.pleaseLogin }}</p>
<MkSignin @login="onLogin"/>
</div>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import MkSignin from '@/components/MkSignin.vue';
import MkButton from '@/components/MkButton.vue';
import { $i, login } from '@/account.js';
import { i18n } from '@/i18n.js';
import * as Misskey from 'misskey-js';
import MkAnimBg from '@/components/MkAnimBg.vue';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkAuthConfirm from '@/components/MkAuthConfirm.vue';
const transactionIdMeta = document.querySelector<HTMLMetaElement>('meta[name="misskey:oauth:transaction-id"]');
if (transactionIdMeta) {
@ -45,10 +33,44 @@ if (transactionIdMeta) {
}
const name = document.querySelector<HTMLMetaElement>('meta[name="misskey:oauth:client-name"]')?.content;
const permissions = document.querySelector<HTMLMetaElement>('meta[name="misskey:oauth:scope"]')?.content.split(' ') ?? [];
const permissions = document.querySelector<HTMLMetaElement>('meta[name="misskey:oauth:scope"]')?.content.split(' ').filter((p): p is typeof Misskey.permissions[number] => (Misskey.permissions as readonly string[]).includes(p)) ?? [];
function onLogin(res): void {
login(res.i);
function doPost(token: string, decision: 'accept' | 'deny') {
const form = document.createElement('form');
form.action = '/oauth/decision';
form.method = 'post';
form.acceptCharset = 'utf-8';
const loginToken = document.createElement('input');
loginToken.type = 'hidden';
loginToken.name = 'login_token';
loginToken.value = token;
form.appendChild(loginToken);
const transactionId = document.createElement('input');
transactionId.type = 'hidden';
transactionId.name = 'transaction_id';
transactionId.value = transactionIdMeta?.content ?? '';
form.appendChild(transactionId);
if (decision === 'deny') {
const cancel = document.createElement('input');
cancel.type = 'hidden';
cancel.name = 'cancel';
cancel.value = 'cancel';
form.appendChild(cancel);
}
document.body.appendChild(form);
form.submit();
}
function onAccept(token: string) {
doPost(token, 'accept');
}
function onDeny(token: string) {
doPost(token, 'deny');
}
definePageMetadata(() => ({
@ -58,15 +80,24 @@ definePageMetadata(() => ({
</script>
<style lang="scss" module>
.buttons {
margin-top: 16px;
display: flex;
gap: 8px;
flex-wrap: wrap;
.formContainer {
min-height: 100svh;
padding: 32px 32px calc(env(safe-area-inset-bottom, 0px) + 32px) 32px;
box-sizing: border-box;
display: grid;
place-content: center;
}
.loginMessage {
text-align: center;
margin: 8px 0 24px;
.form {
position: relative;
z-index: 10;
border-radius: var(--MI-radius);
background-color: var(--MI_THEME-panel);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
overflow: clip;
max-width: 500px;
width: calc(100vw - 64px);
height: min(65svh, calc(100svh - calc(env(safe-area-inset-bottom, 0px) + 64px)));
overflow-y: scroll;
}
</style>

View File

@ -19,13 +19,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { defineAsyncComponent, ref, computed } from 'vue';
import { ref, computed } from 'vue';
import type * as Misskey from 'misskey-js';
import FormSuspense from '@/components/form/suspense.vue';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { getAccounts, addAccount as addAccounts, removeAccount as _removeAccount, login, $i } from '@/account.js';
import { getAccounts, removeAccount as _removeAccount, login, $i, getAccountWithSigninDialog, getAccountWithSignupDialog } from '@/account.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
@ -45,7 +45,7 @@ const init = async () => {
});
};
function menu(account, ev) {
function menu(account: Misskey.entities.UserDetailed, ev: MouseEvent) {
os.popupMenu([{
text: i18n.ts.switch,
icon: 'ti ti-switch-horizontal',
@ -58,7 +58,7 @@ function menu(account, ev) {
}], ev.currentTarget ?? ev.target);
}
function addAccount(ev) {
function addAccount(ev: MouseEvent) {
os.popupMenu([{
text: i18n.ts.existingAccount,
action: () => { addExistingAccount(); },
@ -68,28 +68,26 @@ function addAccount(ev) {
}], ev.currentTarget ?? ev.target);
}
async function removeAccount(account) {
async function removeAccount(account: Misskey.entities.UserDetailed) {
await _removeAccount(account.id);
accounts.value = accounts.value.filter(x => x.id !== account.id);
}
function addExistingAccount() {
os.popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {}, {
done: async res => {
await addAccounts(res.id, res.i);
getAccountWithSigninDialog().then((res) => {
if (res != null) {
os.success();
init();
},
}, 'closed');
}
});
}
function createAccount() {
os.popup(defineAsyncComponent(() => import('@/components/MkSignupDialog.vue')), {}, {
done: async res => {
await addAccounts(res.id, res.i);
switchAccountWithToken(res.i);
},
}, 'closed');
getAccountWithSignupDialog().then((res) => {
if (res != null) {
switchAccountWithToken(res.token);
}
});
}
async function switchAccount(account: any) {

View File

@ -0,0 +1,16 @@
import * as Misskey from 'misskey-js';
import { defaultStore } from '@/store.js';
export function filterMutedNotification(notification: Misskey.entities.Notification): boolean {
switch (notification.type) {
case 'reaction':
if (defaultStore.state.mutedReactions.includes(notification.reaction.replace('@.', ''))) return false;
break;
case 'reaction:grouped':
notification.reactions = notification.reactions.filter(reaction => !defaultStore.state.mutedReactions.includes(reaction.reaction.replace('@.', '')));
if (notification.reactions.length === 0) return false;
break;
}
return true;
}

View File

@ -51,6 +51,7 @@ import { swInject } from './sw-inject.js';
import XNotification from './notification.vue';
import { popups } from '@/os.js';
import { pendingApiRequestsCount } from '@/scripts/misskey-api.js';
import { filterMutedNotification } from '@/scripts/filter-muted-notification.js';
import { uploads } from '@/scripts/upload.js';
import * as sound from '@/scripts/sound.js';
import { $i } from '@/account.js';
@ -73,6 +74,8 @@ function onNotification(notification: Misskey.entities.Notification, isClient =
useStream().send('readNotification');
}
if (!filterMutedNotification(notification)) return;
notifications.value.unshift(notification);
window.setTimeout(() => {
if (notifications.value.length > 3) notifications.value.pop();

View File

@ -107,6 +107,11 @@ export function getConfig(): UserConfig {
}
},
},
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
define: {

View File

@ -26,19 +26,19 @@
"devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0",
"@types/matter-js": "0.19.7",
"@types/node": "22.2.0",
"@types/node": "22.7.8",
"@types/seedrandom": "3.0.8",
"@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/parser": "7.10.0",
"eslint": "8.57.0",
"nodemon": "3.1.4",
"typescript": "5.5.4"
"eslint": "8.57.1",
"nodemon": "3.1.7",
"typescript": "5.6.3"
},
"files": [
"built"
],
"dependencies": {
"esbuild": "0.23.0",
"esbuild": "0.24.0",
"eventemitter3": "5.0.1",
"glob": "11.0.0",
"matter-js": "0.20.0",

View File

@ -9,15 +9,15 @@
"devDependencies": {
"@misskey-dev/eslint-plugin": "^1.0.0",
"@readme/openapi-parser": "2.6.0",
"@types/node": "22.2.0",
"@types/node": "22.7.8",
"@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/parser": "7.10.0",
"eslint": "8.57.0",
"eslint": "8.57.1",
"openapi-types": "12.1.3",
"openapi-typescript": "6.7.6",
"ts-case-convert": "2.0.7",
"tsx": "4.17.0",
"typescript": "5.5.4"
"ts-case-convert": "2.1.0",
"tsx": "4.19.1",
"typescript": "5.6.3"
},
"files": [
"built"

View File

@ -1,7 +1,7 @@
{
"type": "module",
"name": "misskey-js",
"version": "2024.5.0-oscar.16a`",
"version": "2024.5.0-oscar.16a",
"description": "Misskey SDK for JavaScript",
"types": "./built/dts/index.d.ts",
"exports": {

View File

@ -58,7 +58,7 @@ export class APIClient {
this.fetch(`${this.origin}/api/${endpoint}`, {
method: 'POST',
body: JSON.stringify({
...params,
...(params ?? {}),
i: credential !== undefined ? credential : this.credential,
}),
headers: {

File diff suppressed because it is too large Load Diff

View File

@ -25,16 +25,16 @@
},
"devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0",
"@types/node": "22.2.0",
"@types/node": "22.7.8",
"@typescript-eslint/eslint-plugin": "7.10.0",
"@typescript-eslint/parser": "7.10.0",
"eslint": "8.57.0",
"nodemon": "3.1.4",
"typescript": "5.5.4"
"eslint": "8.57.1",
"nodemon": "3.1.7",
"typescript": "5.6.3"
},
"dependencies": {
"crc-32": "1.2.2",
"esbuild": "0.23.0",
"esbuild": "0.24.0",
"glob": "11.0.0"
},
"files": [

View File

@ -9,18 +9,18 @@
"lint": "pnpm typecheck && pnpm eslint"
},
"dependencies": {
"esbuild": "0.23.0",
"esbuild": "0.24.0",
"idb-keyval": "6.2.1",
"misskey-js": "workspace:*"
},
"devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0",
"@types/serviceworker": "0.0.92",
"@types/serviceworker": "0.0.101",
"@typescript-eslint/parser": "7.10.0",
"eslint": "8.57.0",
"eslint-plugin-import": "2.29.1",
"nodemon": "3.1.4",
"typescript": "5.5.4"
"eslint": "8.57.1",
"eslint-plugin-import": "2.31.0",
"nodemon": "3.1.7",
"typescript": "5.6.3"
},
"type": "module"
}

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
"mdast-util-to-string": "4.0.0",
"remark": "15.0.1",
"remark-parse": "11.0.0",
"typescript": "5.3.3",
"typescript": "5.6.3",
"unified": "11.0.4",
"vite": "5.0.12",
"vite-node": "1.1.3",