diff --git a/.gitignore b/.gitignore index 31cafd9df..4c690d7de 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ ormconfig.json packages/client/.yarn/* packages/backend/.yarn/* packages/sw/.yarn/* + +# TypeScript +tsconfig.tsbuildinfo diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 9246e09b8..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "misskey-assets"] - path = misskey-assets - url = https://github.com/misskey-dev/assets.git diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 42264548e..795562e70 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,6 @@ { "recommendations": [ "editorconfig.editorconfig", - "eg2.vscode-npm-script", "dbaeumer.vscode-eslint", "Vue.volar", "Vue.vscode-typescript-vue-plugin" diff --git a/CHANGELOG.md b/CHANGELOG.md index 979da3608..ddf8b64c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 This changelog covers changes since Misskey v12.111.1, the version prior to the FoundKey fork. For older Misskey versions, see [CHANGELOG-OLD.md](./CHANGELOG-OLD.md). +Unreleased changes should not be listed in this file. +Instead, run `git shortlog --format='%h %s' --group=trailer:changelog ..` to see unreleased changes; replace `` with the tag you wish to compare from. +If you are a contributor, please read CONTRIBUTING.md, section "Changelog Trailer" on what to do instead. + ## Unreleased ### Added - Client: Show instance info in ticker @@ -37,6 +41,7 @@ For older Misskey versions, see [CHANGELOG-OLD.md](./CHANGELOG-OLD.md). ### Security - Server: Update `multer` dependency to resolve [CVE-2022-24434](https://nvd.nist.gov/vuln/detail/CVE-2022-24434) +- Server: Update `file-type`, `got`, and `sharp` dependencies to fix various security issues ## 13.0.0-preview1 - 2022-08-05 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a37df3bde..9a42fdf04 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,61 +1,46 @@ # Contribution guide -We're glad you're interested in contributing Misskey! In this document you will find the information you need to contribute to the project. +We're glad you're interested in contributing to Foundkey! In this document you will find the information you need to contribute to the project. -> **Note** -> This project uses Japanese as its major language, **but you do not need to translate and write the Issues/PRs in Japanese.** -> Also, you might receive comments on your Issue/PR in Japanese, but you do not need to reply to them in Japanese as well.\ -> The accuracy of machine translation into Japanese is not high, so it will be easier for us to understand if you write it in the original language. -> It will also allow the reader to use the translation tool of their preference if necessary. +The project uses English as its primary language. However due to being a fork of Misskey (which uses Japanese as its primary language) you may find things that are in Japanese. +If you make contributions (pull requests, commits, comments in newly added code etc.) we expect that these should be in English. + +We won't mind if issues are not in English but we cannot guarantee we will understand you correctly. +However it might stíll be better if you write issues in your original language if you are not confident of your English skills because we might be able to use different translators or ask people to translate if we are not sure what you mean. +Please understand that in such cases we might edit your issue to translate it, to help us avoid duplicating issues. + +## Development platform +FoundKey generally assumes that it is running on a Unix-like platform (e.g. Linux or macOS). If you are using Windows for development, we highly suggest using the Windows Subsystem for Linux (WSL) as the development environment. ## Roadmap See [ROADMAP.md](./ROADMAP.md) ## Issues -Before creating an issue, please check the following: -- To avoid duplication, please search for similar issues before creating a new issue. -- Do not use Issues to ask questions or troubleshooting. - - Issues should only be used to feature requests, suggestions, and bug tracking. - - Please ask questions or troubleshooting in the [Misskey Forum](https://forum.misskey.io/) or [Discord](https://discord.gg/Wp8gVStHW3). +Issues are intended for feature requests and bug tracking. -> **Warning** -> Do not close issues that are about to be resolved. It should remain open until a commit that actually resolves it is merged. +For technical support or if you are not sure if what you are experiencing is a bug you can talk to people on the [IRC server](https://irc.akkoma.dev) in the `#foundkey` channel first. -## Before implementation -When you want to add a feature or fix a bug, **first have the design and policy reviewed in an Issue** (if it is not there, please make one). Without this step, there is a high possibility that the PR will not be merged even if it is implemented. - -At this point, you also need to clarify the goals of the PR you will create, and make sure that the other members of the team are aware of them. -PRs that do not have a clear set of do's and don'ts tend to be bloated and difficult to review. - -Also, when you start implementation, assign yourself to the Issue (if you cannot do it yourself, ask another member to assign you). By expressing your intention to work the Issue, you can prevent conflicts in the work. +Please do not close issues that are about to be resolved. It should remain open until a commit that actually resolves it is merged. ## Well-known branches -- **`master`** branch is tracking the latest release and used for production purposes. -- **`develop`** branch is where we work for the next release. - - When you create a PR, basically target it to this branch. -- **`l10n_develop`** branch is reserved for localization management. +branch|what it's for +---|--- +main|development branch -## Creating a PR -Thank you for your PR! Before creating a PR, please check the following: -- If possible, prefix the title with a keyword that identifies the type of this PR, as shown below. - - `fix` / `refactor` / `feat` / `enhance` / `perf` / `chore` etc - - Also, make sure that the granularity of this PR is appropriate. Please do not include more than one type of change or interest in a single PR. -- If there is an Issue which will be resolved by this PR, please include a reference to the Issue in the text. -- Please add the summary of the changes to [`CHANGELOG.md`](/CHANGELOG.md). However, this is not necessary for changes that do not affect the users, such as refactoring. -- Check if there are any documents that need to be created or updated due to this change. -- If you have added a feature or fixed a bug, please add a test case if possible. -- Please make sure that tests and Lint are passed in advance. - - You can run it with `npm run test` and `npm run lint`. [See more info](#testing) -- If this PR includes UI changes, please attach a screenshot in the text. +For a production environment you might not want to follow the `main` branch directly but instead check out one of the git tags. -Thanks for your cooperation 🤗 +## Considerations to be made for all contributions -## Reviewers guide -Be willing to comment on the good points and not just the things you want fixed 💯 +This project follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html). +Significant changes should be listed in the changelog (i.e. the file called `CHANGELOG.md`, see also section "Changelog Trailer" below). +Although Semantic Versioning talks about "the API", changes to the user interface should also be tracked. + +Consider if any of the existing documentation has to be updated because of your contribution. + +Some more points you might want to consider are: -### Review perspective - Scope - - Are the goals of the PR clear? - - Is the granularity of the PR appropriate? + - Are the goals of the PR clear? + - Is the granularity of the PR appropriate? - Security - Does merging this PR create a vulnerability? - Performance @@ -66,39 +51,98 @@ Be willing to comment on the good points and not just the things you want fixed - Are there any omissions or gaps? - Does it check for anomalies? -## Deploy -The `/deploy` command by issue comment can be used to deploy the contents of a PR to the preview environment. -``` -/deploy sha= -``` -An actual domain will be assigned so you can test the federation. +## Code contributions -## Merge -For now, basically only @syuilo has the authority to merge PRs into develop because he is most familiar with the codebase. -However, minor fixes, refactoring, and urgent changes may be merged at the discretion of a contributor. +There are different "rules" of how you can contribute, depending on your access privileges to the repository. + +### Without push access + +If you do not have push access, you have to create a pull request to get your changes into Foundkey. +Someone with push access should review your contribution. +If they are satisfied that what you are doing seems like a good idea and the considerations from the section above are fulfilled, they can merge your pull request. +Or, they might request another member to also review your changes. +Please be patient as nobody is getting paid to do this, so it might take a bit longer. + +### With push access + +You can push stuff directly to any branch. +But y'know, "with great power comes great responsibility" and so on, be sensible. +We most likely will not kick you out if you made a mistake, it happens to the best. +But this of course means that the erroneous contributions may be either fixed or undone. + +Alternatively, you can also proceed as for "without push access" above. +In this case it will be assumed that you wish for a review of the changes you want to make. +Instead of having someone else merge the pull request when they have approved your changes, you can also merge yourself if you think the given feedback is sufficient. + +### Changelog Trailer + +To keep track of changes that should go into the CHANGELOG, we use a standard [trailer](https://git-scm.com/docs/git-interpret-trailers). +For single-commits that should be included in the changeset, include the trailer directly. +For multiple commits, the merge commit (in case of a branch) or an empty final commit should include the trailer. + +Valid values for the trailer are: "Added", "Changed", "Removed", "Fixed", "Security". +For breaking changes, include a "BREAKING:" in the summary. +Any additional notes should go into the commit body. + +If you forget to include it, you can create an empty commit after the fact with it (`--allow-empty`). +Try not to include invalid values in the trailer. + +Here is an example complete breaking commit with notes. + +``` +BREAKING: client: remove rooms + +Rooms were removed by syuilo some time ago. +This commit is an example of what the changelog trailer usage is like. +Admins should ensure to run migrations on startup, else foundkey will fail to start. + +Changelog: Removed +``` + +### Creating a PR + +- Please prefix the title with the part of Misskey you are changing, i.e. `server:` or `client:` +- The rest of the title should roughly describe what you did. +- Make sure that the granularity of this PR is appropriate. Please do not include more than one type of change in a single PR. +- If there is an issue which will be resolved by this PR, please include a reference to the Issue in the text. +- If you have added a feature or fixed a bug, please add a test case if possible. +- Please make sure that tests and Lint are passed in advance. + - You can run it with `npm run test` and `npm run lint`. [See more info](#testing) +- Don't forget to update the changelog and/or documentation as appropriate (see above). + +Thanks for your cooperation! ## Release -### Release Instructions -1. Commit version changes in the `develop` branch ([package.json](https://github.com/misskey-dev/misskey/blob/develop/package.json)) -2. Create a release PR. - - Into `master` from `develop` branch. - - The title must be in the format `Release: x.y.z`. - - `x.y.z` is the new version you are trying to release. -3. Deploy and perform a simple QA check. Also verify that the tests passed. -4. Merge it. -5. Create a [release of GitHub](https://github.com/misskey-dev/misskey/releases) - - The target branch must be `master` - - The tag name must be the version + +### Fork transition + +**Note:** +Since Foundkey was forked from Misskey recently, there might be some breaking changes we want to make. +For this purpose there will be several pre-release versions of 13.0.0 (e.g. `13.0.0-preview1`). +Until major version 13 is released, the below process is not fully in effect. + +### Release process +Before a stable version is released, there should be a comment period which should usually be 7 days to give everyone the chance to comment. +If a (critical) bug or similar is found during the comment period, the release may be postponed until a fix is found. +For commenting, an issue should be created, and the comment period should also be announced in the `#foundkey-dev` [IRC](https://irc.akkoma.dev) channel. + +Pre-releases do not require as much scrutiny and can be useful for "field testing" before a stable release is made. + +All releases are managed as git tags. +If the released version is 1.2.3, the git tag should be "v1.2.3". +Pre-releases are marked "previewN". +The first pre-release for 1.2.3 should be tagged "v1.2.3-preview1". +The tag should be a "lightweight" tag (not annotated) of the commit that modifies the CHANGELOG and package.json version. + +To generate the changelog, we use a standard shortlog command: `git shortlog --format='%h %s' --group=trailer:changelog LAST_TAG..`. +The person performing the release process should build the next CHANGELOG section based on this output, not use it as-is. +Full releases should also remove any pre-release CHANGELOG sections. ## Localization (l10n) -Misskey uses [Crowdin](https://crowdin.com/project/misskey) for localization management. -You can improve our translations with your Crowdin account. -Your changes in Crowdin are automatically submitted as a PR (with the title "New Crowdin translations") to the repository. -The owner [@syuilo](https://github.com/syuilo) merges the PR into the develop branch before the next release. -If your language is not listed in Crowdin, please open an issue. - -![Crowdin](https://d322cqt584bo4o.cloudfront.net/misskey/localized.svg) +We have not yet set up localization management, so updating of locales can currently only be done as commits changing the respective files in the repo. +Localization files are found in `/locales/` and are YAML files using the `yml` file extension. +The file name consists of the [IETF BCP 47](https://www.rfc-editor.org/info/bcp47) language code. ## Development During development, it is useful to use the `npm run dev` command. @@ -132,27 +176,34 @@ npx cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT="./ ### e2e tests TODO -## Continuous integration -Misskey uses GitHub Actions for executing automated tests. -Configuration files are located in [`/.github/workflows`](/.github/workflows). +## Continuous integration (CI) + +Foundkey uses Woodpecker for executing automated tests and lints. +CI runs can be found at [ci.akkoma.dev](https://ci.akkoma.dev/FoundKeyGang/FoundKey) +Configuration files are located in `/.woodpecker/`. ## Vue Misskey uses Vue(v3) as its front-end framework. -- Use TypeScript. -- **When creating a new component, please use the Composition API (with [setup sugar](https://v3.vuejs.org/api/sfc-script-setup.html) and [ref sugar](https://github.com/vuejs/rfcs/discussions/369)) instead of the Options API.** - - Some of the existing components are implemented in the Options API, but it is an old implementation. Refactors that migrate those components to the Composition API are also welcome. +- Use TypeScript functionality. + - Use the type only variant of `defineProps` and `defineEmits`. +- When creating a new component, please use the Composition API (with [setup sugar](https://v3.vuejs.org/api/sfc-script-setup.html) and [ref sugar](https://github.com/vuejs/rfcs/discussions/369)) instead of the Options API. + - Some of the existing components are implemented in the Options API, but it is an old implementation. Refactors that migrate those components to the Composition API are welcome. + You might be able to use this shell command to find components that have not yet been refactored: `find packages/client/src -name '*.vue' | xargs grep '. + +### typeorm placeholders +The names of placeholders used in queries must be unique in each query. + +For example ``` ts query.andWhere(new Brackets(qb => { for (const type of ps.fileType) { @@ -160,8 +211,8 @@ query.andWhere(new Brackets(qb => { } })); ``` -と書くと、ループ中で`type`というプレースホルダが複数回使われてしまいおかしくなる -だから次のようにする必要がある +would mean that `type` is used multiple times because it is used in a loop. +This is incorrect. instead you would need to do something like the following: ```ts query.andWhere(new Brackets(qb => { for (const type of ps.fileType) { @@ -171,82 +222,79 @@ query.andWhere(new Brackets(qb => { })); ``` -### Not `null` in TypeORM -```ts -const foo = await Foos.findOne({ - bar: Not(null) -}); -``` -のようなクエリ(`bar`が`null`ではない)は期待通りに動作しない。 -次のようにします: +### `null` (JS/TS) and `NULL` (SQL) +#### in TypeORM FindOptions +Using the JavaScript/TypeScript `null` constant is not supported in Typeorm. Instead you need to use the special `Null()` function Typeorm provides. +It can also be combined with other similar TypeORM functions. + +For example to make a condition similar to SQL `IS NOT NULL`, do the following: ```ts +import { IsNull, Not } from 'typeorm'; + const foo = await Foos.findOne({ bar: Not(IsNull()) }); ``` -### `null` in SQL -SQLを発行する際、パラメータが`null`になる可能性のある場合はSQL文を出し分けなければならない -例えば +#### in SQL queries or `QueryBuilder`s +In SQL statements, you need to have separate statements for cases where parameters may be `null`. + +Take for example this snippet: ``` ts query.where('file.folderId = :folderId', { folderId: ps.folderId }); ``` -という処理で、`ps.folderId`が`null`だと結果的に`file.folderId = null`のようなクエリが発行されてしまい、これは正しいSQLではないので期待した結果が得られない -だから次のようにする必要がある +If `ps.folderId === null`, the resulting query would be `file.folderId = null` which is incorrect and might produce unexpected results. + +What you need to do instead is something like the following: ``` ts -if (ps.folderId) { +if (ps.folderId != null) { query.where('file.folderId = :folderId', { folderId: ps.folderId }); } else { query.where('file.folderId IS NULL'); } ``` -### `[]` in SQL -SQLを発行する際、`IN`のパラメータが`[]`(空の配列)になる可能性のある場合はSQL文を出し分けなければならない -例えば +### Empty array handling in TypeORM FindOptions +If you are using the `In` function in `FindOptions`, there must be different behaviour if it may receive empty arrays. + ``` ts const users = await Users.find({ id: In(userIds) }); ``` -という処理で、`userIds`が`[]`だと結果的に`user.id IN ()`のようなクエリが発行されてしまい、これは正しいSQLではないので期待した結果が得られない -だから次のようにする必要がある +This would produce erroneous SQL, i.e. `user.id IN ()`. +To fix this you would need separate handling for an empty array, for example like this: ``` ts const users = userIds.length > 0 ? await Users.find({ id: In(userIds) }) : []; ``` -### 配列のインデックス in SQL -SQLでは配列のインデックスは**1始まり**。 -`[a, b, c]`の `a`にアクセスしたいなら`[0]`ではなく`[1]`と書く +### Array indexing in SQL +PostgreSQL array indices **start at 1**. -### null IN -nullが含まれる可能性のあるカラムにINするときは、そのままだとおかしくなるのでORなどでnullのハンドリングをしよう。 +### `NULL IN ...` +When `IN` is performed on a column that may contain `NULL` values, use `OR` or similar to handle `NULL` values. -### `undefined`にご用心 -MongoDBの時とは違い、findOneでレコードを取得する時に対象レコードが存在しない場合 **`undefined`** が返ってくるので注意。 -MongoDBは`null`で返してきてたので、その感覚で`if (x === null)`とか書くとバグる。代わりに`if (x == null)`と書いてください - -### Migration作成方法 -packages/backendで: +### creating migrations +In `packages/backend`, run: ```sh npx typeorm migration:generate -d ormconfig.js -o ``` -- 生成後、ファイルをmigration下に移してください -- 作成されたスクリプトは不必要な変更を含むため除去してください +After generating (and potentially editing) the file, move it to the `packages/backend/migration` folder. -### コネクションには`markRaw`せよ -**Vueのコンポーネントのdataオプションとして**misskey.jsのコネクションを設定するとき、必ず`markRaw`でラップしてください。インスタンスが不必要にリアクティブ化されることで、misskey.js内の処理で不具合が発生するとともに、パフォーマンス上の問題にも繋がる。なお、Composition APIを使う場合はこの限りではない(リアクティブ化はマニュアルなため)。 +### `markRaw` for connections +When setting up a foundkey-js streaming connection as a data option to a Vue component, be sure to wrap it in `markRaw`. +Unnecessarily reactivating a connection causes problems with processing in foundkey-js and leads to performance issues. +This does not apply when using the Composition API since reactivation is manual. -### JSONのimportに気を付けよう -TypeScriptでjsonをimportすると、tscでコンパイルするときにそのjsonファイルも一緒にdistディレクトリに吐き出されてしまう。この挙動により、意図せずファイルの書き換えが発生することがあるので、jsonをimportするときは書き換えられても良いものかどうか確認すること。書き換えされて欲しくない場合は、importで読み込むのではなく、`fs.readFileSync`などの関数を使って読み込むようにすればよい。 +### JSON imports +If you import json in TypeScript, the json file will be spit out together with the TypeScript file into the dist directory when compiling with tsc. This behavior may cause unintentional rewriting of files, so when importing json files, be sure to check whether the files are allowed to be rewritten or not. If you do not want the file to be rewritten, you should make sure that the file can be rewritten by importing the json file. If you do not want the file to be rewritten, use functions such as `fs.readFileSync` to read the file instead of importing it. -### コンポーネントのスタイル定義でmarginを持たせない -コンポーネント自身がmarginを設定するのは問題の元となることはよく知られている -marginはそのコンポーネントを使う側が設定する +### Component style definitions do not have a `margin` +Setting the `margin` of a component may be confusing. +Instead, it should always be the user of a component that sets a `margin`. -## その他 -### HTMLのクラス名で follow という単語は使わない -広告ブロッカーで誤ってブロックされる +### Do not use the word "follow" in HTML class names +This has caused things to be blocked by an ad blocker in the past. diff --git a/README.md b/README.md index 017cc6d5f..7c3164472 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,13 @@ -
- - Misskey logo - - -**🌎 **[Misskey](https://misskey-hub.net/)** is an open source, decentralized social media platform that's free forever! 🚀** - ---- +# FoundKey +FoundKey is a free and open source microblogging server compatible with ActivityPub. Forked from Misskey, FoundKey improves on maintainability and behaviour, while also bringing in useful features. - - find an instance - - - create an instance - - - become a contributor - - - join the community - - - become a patron - ---- - -
- -
- - - -## ✨ Features -- **ActivityPub support**\ -Not on Misskey? No problem! Not only can Misskey instances talk to each other, but you can make friends with people on other networks like Mastodon and Pixelfed! -- **Reactions**\ -You can add emoji reactions to any post! No longer are you bound by a like button, show everyone exactly how you feel with the tap of a button. -- **Drive**\ -With Misskey's built in drive, you get cloud storage right in your social media, where you can upload any files, make folders, and find media from posts you've made! -- **Rich Web UI**\ - Misskey has a rich and easy to use Web UI! - It is highly customizable, from changing the layout and adding widgets to making custom themes. - Furthermore, plugins can be created using AiScript, an original programming language. -- And much more... - -
- -
+See the [changelog](./CHANGELOG.md) and [roadmap](./ROADMAP.md) for more on what's changed and future plans. ## Documentation +FoundKey's documentation is a work in progress. In the meantime, much of the documentation on the [Misskey Hub](https://misskey-hub.net/) will also apply to FoundKey. -Misskey Documentation can be found at [Misskey Hub](https://misskey-hub.net/), some of the links and graphics above also lead to specific portions of it. +## Contributing +If you're interested in helping out with the project, please read the [contributing guide](./CONTRIBUTING.md). ## Sponsors FoundKey is not interested in sponsorships. diff --git a/docker-compose.yml b/docker-compose.yml index 0bf17a555..bd0060292 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: redis: restart: always - image: redis:4.0-alpine + image: redis:7.0-alpine networks: - internal_network volumes: @@ -27,7 +27,7 @@ services: db: restart: always - image: postgres:12.2-alpine + image: postgres:14.5-alpine networks: - internal_network env_file: diff --git a/locales/en-US.yml b/locales/en-US.yml index 7038dab5c..2c8734f87 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -847,6 +847,7 @@ typeToConfirm: "Please enter {x} to confirm" deleteAccount: "Delete account" numberOfPageCache: "Number of cached pages" numberOfPageCacheDescription: "Increasing this number will improve convenience for users but cause more server load as well as more memory to be used." +document: "Document" file: "File" unclip: "Unclip" confirmToUnclipAlreadyClippedNote: "This note is already part of the \"{name}\" clip. Do you want to remove it from this clip instead?" @@ -987,6 +988,10 @@ _serverDisconnectedBehavior: reload: "Automatically reload" dialog: "Show warning dialog" quiet: "Show unobtrusive warning" +maxCustomEmojiPicker: "Maximum suggested custom emoji in picker" +maxCustomEmojiPickerDescription: "0 for unlimited" +maxUnicodeEmojiPicker: "Maximum suggested unicode emoji in picker" +maxUnicodeEmojiPickerDescription: "0 for unlimited" _channel: create: "Create channel" edit: "Edit channel" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6b4a99c4a..95d2868ed 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -854,6 +854,7 @@ typeToConfirm: "この操作を行うには {x} と入力してください" deleteAccount: "アカウント削除" numberOfPageCache: "ページキャッシュ数" numberOfPageCacheDescription: "多くすると利便性が向上しますが、負荷とメモリ使用量が増えます。" +document: "ドキュメント" _emailUnavailable: used: "既に使用されています" diff --git a/misskey-assets b/misskey-assets deleted file mode 160000 index 0179793ec..000000000 --- a/misskey-assets +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0179793ec891856d6f37a3be16ba4c22f67a81b5 diff --git a/package.json b/package.json index 98e2be5ac..2433eacb5 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "packages/*" ], "scripts": { - "build": "yarn workspaces foreach --topological run build && yarn run gulp", + "build": "yarn workspaces foreach --parallel --topological run build && yarn run gulp", "start": "yarn workspace backend run start", "start:test": "yarn workspace backend run start:test", "init": "yarn migrate", @@ -26,8 +26,8 @@ "mocha": "yarn workspace backend run mocha", "test": "yarn mocha", "format": "gulp format", - "clean": "node ./scripts/clean.js", - "clean-all": "node ./scripts/clean-all.js", + "clean": "yarn workspaces foreach run clean && rm -rf built/", + "clean-all": "yarn workspaces foreach run clean-all && rm -rf built/ node_modules/", "cleanall": "yarn clean-all" }, "dependencies": { @@ -42,11 +42,11 @@ "devDependencies": { "@types/gulp": "4.0.9", "@types/gulp-rename": "2.0.1", - "@typescript-eslint/parser": "5.30.0", + "@typescript-eslint/parser": "^5.36.2", "cross-env": "7.0.3", "cypress": "10.3.0", "start-server-and-test": "1.14.0", - "typescript": "4.7.4" + "typescript": "4.8.2" }, "packageManager": "yarn@3.2.3" } diff --git a/packages/backend/package.json b/packages/backend/package.json index b0b2be112..d42f83f4a 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -6,6 +6,8 @@ "type": "module", "scripts": { "build": "tsc -p tsconfig.json || echo done. && tsc-alias -p tsconfig.json", + "clean": "rm -rf built/ tsconfig.tsbuildinfo", + "clean-all": "yarn clean && rm -rf node_modules/", "watch": "node watch.mjs", "lint": "eslint src --ext .ts", "mocha": "cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha", @@ -49,10 +51,10 @@ "deep-email-validator": "0.1.21", "escape-regexp": "0.0.1", "feed": "4.2.2", - "file-type": "17.1.2", + "file-type": "18.0.0", "fluent-ffmpeg": "2.1.2", "foundkey-js": "workspace:*", - "got": "12.1.0", + "got": "12.3.1", "hpagent": "0.1.2", "ioredis": "4.28.5", "ip-cidr": "3.0.10", @@ -88,7 +90,7 @@ "pug": "3.0.2", "punycode": "2.1.1", "pureimage": "0.3.14", - "qrcode": "1.5.0", + "qrcode": "1.5.1", "random-seed": "0.3.0", "ratelimiter": "3.4.1", "re2": "1.17.7", @@ -100,7 +102,7 @@ "rss-parser": "3.12.0", "sanitize-html": "2.7.0", "semver": "7.3.7", - "sharp": "0.29.3", + "sharp": "0.30.7", "speakeasy": "2.0.0", "strict-event-emitter-types": "2.0.0", "stringz": "2.1.0", @@ -111,8 +113,8 @@ "tinycolor2": "1.4.2", "tmp": "0.2.1", "ts-loader": "9.3.1", - "ts-node": "10.8.1", - "tsc-alias": "1.6.11", + "ts-node": "10.9.1", + "tsc-alias": "1.7.0", "tsconfig-paths": "4.0.0", "twemoji-parser": "14.0.0", "typeorm": "0.3.7", @@ -135,7 +137,7 @@ "@types/jsdom": "16.2.14", "@types/jsonld": "1.5.6", "@types/jsrsasign": "10.5.1", - "@types/koa": "2.13.4", + "@types/koa": "2.13.5", "@types/koa-bodyparser": "4.3.7", "@types/koa-cors": "0.0.2", "@types/koa-favicon": "2.0.21", @@ -147,20 +149,20 @@ "@types/koa__multer": "2.0.4", "@types/koa__router": "8.0.11", "@types/mocha": "9.1.1", - "@types/node": "18.0.0", + "@types/node": "18.7.15", "@types/node-fetch": "3.0.3", - "@types/nodemailer": "6.4.4", + "@types/nodemailer": "6.4.5", "@types/oauth": "^0.9.1", "@types/pug": "2.0.6", "@types/punycode": "2.1.0", - "@types/qrcode": "1.4.2", + "@types/qrcode": "1.5.0", "@types/random-seed": "0.3.3", "@types/ratelimiter": "3.4.3", "@types/redis": "4.0.11", "@types/rename": "1.0.4", "@types/sanitize-html": "2.6.2", - "@types/semver": "7.3.10", - "@types/sharp": "0.30.4", + "@types/semver": "7.3.12", + "@types/sharp": "0.30.5", "@types/sinonjs__fake-timers": "8.1.2", "@types/speakeasy": "2.0.7", "@types/tinycolor2": "1.4.3", @@ -169,13 +171,13 @@ "@types/web-push": "3.3.2", "@types/websocket": "1.0.5", "@types/ws": "8.5.3", - "@typescript-eslint/eslint-plugin": "^5.35.1", - "@typescript-eslint/parser": "^5.30.0", + "@typescript-eslint/eslint-plugin": "^5.36.2", + "@typescript-eslint/parser": "^5.36.2", "cross-env": "7.0.3", "eslint": "^8.20.0", "eslint-plugin-import": "^2.26.0", "execa": "6.1.0", "form-data": "^4.0.0", - "typescript": "^4.7.4" + "typescript": "^4.8.2" } } diff --git a/packages/backend/src/boot/index.ts b/packages/backend/src/boot/index.ts index 0cfeca1d3..ad52686c8 100644 --- a/packages/backend/src/boot/index.ts +++ b/packages/backend/src/boot/index.ts @@ -17,7 +17,7 @@ const ev = new Xev(); /** * Init process */ -export default async function(): void { +export default async function(): Promise { process.title = `Misskey (${cluster.isPrimary ? 'master' : 'worker'})`; if (cluster.isPrimary || envOption.disableClustering) { diff --git a/packages/backend/src/boot/master.ts b/packages/backend/src/boot/master.ts index 8583823ee..67cfcca63 100644 --- a/packages/backend/src/boot/master.ts +++ b/packages/backend/src/boot/master.ts @@ -49,7 +49,7 @@ function greet(): void { /** * Init master process */ -export async function masterMain(): void { +export async function masterMain(): Promise { let config!: Config; // initialize app @@ -141,7 +141,7 @@ async function connectDb(): Promise { } } -async function spawnWorkers(limit = 1): void { +async function spawnWorkers(limit = 1): Promise { const workers = Math.min(limit, os.cpus().length); bootLogger.info(`Starting ${workers} worker${workers === 1 ? '' : 's'}...`); await Promise.all([...Array(workers)].map(spawnWorker)); diff --git a/packages/backend/src/boot/worker.ts b/packages/backend/src/boot/worker.ts index 98731660d..af2df4471 100644 --- a/packages/backend/src/boot/worker.ts +++ b/packages/backend/src/boot/worker.ts @@ -4,7 +4,7 @@ import { initDb } from '@/db/postgre.js'; /** * Init worker process */ -export async function workerMain() { +export async function workerMain(): Promise { await initDb(); // start server diff --git a/packages/backend/src/models/repositories/note-reaction.ts b/packages/backend/src/models/repositories/note-reaction.ts index 77981d59d..c3440f125 100644 --- a/packages/backend/src/models/repositories/note-reaction.ts +++ b/packages/backend/src/models/repositories/note-reaction.ts @@ -35,7 +35,7 @@ export const NoteReactionRepository = db.getRepository(NoteReaction).extend({ src: NoteReaction[], me?: { id: User['id'] } | null | undefined, options?: { - withNote: booleam; + withNote: boolean; }, ): Promise[]> { const reactions = await Promise.allSettled(src.map(reaction => this.pack(reaction, me, options))); diff --git a/packages/backend/src/remote/activitypub/models/question.ts b/packages/backend/src/remote/activitypub/models/question.ts index 0ea14c3a0..404c3e0c0 100644 --- a/packages/backend/src/remote/activitypub/models/question.ts +++ b/packages/backend/src/remote/activitypub/models/question.ts @@ -35,10 +35,10 @@ export async function extractPollFromQuestion(source: string | IObject, resolver /** * Update votes of Question - * @param uri URI of AP Question object + * @param value AP Question object or its id * @returns true if updated */ -export async function updateQuestion(value: any) { +export async function updateQuestion(value: string | IObject) { const uri = typeof value === 'string' ? value : value.id; // URIがこのサーバーを指しているならスキップ diff --git a/packages/backend/src/server/activitypub.ts b/packages/backend/src/server/activitypub.ts index 36bc4caf2..f1a8f4914 100644 --- a/packages/backend/src/server/activitypub.ts +++ b/packages/backend/src/server/activitypub.ts @@ -206,16 +206,19 @@ router.get('/emojis/:emoji', async ctx => { // like router.get('/likes/:like', async ctx => { - const reaction = await NoteReactions.findOneBy({ id: ctx.params.like }); + const note = await Notes.findOneBy({ + id: reaction.noteId, + visibility: In(['public' as const, 'home' as const]), + }); - if (reaction == null) { + if (note == null) { ctx.status = 404; return; } - const note = await Notes.findOneBy({ id: reaction.noteId }); + const reaction = await NoteReactions.findOneBy({ id: ctx.params.like }); - if (note == null) { + if (reaction == null) { ctx.status = 404; return; } diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json index 22338a497..0702607e3 100644 --- a/packages/backend/tsconfig.json +++ b/packages/backend/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "incremental": true, "allowJs": true, "noEmitOnError": false, "noImplicitAny": true, diff --git a/packages/client/package.json b/packages/client/package.json index 3f97d6362..a50ebfd67 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -5,7 +5,9 @@ "scripts": { "watch": "vite build --watch --mode development", "build": "vite build", - "lint": "eslint src --ext .ts,.vue" + "lint": "eslint src --ext .ts,.vue", + "clean": "rm -rf built/", + "clean-all": "yarn clean && rm -rf node_modules/" }, "resolutions": { "chokidar": "^3.3.1", @@ -18,8 +20,8 @@ "@rollup/plugin-json": "4.1.0", "@rollup/pluginutils": "^4.2.1", "@syuilo/aiscript": "0.11.1", - "@vitejs/plugin-vue": "^3.0.0", - "@vue/compiler-sfc": "3.2.37", + "@vitejs/plugin-vue": "^3.1.0", + "@vue/compiler-sfc": "3.2.38", "abort-controller": "3.0.0", "autobind-decorator": "2.4.0", "autosize": "5.0.1", @@ -33,7 +35,7 @@ "chartjs-plugin-zoom": "1.2.1", "compare-versions": "4.1.3", "content-disposition": "0.5.4", - "cropperjs": "2.0.0-beta", + "cropperjs": "2.0.0-beta.1", "date-fns": "2.28.0", "escape-regexp": "0.0.1", "eventemitter3": "4.0.7", @@ -54,7 +56,7 @@ "promise-limit": "2.7.0", "pug": "3.0.2", "punycode": "2.1.1", - "qrcode": "1.5.0", + "qrcode": "1.5.1", "reflect-metadata": "0.1.13", "rndstr": "1.0.0", "rollup": "2.75.7", @@ -67,15 +69,15 @@ "three": "0.142.0", "throttle-debounce": "5.0.0", "tinycolor2": "1.4.2", - "tsc-alias": "1.6.11", + "tsc-alias": "1.7.0", "tsconfig-paths": "4.0.0", "twemoji-parser": "14.0.0", - "typescript": "4.7.4", + "typescript": "4.8.2", "uuid": "8.3.2", "v-debounce": "0.1.2", "vanilla-tilt": "1.7.2", - "vite": "3.0.0", - "vue": "3.2.37", + "vite": "3.1.0", + "vue": "3.2.38", "vue-prism-editor": "2.0.0-alpha.2", "vuedraggable": "4.0.1", "websocket": "1.0.34", @@ -92,15 +94,15 @@ "@types/mocha": "9.1.1", "@types/oauth": "0.9.1", "@types/punycode": "2.1.0", - "@types/qrcode": "1.4.2", + "@types/qrcode": "1.5.0", "@types/seedrandom": "3.0.2", "@types/throttle-debounce": "5.0.0", "@types/tinycolor2": "1.4.3", "@types/uuid": "8.3.4", "@types/websocket": "1.0.5", "@types/ws": "8.5.3", - "@typescript-eslint/eslint-plugin": "^5.35.1", - "@typescript-eslint/parser": "^5.30.0", + "@typescript-eslint/eslint-plugin": "^5.36.2", + "@typescript-eslint/parser": "^5.36.2", "cross-env": "7.0.3", "cypress": "10.3.0", "eslint": "^8.20.0", diff --git a/packages/client/src/components/drive.file.vue b/packages/client/src/components/drive.file.vue index 1d94b6782..262ce176f 100644 --- a/packages/client/src/components/drive.file.vue +++ b/packages/client/src/components/drive.file.vue @@ -40,6 +40,7 @@ import bytes from '@/filters/bytes'; import * as os from '@/os'; import { i18n } from '@/i18n'; import { $i } from '@/account'; +import { MenuItem } from '@/types/menu'; const props = withDefaults(defineProps<{ file: Misskey.entities.DriveFile; @@ -60,7 +61,7 @@ const isDragging = ref(false); const title = computed(() => `${props.file.name}\n${props.file.type} ${bytes(props.file.size)}`); -function getMenu() { +function getMenu(): MenuItem[] { return [{ text: i18n.ts.rename, icon: 'fas fa-i-cursor', @@ -92,7 +93,7 @@ function getMenu() { }]; } -function onClick(ev: MouseEvent) { +function onClick(ev: MouseEvent): void { if (props.selectMode) { emit('chosen', props.file); } else { @@ -100,11 +101,11 @@ function onClick(ev: MouseEvent) { } } -function onContextmenu(ev: MouseEvent) { +function onContextmenu(ev: MouseEvent): void { os.contextMenu(getMenu(), ev); } -function onDragstart(ev: DragEvent) { +function onDragstart(ev: DragEvent): void { if (ev.dataTransfer) { ev.dataTransfer.effectAllowed = 'move'; ev.dataTransfer.setData(_DATA_TRANSFER_DRIVE_FILE_, JSON.stringify(props.file)); @@ -114,12 +115,12 @@ function onDragstart(ev: DragEvent) { emit('dragstart'); } -function onDragend() { +function onDragend(): void { isDragging.value = false; emit('dragend'); } -function rename() { +function rename(): void { os.inputText({ title: i18n.ts.renameFile, placeholder: i18n.ts.inputNewFileName, @@ -133,14 +134,14 @@ function rename() { }); } -function describe() { +function describe(): void { os.popup(defineAsyncComponent(() => import('@/components/media-caption.vue')), { title: i18n.ts.describeFile, input: { placeholder: i18n.ts.inputNewDescription, - default: props.file.comment != null ? props.file.comment : '', + default: props.file.comment ?? '', }, - image: props.file, + file: props.file, }, { done: result => { if (!result || result.canceled) return; @@ -153,23 +154,19 @@ function describe() { }, 'closed'); } -function toggleSensitive() { +function toggleSensitive(): void { os.api('drive/files/update', { fileId: props.file.id, isSensitive: !props.file.isSensitive, }); } -function copyUrl() { +function copyUrl(): void { copyToClipboard(props.file.url); os.success(); } -/* -function addApp() { - alert('not implemented yet'); -} -*/ -async function deleteFile() { + +async function deleteFile(): Promise { const { canceled } = await os.confirm({ type: 'warning', text: i18n.t('driveFileDeleteConfirm', { name: props.file.name }), diff --git a/packages/client/src/components/emoji-picker.vue b/packages/client/src/components/emoji-picker.vue index f32a65f62..6fd5b8ce9 100644 --- a/packages/client/src/components/emoji-picker.vue +++ b/packages/client/src/components/emoji-picker.vue @@ -112,6 +112,8 @@ const { reactionPickerSize, reactionPickerWidth, reactionPickerHeight, + maxCustomEmojiPicker, + maxUnicodeEmojiPicker, disableShowingAnimatedImages, recentlyUsedEmojis, } = defaultStore.reactiveState; @@ -126,145 +128,41 @@ const searchResultCustom = ref([]); const searchResultUnicode = ref([]); const tab = ref<'index' | 'custom' | 'unicode' | 'tags'>('index'); -watch(q, () => { - if (emojis.value) emojis.value.scrollTop = 0; +function emojiSearch(src: Type[], max: number, query: string): Type[] { + // discount fuzzy matching pattern + const re = new RegExp(query.split(' ').join('.*'), 'i'); + const match = (str: string): boolean => str && re.test(str); + const matches = src.filter(emoji => + match(emoji.name) + || emoji.aliases?.some(match) // custom emoji + || emoji.keywords?.some(match), // unicode emoji + ); + // TODO: sort matches by distance to query + if (max <= 0 || matches.length < max) return matches; + return matches.slice(0, max); +} - if (q.value == null || q.value === '') { +let queryTimeoutId = -1; +const queryCallback = (query) => { + if (emojis.value) emojis.value.scrollTop = 0; + searchResultCustom.value = emojiSearch(instance.emojis, maxCustomEmojiPicker.value, query); + searchResultUnicode.value = emojiSearch(emojilist, maxUnicodeEmojiPicker.value, query); + queryTimeoutId = -1; +}; +watch(q, () => { + if (queryTimeoutId >= 0) { + clearTimeout(queryTimeoutId); + queryTimeoutId = -1; + } + + const query = q.value; + if (query == null || query === '') { searchResultCustom.value = []; searchResultUnicode.value = []; return; } - const newQ = q.value.replace(/:/g, '').toLowerCase(); - - const searchCustom = () => { - const max = 8; - const emojis = customEmojis; - const matches = new Set(); - - const exactMatch = emojis.find(emoji => emoji.name === newQ); - if (exactMatch) matches.add(exactMatch); - - if (newQ.includes(' ')) { // AND検索 - const keywords = newQ.split(' '); - - // 名前にキーワードが含まれている - for (const emoji of emojis) { - if (keywords.every(keyword => emoji.name.includes(keyword))) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - if (matches.size >= max) return matches; - - // 名前またはエイリアスにキーワードが含まれている - for (const emoji of emojis) { - if (keywords.every(keyword => emoji.name.includes(keyword) || emoji.aliases.some(alias => alias.includes(keyword)))) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - } else { - for (const emoji of emojis) { - if (emoji.name.startsWith(newQ)) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - if (matches.size >= max) return matches; - - for (const emoji of emojis) { - if (emoji.aliases.some(alias => alias.startsWith(newQ))) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - if (matches.size >= max) return matches; - - for (const emoji of emojis) { - if (emoji.name.includes(newQ)) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - if (matches.size >= max) return matches; - - for (const emoji of emojis) { - if (emoji.aliases.some(alias => alias.includes(newQ))) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - } - - return matches; - }; - - const searchUnicode = () => { - const max = 8; - const emojis = emojilist; - const matches = new Set(); - - const exactMatch = emojis.find(emoji => emoji.name === newQ); - if (exactMatch) matches.add(exactMatch); - - if (newQ.includes(' ')) { // AND検索 - const keywords = newQ.split(' '); - - // 名前にキーワードが含まれている - for (const emoji of emojis) { - if (keywords.every(keyword => emoji.name.includes(keyword))) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - if (matches.size >= max) return matches; - - // 名前またはエイリアスにキーワードが含まれている - for (const emoji of emojis) { - if (keywords.every(keyword => emoji.name.includes(keyword) || emoji.keywords.some(alias => alias.includes(keyword)))) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - } else { - for (const emoji of emojis) { - if (emoji.name.startsWith(newQ)) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - if (matches.size >= max) return matches; - - for (const emoji of emojis) { - if (emoji.keywords.some(keyword => keyword.startsWith(newQ))) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - if (matches.size >= max) return matches; - - for (const emoji of emojis) { - if (emoji.name.includes(newQ)) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - if (matches.size >= max) return matches; - - for (const emoji of emojis) { - if (emoji.keywords.some(keyword => keyword.includes(newQ))) { - matches.add(emoji); - if (matches.size >= max) break; - } - } - } - - return matches; - }; - - searchResultCustom.value = Array.from(searchCustom()); - searchResultUnicode.value = Array.from(searchUnicode()); + queryTimeoutId = setTimeout(queryCallback, 300, query); }); function focus() { diff --git a/packages/client/src/components/launch-pad.vue b/packages/client/src/components/launch-pad.vue index 3c1d3f3c1..d875edb53 100644 --- a/packages/client/src/components/launch-pad.vue +++ b/packages/client/src/components/launch-pad.vue @@ -16,13 +16,13 @@
- + -
{{ i18n.t('aboutX', { x: instanceName }) }}
+
{{ i18n.ts.instanceInfo }}
@@ -40,6 +40,7 @@ import { instanceName } from '@/config'; import { defaultStore } from '@/store'; import { i18n } from '@/i18n'; import { deviceKind } from '@/scripts/device-kind'; +import * as os from '@/os'; const props = withDefaults(defineProps<{ src?: HTMLElement; @@ -72,6 +73,28 @@ const items = Object.keys(menuDef).filter(k => !menu.includes(k)).map(k => menuD function close() { modal.close(); } + +function help(ev: MouseEvent) { + os.popupMenu([{ + type: 'link', + to: '/mfm-cheat-sheet', + text: i18n.ts._mfm.cheatSheet, + icon: 'fas fa-code', + }, { + type: 'link', + to: '/scratchpad', + text: i18n.ts.scratchpad, + icon: 'fas fa-terminal', + }, null, { + text: i18n.ts.document, + icon: 'fas fa-question-circle', + action: () => { + window.open('https://misskey-hub.net/help.html', '_blank'); + }, + }], ev.currentTarget ?? ev.target); + + close(); +} diff --git a/packages/client/src/pages/about.vue b/packages/client/src/pages/about.vue index fcb82ee34..7a86b638f 100644 --- a/packages/client/src/pages/about.vue +++ b/packages/client/src/pages/about.vue @@ -73,7 +73,7 @@ - + @@ -81,6 +81,8 @@ - - diff --git a/packages/client/src/pages/federation.vue b/packages/client/src/pages/federation.vue deleted file mode 100644 index 28acf44f7..000000000 --- a/packages/client/src/pages/federation.vue +++ /dev/null @@ -1,122 +0,0 @@ - - - - - diff --git a/packages/client/src/pages/mentions.vue b/packages/client/src/pages/mentions.vue deleted file mode 100644 index 36720a011..000000000 --- a/packages/client/src/pages/mentions.vue +++ /dev/null @@ -1,29 +0,0 @@ - - - diff --git a/packages/client/src/pages/messages.vue b/packages/client/src/pages/messages.vue deleted file mode 100644 index 6ac07b165..000000000 --- a/packages/client/src/pages/messages.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - diff --git a/packages/client/src/pages/notifications.vue b/packages/client/src/pages/notifications.vue index c91d3bd4f..0c610fb42 100644 --- a/packages/client/src/pages/notifications.vue +++ b/packages/client/src/pages/notifications.vue @@ -2,8 +2,14 @@ -
- +
+ +
+
+ +
+
+
@@ -13,14 +19,51 @@ import { computed } from 'vue'; import { notificationTypes } from 'foundkey-js'; import XNotifications from '@/components/notifications.vue'; +import XNotes from '@/components/notes.vue'; import * as os from '@/os'; import { i18n } from '@/i18n'; import { definePageMetadata } from '@/scripts/page-metadata'; -let tab = $ref('all'); -let includeTypes = $ref(null); +const headerTabs = $computed(() => [{ + key: 'all', + title: i18n.ts.all, +}, { + key: 'unread', + title: i18n.ts.unread, +}, { + key: 'mentions', + title: i18n.ts.mentions, + icon: 'fas fa-at', +}, { + key: 'directNotes', + title: i18n.ts.directNotes, + icon: 'fas fa-envelope', +}]); -function setFilter(ev) { +const props = withDefaults(defineProps<{ + initialTab?: string; +}>(), { + initialTab: 'all', +}); + +let tab = $ref(headerTabs.some(({ key }) => key === props.initialTab) ? props.initialTab : 'all'); +let includeTypes = $ref(null); +let unreadOnly = $computed(() => tab === 'unread'); + +const mentionsPagination = { + endpoint: 'notes/mentions' as const, + limit: 10, +}; + +const directNotesPagination = { + endpoint: 'notes/mentions' as const, + limit: 10, + params: { + visibility: 'specified', + }, +}; + +function setFilter(ev: Event): void { const typeItems = notificationTypes.map(t => ({ text: i18n.t(`_notification._types.${t}`), active: includeTypes && includeTypes.includes(t), @@ -38,34 +81,21 @@ function setFilter(ev) { os.popupMenu(items, ev.currentTarget ?? ev.target); } -const headerActions = $computed(() => [{ +const headerActions = $computed(() => tab === 'all' ? [{ text: i18n.ts.filter, icon: 'fas fa-filter', highlighted: includeTypes != null, handler: setFilter, -}, { +},{ text: i18n.ts.markAllAsRead, icon: 'fas fa-check', handler: () => { os.apiWithDialog('notifications/mark-all-as-read'); }, -}]); - -const headerTabs = $computed(() => [{ - key: 'all', - title: i18n.ts.all, -}, { - key: 'unread', - title: i18n.ts.unread, -}]); +}] : []); definePageMetadata(computed(() => ({ title: i18n.ts.notifications, icon: 'fas fa-bell', }))); - - diff --git a/packages/client/src/pages/settings/general.vue b/packages/client/src/pages/settings/general.vue index 74fa0bc92..9be40bdd8 100644 --- a/packages/client/src/pages/settings/general.vue +++ b/packages/client/src/pages/settings/general.vue @@ -35,6 +35,15 @@ + + + + + + + + + @@ -124,6 +133,8 @@ async function reloadAsk() { const overridedDeviceKind = computed(defaultStore.makeGetterSetter('overridedDeviceKind')); const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serverDisconnectedBehavior')); +const maxCustomEmojiPicker = computed(defaultStore.makeGetterSetter('maxCustomEmojiPicker')); +const maxUnicodeEmojiPicker = computed(defaultStore.makeGetterSetter('maxUnicodeEmojiPicker')); const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v)); const useBlurEffectForModal = computed(defaultStore.makeGetterSetter('useBlurEffectForModal')); const useBlurEffect = computed(defaultStore.makeGetterSetter('useBlurEffect')); diff --git a/packages/client/src/pages/user/index.activity.vue b/packages/client/src/pages/user/index.activity.vue index 90f1632ea..86f872e30 100644 --- a/packages/client/src/pages/user/index.activity.vue +++ b/packages/client/src/pages/user/index.activity.vue @@ -1,6 +1,6 @@