Merge remote-branch 'misskey/develop'

This commit is contained in:
NoriDev 2024-02-01 17:19:38 +09:00
parent ddc9256bdd
commit c927d648a0
283 changed files with 3056 additions and 1819 deletions

View file

@ -160,14 +160,14 @@ id: 'aidx'
# Job concurrency per worker
#deliverJobConcurrency: 128
#inboxJobConcurrency: 16
#relashionshipJobConcurrency: 16
# What's relashionshipJob?:
#relationshipJobConcurrency: 16
# What's relationshipJob?:
# Follow, unfollow, block and unblock(ings) while following-imports, etc. or account migrations.
# Job rate limiter
#deliverJobPerSec: 128
#inboxJobPerSec: 32
#relashionshipJobPerSec: 64
#relationshipJobPerSec: 64
# Job attempts
#deliverJobMaxAttempts: 12

View file

@ -0,0 +1,66 @@
name: Deploy test environment
on:
push:
workflow_dispatch:
inputs:
repository:
description: 'Repository to deploy (optional)'
required: false
branch:
description: 'Branch to deploy (optional)'
required: false
jobs:
deploy-test-environment:
runs-on: ubuntu-latest
steps:
- name: Set environment variable (for tput command & pnpm)
run: |
echo "TERM=xterm" >> $GITHUB_ENV
REPOSITORY=${{ github.event.inputs.repository || github.repository }}
echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV
BRANCH=${{ github.event.inputs.branch || github.ref_name }}
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ env.BRANCH }}
- name: Get the latest commit SHA
run: |
SHA=$(git log -1 --format="%H")
echo "SHA=$SHA" >> $GITHUB_ENV
- name: Start cloudflare tunnel (quick)
run: |
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb
sudo cloudflared tunnel --metrics localhost:55555 --url localhost:3000 > /dev/null 2>&1 &
sleep 15
TUNNEL_RESPONSE=$(curl http://localhost:55555/quicktunnel)
TUNNEL_DOMAIN=$(echo $TUNNEL_RESPONSE | grep -o '"hostname":"[^"]*' | grep -o '[^"]*$')
echo "::add-mask::$TUNNEL_DOMAIN"
echo "TUNNEL_DOMAIN=$TUNNEL_DOMAIN" >> $GITHUB_ENV
- name: Install misskey
run: |
wget https://raw.githubusercontent.com/joinmisskey/bash-install/v4/misskey-install.sh
wget https://raw.githubusercontent.com/joinmisskey/bash-install/v4/testenv_githubactions.txt
sed -i "s/host=127.0.0.1/host=$TUNNEL_DOMAIN/g" testenv_githubactions.txt
sed -i "s|git_repository=https://github.com/misskey-dev/misskey|git_repository=https://github.com/$REPOSITORY|g" testenv_githubactions.txt
sed -i "s|git_branch=master|git_branch=$BRANCH|g" testenv_githubactions.txt
sudo chmod 555 ./misskey-install.sh
sudo bash -x ./misskey-install.sh -c ./testenv_githubactions.txt
- name: Post tunnel info to Discord
run: |
CURRENT_TIME=$(TZ=Asia/Tokyo date +'%Y-%m-%d %H:%M:%S JST')
COMMIT_URL="https://github.com/$REPOSITORY/commit/$SHA"
curl -X POST -H "Content-Type: application/json" -d "{\"content\": \"==============================\nURL: https://$TUNNEL_DOMAIN\nRepository: $REPOSITORY\nBranch: $BRANCH\nCommit: $COMMIT_URL\nTime: $CURRENT_TIME\n==============================\"}" ${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Wait
run: |
timeout 3600 tail -f /var/log/syslog || true

View file

@ -45,11 +45,19 @@
- Enhance: ノート作成画面のファイル添付メニューから直接ファイルを削除できるように
- Enhance: MFMの属性でオートコンプリートが使用できるように #12735
- Enhance: 絵文字編集ダイアログをモーダルではなくウィンドウで表示するように
- Enhance: リモートのユーザーはメニューから直接リモートで表示できるように
- Fix: ネイティブモードの絵文字がモノクロにならないように
- Fix: v2023.12.0で追加された「モデレーターがユーザーのアイコンもしくはバナー画像を未設定状態にできる機能」が管理画面上で正しく表示されていない問題を修正
- Fix: AiScriptの`readline`関数が不正な値を返すことがある問題のv2023.12.0時点での修正がPlay以外に適用されていないのを修正
- Fix: v2023.12.1で追加された`$[clickable ...]`および`onClickEv`が正しく機能していないのを修正
- Fix: Renoteのキーボードショートカットが機能していなかった問題を修正
- Fix: 投稿フォームでアンケートの日時指定をした状態で再読み込みをすると期日が復元されない問題を修正
- Fix: アンケートを設定したノートを「削除して編集」をするとアンケートの期日が引き継がれず、リセットされてしまう問題を修正
- Fix: デッキのプロファイル作成時に名前を空にできる問題を修正
- Fix: テーマ作成時に名称が空欄でも作成できてしまう問題を修正
- Fix: プラグインで`Plugin:register_note_post_interruptor`を使用すると、ノートが投稿できなくなる問題を修正
- Enhance: ページ遷移時にPlayerを閉じるように
- Fix: iOSで大きな画像を変換してアップロードできない問題を修正
### Server
- Enhance: 連合先のレートリミットに引っかかった際にリトライするようになりました
@ -62,6 +70,7 @@
- Fix: `notes/create`で、`text`が空白文字のみで構成されていてかつリノート、ファイルまたは投票を含んでいるリクエストに対するレスポンスの`text`が`""`から`null`になるように変更
- Fix: ipv4とipv6の両方が利用可能な環境でallowedPrivateNetworksが設定されていた場合プライベートipの検証ができていなかった問題を修正
- Fix: properly handle cc followers
- Fix: ジョブに関する設定の名前を修正 relashionshipJobPerSec -> relationshipJobPerSec
### Service Worker
- Enhance: オフライン表示のデザインを改善・多言語対応

30
cypress/e2e/router.cy.js Normal file
View file

@ -0,0 +1,30 @@
describe('Router transition', () => {
describe('Redirect', () => {
// サーバの初期化。ルートのテストに関しては各describeごとに1度だけ実行で十分だと思う使いまわした方が早い
before(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser('admin', 'pass', true);
// ユーザー作成
cy.registerUser('alice', 'alice1234');
cy.login('alice', 'alice1234');
// アカウント初期設定ウィザード
// 表示に時間がかかるのでデフォルト秒数だとタイムアウトする
cy.get('[data-cy-user-setup] [data-cy-modal-window-close]', { timeout: 12000 }).click();
cy.wait(500);
cy.get('[data-cy-modal-dialog-ok]').click();
});
it('redirect to user profile', () => {
// テストのためだけに用意されたリダイレクト用ルートに飛ぶ
cy.visit('/redirect-test');
// プロフィールページのURLであることを確認する
cy.url().should('include', '/@alice')
});
});
});

View file

@ -181,7 +181,7 @@ searchWith: "Suchen: {q}"
youHaveNoLists: "Du hast keine Listen"
followConfirm: "Möchtest du {name} wirklich folgen?"
proxyAccount: "Proxy-Benutzerkonto"
proxyAccountDescription: "Ein Proxy-Benutzerkonto ist ein Benutzerkonto, das sich für Nutzer unter bestimmten Konditionen wie ein Follower aus einer fremden Instanz verhält. Zum Beispiel wird die Aktivität eines Nutzers aus einer fremden Instanz nicht an diese Instanz übermittelt, falls es keinen Benutzer dieser Instanz gibt, der diesem Nutzer aus fremder Instanz folgt. In diesem Fall folgt stattdessen das Proxy-Benutzerkonto."
proxyAccountDescription: "Ein Proxy-Konto ist ein Benutzerkonto, das unter bestimmten Bedingungen als Follower für Benutzer fremder Instanzen fungiert. Wenn zum Beispiel ein Benutzer einen Benutzer einer fremden Instanz zu einer Liste hinzufügt, werden die Aktivitäten des entfernten Benutzers nicht an die Instanz übermittelt, wenn kein lokaler Benutzer diesem Benutzer folgt; stattdessen folgt das Proxy-Konto."
host: "Hostname"
selectUser: "Benutzer auswählen"
recipient: "Empfänger"
@ -1195,6 +1195,7 @@ _announcement:
tooManyActiveAnnouncementDescription: "Zu viele aktive Ankündigungen können die Benutzerfreundlichkeit verschlechtern. Es wird empfohlen, veraltete Ankündigungen zu archivieren."
readConfirmTitle: "Als gelesen markieren?"
readConfirmText: "Dies markiert den Inhalt von \"{title}\" als gelesen."
shouldNotBeUsedToPresentPermanentInfo: "Es wird empfohlen, Ankündigungen für aktuelle und zeitlich begrenzte Neuigkeiten zu nutzen, statt für Informationen, die langfristig relevant sind."
dialogAnnouncementUxWarn: "Bei der Verwendung von mehr als zwei Meldungen im Dialog-Format wird um Vorsicht geboten, da dies negative Auswirkungen auf die UX haben kann."
silence: "Keine Benachrichtigung"
silenceDescription: "Wenn aktiviert, gibt diese Meldung keine Nachricht aus und muss nicht als \"gelesen\" markiert werden."
@ -1236,6 +1237,7 @@ _serverSettings:
shortName: "Abkürzung"
shortNameDescription: "Ein Kürzel für den Namen der Instanz, der angezeigt werden kann, falls der volle Instanzname lang ist."
fanoutTimelineDescription: "Ist diese Option aktiviert, kann eine erhebliche Verbesserung im Abrufen von Chroniken und eine Reduzierung der Datenbankbelastung erzielt werden, im Gegenzug zu einer Steigerung in der Speichernutzung von Redis. Bei geringem Serverspeicher oder Serverinstabilität kann diese Option deaktiviert werden."
fanoutTimelineDbFallback: "Auf die Datenbank zurückfallen"
_accountMigration:
moveFrom: "Von einem anderen Konto zu diesem migrieren"
moveFromSub: "Alias für ein anderes Konto erstellen"
@ -1506,7 +1508,9 @@ _role:
assignTarget: "Zuweisungsart"
descriptionOfAssignTarget: "<b>Manuell</b> bedeutet, dass die Liste der Benutzer einer Rolle manuell verwaltet wird.\n<b>Konditional</b> bedeutet, dass die Liste der Benutzer einer Rolle durch eine Bedingung automatisch verwaltet wird."
manual: "Manuell"
manualRoles: "Manuelle Rollen"
conditional: "Konditional"
conditionalRoles: "Bedingte Rolle"
condition: "Bedingung"
isConditionalRole: "Dies ist eine konditionale Rolle."
isPublic: "Öffentliche Rolle"
@ -1556,6 +1560,7 @@ _role:
canHideAds: "Kann Werbung ausblenden"
canSearchNotes: "Nutzung der Notizsuchfunktion"
canUseTranslator: "Verwendung des Übersetzers"
avatarDecorationLimit: "Maximale Anzahl an Profilbilddekorationen, die angebracht werden können"
_condition:
isLocal: "Lokaler Benutzer"
isRemote: "Benutzer fremder Instanz"
@ -1584,6 +1589,7 @@ _emailUnavailable:
disposable: "Wegwerf-Email-Adressen können nicht verwendet werden"
mx: "Dieser Email-Server ist ungültig"
smtp: "Dieser Email-Server antwortet nicht"
banned: "Du kannst dich mit dieser E-Mail-Adresse nicht registrieren"
_ffVisibility:
public: "Öffentlich"
followers: "Nur für Follower sichtbar"
@ -1981,6 +1987,7 @@ _widgets:
_userList:
chooseList: "Liste auswählen"
clicker: "Klickzähler"
birthdayFollowings: "Nutzer, die heute Geburtstag haben"
_cw:
hide: "Inhalt verbergen"
show: "Inhalt anzeigen"

View file

@ -202,7 +202,11 @@ add: "Add"
reaction: "Reactions"
reactions: "Reactions"
emojiPicker: "Emoji picker"
pinnedEmojisForReactionSettingDescription: "Set the emojis which should be pinned and displayed immediately when reacting."
pinnedEmojisSettingDescription: "Set the emojis to be pinned and displayed when viewing emoji picker"
emojiPickerDisplay: "Emoji picker display"
overwriteFromPinnedEmojisForReaction: "Override from reaction settings"
overwriteFromPinnedEmojis: "Override from general settings"
reactionSettingDescription2: "Drag to reorder, click to delete, press \"+\" to add."
rememberNoteVisibility: "Remember note visibility settings"
attachCancel: "Remove attachment"
@ -457,8 +461,11 @@ hcaptcha: "hCaptcha"
enableHcaptcha: "Enable hCaptcha"
hcaptchaSiteKey: "Site key"
hcaptchaSecretKey: "Secret key"
mcaptcha: "mCaptcha"
enableMcaptcha: "Enable mCaptcha"
mcaptchaSiteKey: "Site key"
mcaptchaSecretKey: "Secret key"
mcaptchaInstanceUrl: "mCaptcha instance URL"
recaptcha: "reCAPTCHA"
enableRecaptcha: "Enable reCAPTCHA"
recaptchaSiteKey: "Site key"
@ -725,6 +732,7 @@ medium: "Medium"
small: "Small"
generateAccessToken: "Generate access token"
permission: "Permissions"
adminPermission: "Admin Permissions"
enableAll: "Enable all"
disableAll: "Disable all"
tokenRequested: "Grant access to account"
@ -768,6 +776,7 @@ useGlobalSettingDesc: "If turned on, your account's notification settings will b
other: "Other"
regenerateLoginToken: "Regenerate login token"
regenerateLoginTokenDescription: "Regenerates the token used internally during login. Normally this action is not necessary. If regenerated, all devices will be logged out."
theKeywordWhenSearchingForCustomEmoji: "This is the keyword when searching for custom emojis."
setMultipleBySeparatingWithSpace: "Separate multiple entries with spaces."
fileIdOrUrl: "File ID or URL"
behavior: "Behavior"
@ -1156,6 +1165,8 @@ limitWidthOfReaction: "Limits the maximum width of reactions and display them in
noteIdOrUrl: "Note ID or URL"
video: "Video"
videos: "Videos"
audio: "Audio"
audioFiles: "Audio"
dataSaver: "Data Saver"
accountMigration: "Account Migration"
accountMoved: "This user has moved to a new account:"
@ -1274,6 +1285,7 @@ tosAndPrivacyPolicy: "Terms of Service and Privacy Policy"
avatarDecorations: "Avatar decorations"
attach: "Attach"
detach: "Remove"
detachAll: "Remove All"
angle: "Angle"
flip: "Flip"
showAvatarDecorations: "Show avatar decorations"
@ -1287,11 +1299,25 @@ cwNotationRequired: "If \"Hide content\" is enabled, a description must be provi
doReaction: "Add reaction"
code: "Code"
reloadRequiredToApplySettings: "Reloading is required to apply the settings."
remainingN: "Remaining: {n}"
overwriteContentConfirm: "Are you sure you want to overwrite the current content?"
seasonalScreenEffect: "Seasonal Screen Effect"
decorate: "Decorate"
addMfmFunction: "Add MFM"
enableQuickAddMfmFunction: "Show advanced MFM picker"
bubbleGame: "Bubble Game"
sfx: "Sound Effects"
soundWillBePlayed: "Sound will be played"
showReplay: "View Replay"
replay: "Replay"
replaying: "Showing replay"
ranking: "Ranking"
lastNDays: "Last {n} days"
backToTitle: "Go back to title"
hemisphere: "Where are you located"
withSensitive: "Include notes with sensitive files"
userSaysSomethingSensitive: "Post by {name} contains sensitive content"
enableHorizontalSwipe: "Swipe to switch tabs"
showUnreadNotificationsCount: "Show the number of unread notifications"
showCatOnly: "Show only cats"
additionalPermissionsForFlash: "Allow to add permission to Play"
@ -1314,6 +1340,12 @@ _showingAnimatedImages:
inactive: "Stop after a certain amount of time"
_messaging:
direct: "Direct Message"
_bubbleGame:
howToPlay: "How to play"
_howToPlay:
section1: "Adjust the position and drop the object into the box."
section2: "When two objects of the same type touch each other, they will change into a different object and you score points."
section3: "The game is over when objects overflow from the box. Aim for a high score by fusing objects together while you avoid overflowing the box!"
_announcement:
forExistingUsers: "Existing users only"
forExistingUsersDescription: "This announcement will only be shown to users existing at the point of publishment if enabled. If disabled, those newly signing up after it has been posted will also see it."
@ -1323,7 +1355,7 @@ _announcement:
tooManyActiveAnnouncementDescription: "Having too many active announcements may worsen the user experience. Please consider archiving announcements that have become obsolete."
readConfirmTitle: "Mark as read?"
readConfirmText: "This will mark the contents of \"{title}\" as read."
shouldNotBeUsedToPresentPermanentInfo: "As it may significantly impact the user experience for new users, it is recommended to use notifications in the flow information rather than stock information."
shouldNotBeUsedToPresentPermanentInfo: "It's best to use announcements to publish fresh and time-bound information, not for information that will be relevant in the long term."
dialogAnnouncementUxWarn: "Having two or more dialog-style notifications simultaneously can significantly impact the user experience, so please use them carefully."
silence: "No notification"
silenceDescription: "Turning this on will skip the notification of this announcement and the user won't need to read it."
@ -1770,8 +1802,11 @@ _achievements:
description: "Tutorial completed"
_bubbleGameExplodingHead:
title: "🤯"
description: "The biggest object in the bubble game"
_bubbleGameDoubleExplodingHead:
title: "Double🤯"
description: "Two of the biggest objects in the bubble game at the same time"
flavor: "You can fill a lunch box like this 🤯 🤯 a bit."
_role:
new: "New role"
edit: "Edit role"
@ -1834,6 +1869,7 @@ _role:
canHideAds: "Can hide ads"
canSearchNotes: "Usage of note search"
canUseTranslator: "Translator usage"
avatarDecorationLimit: "Maximum number of avatar decorations that can be applied"
_condition:
isLocal: "Local user"
isRemote: "Remote user"
@ -1866,6 +1902,7 @@ _emailUnavailable:
disposable: "Disposable email addresses may not be used"
mx: "This email server is invalid"
smtp: "This email server is not responding"
banned: "You cannot register with this email address"
_ffVisibility:
public: "Public"
followers: "Visible to followers only"
@ -2366,6 +2403,7 @@ _profile:
changeAvatar: "Change avatar"
changeBanner: "Change banner"
verifiedLinkDescription: "By entering an URL that contains a link to your profile here, an ownership verification icon can be displayed next to the field."
avatarDecorationMax: "You can add up to {max} decorations."
_exportOrImport:
allNotes: "All notes"
favoritedNotes: "Favorite notes"
@ -2668,12 +2706,60 @@ _dataSaver:
description: "Stop avatar image animation. Animated images can be larger in file size than normal images, potentially leading to further reductions in data traffic."
_urlPreview:
title: "URL preview thumbnails"
description: "URL preview thumbnail images will no longer load."
description: "URL preview thumbnail images will no longer be loaded."
_code:
title: "Code highlighting"
description: "If code highlighting notations are used in MFM, etc., they will not load until tapped. Syntax highlighting requires downloading the highlight definition files for each programming language. Therefore, disabling the automatic loading of these files is expected to reduce the amount of communication data."
_hemisphere:
N: "Northern Hemisphere"
S: "Southern Hemisphere"
caption: "Used in some client settings to determine season."
_reversi:
reversi: "Reversi"
gameSettings: "Game settings"
chooseBoard: "Choose a board"
blackOrWhite: "Black/White"
blackIs: "{name} is playing Black"
rules: "Rules"
thisGameIsStartedSoon: "The game will begin shortly"
waitingForOther: "Waiting for opponent's turn"
waitingForMe: "Waiting for your turn"
waitingBoth: "Get ready"
ready: "Ready"
cancelReady: "Not ready"
opponentTurn: "Opponent's turn"
myTurn: "Your turn"
turnOf: "It's {name}'s turn"
pastTurnOf: "{name}'s turn"
surrender: "Surrender"
surrendered: "Surrendered"
timeout: "Out of time"
drawn: "Draw"
won: "{name} wins"
black: "Black"
white: "White"
total: "Total"
turnCount: "Turn {count}"
myGames: "My rounds"
allGames: "All rounds"
ended: "Ended"
playing: "Currently playing"
isLlotheo: "The one with fewer stones wins (Llotheo)"
loopedMap: "Looping map"
canPutEverywhere: "Tiles are placeable everywhere"
timeLimitForEachTurn: "Time limit for turn"
freeMatch: "Free Match"
lookingForPlayer: "Finding opponent..."
gameCanceled: "The game has been cancelled."
shareToTlTheGameWhenStart: "Share Game to timeline when started"
iStartedAGame: "The game has begun! #MisskeyReversi"
opponentHasSettingsChanged: "The opponent has changed their settings."
allowIrregularRules: "Irregular rules (completely free)"
disallowIrregularRules: "No irregular rules"
_offlineScreen:
title: "Offline - cannot connect to the server"
header: "Unable to connect to the server"
_abuse:
_resolver:
1hour: "one hour"

2
locales/index.d.ts vendored
View file

@ -5429,7 +5429,7 @@ export interface Locale extends ILocale {
*/
"readConfirmText": ParameterizedString<"title">;
/**
* UXを損ねる可能性が高いため使
* UXを損ねる可能性が高いため使
*/
"shouldNotBeUsedToPresentPermanentInfo": string;
/**

View file

@ -1361,7 +1361,7 @@ _announcement:
tooManyActiveAnnouncementDescription: "アクティブなお知らせが多いため、UXが低下する可能性があります。終了したお知らせはアーカイブすることを検討してください。"
readConfirmTitle: "既読にしますか?"
readConfirmText: "「{title}」の内容を読み、既読にします。"
shouldNotBeUsedToPresentPermanentInfo: "特に新規ユーザーのUXを損ねる可能性が高いため、ストック情報ではなくフロー情報の掲示にお知らせを使用することを推奨します。"
shouldNotBeUsedToPresentPermanentInfo: "特に新規ユーザーのUXを損ねる可能性が高いため、常時掲示するための情報ではなく、即時性が求められる情報の掲示のためにお知らせを使用することを推奨します。"
dialogAnnouncementUxWarn: "ダイアログ形式のお知らせが同時に2つ以上ある場合、UXに悪影響を及ぼす可能性が非常に高いため、使用は慎重に行うことを推奨します。"
silence: "非通知"
silenceDescription: "オンにすると、このお知らせは通知されず、既読にする必要もなくなります。"

View file

@ -2118,10 +2118,10 @@ _auth:
_antennaSources:
all: "みんなのノート"
homeTimeline: "フォローしとるユーザーのノート"
users: "選んだ一人か複数のユーザーのノート"
users: "選んだ一人か複数のユーザーのノート"
userList: "選んだリストのユーザーのノート"
userGroup: "選んだグループのユーザーのノート"
userBlacklist: "選んだ1人か複数のユーザーのノート"
userBlacklist: "選んだ一人か複数のユーザーを除いた全てのノート"
_weekday:
sunday: "日曜日"
monday: "月曜日"
@ -2574,6 +2574,8 @@ _reversi:
shareToTlTheGameWhenStart: "初めの時に対局をタイムラインに投稿するで"
iStartedAGame: "対局し始めたで! #MisskeyReversi"
opponentHasSettingsChanged: "相手が設定変えたで"
allowIrregularRules: "変則許可 (完全フリー)"
disallowIrregularRules: "変則なし"
_offlineScreen:
title: "オフライン - サーバーに接続できひんで"
header: "サーバーに接続できへんわ"

View file

@ -1199,6 +1199,7 @@ useGroupedNotifications: "分组显示通知"
signupPendingError: "确认电子邮件时出现错误。链接可能已过期。"
cwNotationRequired: "在启用「隐藏内容」时必须输入注释"
doReaction: "回应"
code: "代码"
reloadRequiredToApplySettings: "需要重新载入来使设置生效"
remainingN: "剩余:{n}"
overwriteContentConfirm: "将覆盖现有内容。确定吗?"
@ -1216,6 +1217,7 @@ lastNDays: "最近 {n} 天"
backToTitle: "返回标题"
hemisphere: "居住地区"
withSensitive: "显示包含敏感媒体的帖子"
userSaysSomethingSensitive: "含 {name} 敏感文件的帖子"
enableHorizontalSwipe: "滑动切换标签页"
_bubbleGame:
howToPlay: "游戏说明"
@ -2525,6 +2527,8 @@ _hemisphere:
caption: "在某些客户端设置中用来确定季节"
_reversi:
reversi: "黑白棋"
rules: "规则"
ready: "准备就绪"
total: "总计"
_offlineScreen:
title: "离线——无法连接到服务器"

View file

@ -1,7 +1,7 @@
{
"name": "cherrypick",
"version": "4.7.0-beta.1",
"basedMisskeyVersion": "2024.2.0-beta.7",
"basedMisskeyVersion": "2024.2.0-beta.8",
"codename": "nasubi",
"repository": {
"type": "git",

View file

@ -68,9 +68,9 @@
"dependencies": {
"@aws-sdk/client-s3": "3.412.0",
"@aws-sdk/lib-storage": "3.412.0",
"@bull-board/api": "5.10.2",
"@bull-board/fastify": "5.10.2",
"@bull-board/ui": "5.10.2",
"@bull-board/api": "5.14.0",
"@bull-board/fastify": "5.14.0",
"@bull-board/ui": "5.14.0",
"@discordapp/twemoji": "15.0.2",
"@fastify/accepts": "4.3.0",
"@fastify/cookie": "9.3.1",
@ -88,11 +88,11 @@
"@nestjs/core": "10.2.10",
"@nestjs/testing": "10.2.10",
"@peertube/http-signature": "1.7.0",
"@simplewebauthn/server": "9.0.0",
"@simplewebauthn/server": "9.0.1",
"@sinonjs/fake-timers": "11.2.2",
"@smithy/node-http-handler": "2.1.10",
"@swc/cli": "0.1.63",
"@swc/core": "1.3.105",
"@swc/core": "1.3.107",
"@twemoji/parser": "15.0.0",
"@vitalets/google-translate-api": "9.2.0",
"accepts": "1.3.8",
@ -102,7 +102,7 @@
"bcryptjs": "2.4.3",
"blurhash": "2.0.5",
"body-parser": "1.20.2",
"bullmq": "5.1.4",
"bullmq": "5.1.5",
"cacheable-lookup": "7.0.0",
"cbor": "9.0.1",
"chalk": "5.3.0",
@ -121,7 +121,7 @@
"file-type": "19.0.0",
"fluent-ffmpeg": "2.1.2",
"form-data": "4.0.0",
"got": "14.0.0",
"got": "14.1.0",
"happy-dom": "10.0.3",
"hpagent": "1.2.0",
"http-link-header": "1.1.1",
@ -151,7 +151,7 @@
"otpauth": "9.2.2",
"parse5": "7.1.2",
"pg": "8.11.3",
"pkce-challenge": "4.0.1",
"pkce-challenge": "4.1.0",
"probe-image-size": "7.2.3",
"promise-limit": "2.7.0",
"pug": "3.0.2",
@ -173,12 +173,12 @@
"strict-event-emitter-types": "2.0.0",
"stringz": "2.1.0",
"strip-ansi": "^7.1.0",
"systeminformation": "5.21.23",
"systeminformation": "5.21.24",
"tinycolor2": "1.6.0",
"tmp": "0.2.1",
"tsc-alias": "1.8.8",
"tsconfig-paths": "4.2.0",
"typeorm": "0.3.19",
"typeorm": "0.3.20",
"typescript": "5.3.3",
"ulid": "2.3.0",
"vary": "1.1.2",
@ -189,7 +189,7 @@
"devDependencies": {
"@jest/globals": "29.7.0",
"@misskey-dev/eslint-plugin": "1.0.0",
"@nestjs/platform-express": "10.3.0",
"@nestjs/platform-express": "10.3.1",
"@simplewebauthn/typescript-types": "8.3.4",
"@swc/jest": "0.2.31",
"@types/accepts": "1.3.7",
@ -208,13 +208,13 @@
"@types/jsrsasign": "10.5.12",
"@types/mime-types": "2.1.4",
"@types/ms": "0.7.34",
"@types/node": "20.11.5",
"@types/node": "20.11.10",
"@types/node-fetch": "3.0.3",
"@types/nodemailer": "6.4.14",
"@types/oauth": "0.9.4",
"@types/oauth2orize": "1.11.3",
"@types/oauth2orize-pkce": "0.1.2",
"@types/pg": "8.10.9",
"@types/pg": "8.11.0",
"@types/pug": "2.0.10",
"@types/punycode": "2.1.3",
"@types/qrcode": "1.5.5",

View file

@ -74,10 +74,10 @@ type Source = {
deliverJobConcurrency?: number;
inboxJobConcurrency?: number;
relashionshipJobConcurrency?: number;
relationshipJobConcurrency?: number;
deliverJobPerSec?: number;
inboxJobPerSec?: number;
relashionshipJobPerSec?: number;
relationshipJobPerSec?: number;
deliverJobMaxAttempts?: number;
inboxJobMaxAttempts?: number;
@ -143,10 +143,10 @@ export type Config = {
outgoingAddressFamily: 'ipv4' | 'ipv6' | 'dual' | undefined;
deliverJobConcurrency: number | undefined;
inboxJobConcurrency: number | undefined;
relashionshipJobConcurrency: number | undefined;
relationshipJobConcurrency: number | undefined;
deliverJobPerSec: number | undefined;
inboxJobPerSec: number | undefined;
relashionshipJobPerSec: number | undefined;
relationshipJobPerSec: number | undefined;
deliverJobMaxAttempts: number | undefined;
inboxJobMaxAttempts: number | undefined;
@ -260,10 +260,10 @@ export function loadConfig(): Config {
outgoingAddressFamily: config.outgoingAddressFamily,
deliverJobConcurrency: config.deliverJobConcurrency,
inboxJobConcurrency: config.inboxJobConcurrency,
relashionshipJobConcurrency: config.relashionshipJobConcurrency,
relationshipJobConcurrency: config.relationshipJobConcurrency,
deliverJobPerSec: config.deliverJobPerSec,
inboxJobPerSec: config.inboxJobPerSec,
relashionshipJobPerSec: config.relashionshipJobPerSec,
relationshipJobPerSec: config.relationshipJobPerSec,
deliverJobMaxAttempts: config.deliverJobMaxAttempts,
inboxJobMaxAttempts: config.inboxJobMaxAttempts,
proxyRemoteFiles: config.proxyRemoteFiles,

View file

@ -96,7 +96,7 @@ export class AccountMoveService {
await this.apDeliverManagerService.deliverToFollowers(src, moveAct);
// Publish meUpdated event
const iObj = await this.userEntityService.pack<true, true>(src.id, src, { detail: true, includeSecrets: true });
const iObj = await this.userEntityService.pack(src.id, src, { schema: 'MeDetailed', includeSecrets: true });
this.globalEventService.publishMainStream(src.id, 'meUpdated', iObj);
// Unfollow after 24 hours

View file

@ -56,15 +56,15 @@ export interface MainEventTypes {
reply: Packed<'Note'>;
renote: Packed<'Note'>;
follow: Packed<'UserDetailedNotMe'>;
followed: Packed<'User'>;
unfollow: Packed<'User'>;
meUpdated: Packed<'User'>;
followed: Packed<'UserLite'>;
unfollow: Packed<'UserDetailedNotMe'>;
meUpdated: Packed<'MeDetailed'>;
pageEvent: {
pageId: MiPage['id'];
event: string;
var: any;
userId: MiUser['id'];
user: Packed<'User'>;
user: Packed<'UserDetailed'>;
};
urlUploadFinished: {
marker?: string | null;
@ -97,7 +97,7 @@ export interface MainEventTypes {
};
driveFileCreated: Packed<'DriveFile'>;
readAntenna: MiAntenna;
receiveFollowRequest: Packed<'User'>;
receiveFollowRequest: Packed<'UserLite'>;
announcementCreated: {
announcement: Packed<'Announcement'>;
};
@ -149,8 +149,8 @@ export interface ChannelEventTypes {
}
export interface UserListEventTypes {
userAdded: Packed<'User'>;
userRemoved: Packed<'User'>;
userAdded: Packed<'UserLite'>;
userRemoved: Packed<'UserLite'>;
}
export interface AntennaEventTypes {

View file

@ -109,13 +109,13 @@ export class UserBlockingService implements OnModuleInit {
if (this.userEntityService.isLocalUser(followee)) {
this.userEntityService.pack(followee, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
if (this.userEntityService.isLocalUser(follower) && !silent) {
this.userEntityService.pack(followee, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'unfollow', packed);

View file

@ -293,9 +293,9 @@ export class UserFollowingService implements OnModuleInit {
if (this.userEntityService.isLocalUser(follower) && !silent) {
// Publish follow event
this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'follow', packed as Packed<'UserDetailedNotMe'>);
this.globalEventService.publishMainStream(follower.id, 'follow', packed);
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === follower.id && x.on.includes('follow'));
for (const webhook of webhooks) {
@ -360,7 +360,7 @@ export class UserFollowingService implements OnModuleInit {
if (!silent && this.userEntityService.isLocalUser(follower)) {
// Publish unfollow event
this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
}).then(async packed => {
this.globalEventService.publishMainStream(follower.id, 'unfollow', packed);
@ -500,7 +500,7 @@ export class UserFollowingService implements OnModuleInit {
this.userEntityService.pack(follower.id, followee).then(packed => this.globalEventService.publishMainStream(followee.id, 'receiveFollowRequest', packed));
this.userEntityService.pack(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
// 通知を作成
@ -548,7 +548,7 @@ export class UserFollowingService implements OnModuleInit {
});
this.userEntityService.pack(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
@ -576,7 +576,7 @@ export class UserFollowingService implements OnModuleInit {
}
this.userEntityService.pack(followee.id, followee, {
detail: true,
schema: 'MeDetailed',
}).then(packed => this.globalEventService.publishMainStream(followee.id, 'meUpdated', packed));
}
@ -696,7 +696,7 @@ export class UserFollowingService implements OnModuleInit {
@bindThis
private async publishUnfollow(followee: Both, follower: Local): Promise<void> {
const packedFollowee = await this.userEntityService.pack(followee.id, follower, {
detail: true,
schema: 'UserDetailedNotMe',
});
this.globalEventService.publishMainStream(follower.id, 'unfollow', packedFollowee);

View file

@ -94,6 +94,29 @@ type ToJsonSchema<S> = {
};
export function getJsonSchema<S extends Schema>(schema: S): ToJsonSchema<Unflatten<ChartResult<S>>> {
const unflatten = (str: string, parent: Record<string, any>) => {
const keys = str.split('.');
const key = keys.shift();
const nextKey = keys[0];
if (key == null) return;
if (parent.properties[key] == null) {
parent.properties[key] = nextKey ? {
type: 'object',
properties: {},
required: [],
} : {
type: 'array',
items: {
type: 'number',
},
};
}
if (nextKey) unflatten(keys.join('.'), parent.properties[key] as Record<string, any>);
};
const jsonSchema = {
type: 'object',
properties: {} as Record<string, unknown>,
@ -101,10 +124,7 @@ export function getJsonSchema<S extends Schema>(schema: S): ToJsonSchema<Unflatt
};
for (const k in schema) {
jsonSchema.properties[k] = {
type: 'array',
items: { type: 'number' },
};
unflatten(k, jsonSchema);
}
return jsonSchema as ToJsonSchema<Unflatten<ChartResult<S>>>;

View file

@ -38,13 +38,13 @@ export class AbuseUserReportEntityService {
targetUserId: report.targetUserId,
assigneeId: report.assigneeId,
reporter: this.userEntityService.pack(report.reporter ?? report.reporterId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}),
targetUser: this.userEntityService.pack(report.targetUser ?? report.targetUserId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}),
assignee: report.assigneeId ? this.userEntityService.pack(report.assignee ?? report.assigneeId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}) : null,
forwarded: report.forwarded,
});

View file

@ -37,7 +37,7 @@ export class BlockingEntityService {
createdAt: this.idService.parse(blocking.id).date.toISOString(),
blockeeId: blocking.blockeeId,
blockee: this.userEntityService.pack(blocking.blockeeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View file

@ -42,7 +42,7 @@ export class FlashEntityService {
createdAt: this.idService.parse(flash.id).date.toISOString(),
updatedAt: flash.updatedAt.toISOString(),
userId: flash.userId,
user: this.userEntityService.pack(flash.user ?? flash.userId, me), // { detail: true } すると無限ループするので注意
user: this.userEntityService.pack(flash.user ?? flash.userId, me), // { schema: 'UserDetailed' } すると無限ループするので注意
title: flash.title,
summary: flash.summary,
script: flash.script,

View file

@ -89,10 +89,10 @@ export class FollowingEntityService {
followeeId: following.followeeId,
followerId: following.followerId,
followee: opts.populateFollowee ? this.userEntityService.pack(following.followee ?? following.followeeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}) : undefined,
follower: opts.populateFollower ? this.userEntityService.pack(following.follower ?? following.followerId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}) : undefined,
});
}

View file

@ -37,7 +37,7 @@ export class ModerationLogEntityService {
info: log.info,
userId: log.userId,
user: this.userEntityService.pack(log.user ?? log.userId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View file

@ -39,7 +39,7 @@ export class MutingEntityService {
expiresAt: muting.expiresAt ? muting.expiresAt.toISOString() : null,
muteeId: muting.muteeId,
mutee: this.userEntityService.pack(muting.muteeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View file

@ -167,7 +167,7 @@ export class NoteEntityService implements OnModuleInit {
return {
multiple: poll.multiple,
expiresAt: poll.expiresAt,
expiresAt: poll.expiresAt?.toISOString() ?? null,
choices,
};
}
@ -342,9 +342,7 @@ export class NoteEntityService implements OnModuleInit {
updatedAtHistory: note.updatedAtHistory ? note.updatedAtHistory.map(x => x.toISOString()) : undefined,
noteEditHistory: note.noteEditHistory.length ? note.noteEditHistory : undefined,
userId: note.userId,
user: this.userEntityService.pack(note.user ?? note.userId, me, {
detail: false,
}),
user: this.userEntityService.pack(note.user ?? note.userId, me),
text: text,
cw: note.cw,
visibility: note.visibility,

View file

@ -69,7 +69,7 @@ export class NotificationEntityService implements OnModuleInit {
},
hint?: {
packedNotes: Map<MiNote['id'], Packed<'Note'>>;
packedUsers: Map<MiUser['id'], Packed<'User'>>;
packedUsers: Map<MiUser['id'], Packed<'UserLite'>>;
},
): Promise<Packed<'Notification'>> {
const notification = src;
@ -83,9 +83,7 @@ export class NotificationEntityService implements OnModuleInit {
const userIfNeed = 'notifierId' in notification ? (
hint?.packedUsers != null
? hint.packedUsers.get(notification.notifierId)
: this.userEntityService.pack(notification.notifierId, { id: meId }, {
detail: false,
})
: this.userEntityService.pack(notification.notifierId, { id: meId })
) : undefined;
const role = notification.type === 'roleAssigned' ? await this.roleEntityService.pack(notification.roleId) : undefined;
@ -147,9 +145,7 @@ export class NotificationEntityService implements OnModuleInit {
const users = userIds.length > 0 ? await this.usersRepository.find({
where: { id: In(userIds) },
}) : [];
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId }, {
detail: false,
});
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId });
const packedUsers = new Map(packedUsersArray.map(p => [p.id, p]));
// 既に解決されたフォローリクエストの通知を除外
@ -185,7 +181,7 @@ export class NotificationEntityService implements OnModuleInit {
},
hint?: {
packedNotes: Map<MiNote['id'], Packed<'Note'>>;
packedUsers: Map<MiUser['id'], Packed<'User'>>;
packedUsers: Map<MiUser['id'], Packed<'UserLite'>>;
},
): Promise<Packed<'Notification'>> {
const notification = src;
@ -199,18 +195,14 @@ export class NotificationEntityService implements OnModuleInit {
const userIfNeed = 'notifierId' in notification ? (
hint?.packedUsers != null
? hint.packedUsers.get(notification.notifierId)
: this.userEntityService.pack(notification.notifierId, { id: meId }, {
detail: false,
})
: this.userEntityService.pack(notification.notifierId, { id: meId })
) : undefined;
if (notification.type === 'reaction:grouped') {
const reactions = await Promise.all(notification.reactions.map(async reaction => {
const user = hint?.packedUsers != null
? hint.packedUsers.get(reaction.userId)!
: await this.userEntityService.pack(reaction.userId, { id: meId }, {
detail: false,
});
: await this.userEntityService.pack(reaction.userId, { id: meId });
return {
user,
reaction: reaction.reaction,
@ -230,9 +222,7 @@ export class NotificationEntityService implements OnModuleInit {
return packedUser;
}
return this.userEntityService.pack(userId, { id: meId }, {
detail: false,
});
return this.userEntityService.pack(userId, { id: meId });
}));
return await awaitAll({
id: notification.id,
@ -302,9 +292,7 @@ export class NotificationEntityService implements OnModuleInit {
const users = userIds.length > 0 ? await this.usersRepository.find({
where: { id: In(userIds) },
}) : [];
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId }, {
detail: false,
});
const packedUsersArray = await this.userEntityService.packMany(users, { id: meId });
const packedUsers = new Map(packedUsersArray.map(p => [p.id, p]));
// 既に解決されたフォローリクエストの通知を除外

View file

@ -90,7 +90,7 @@ export class PageEntityService {
createdAt: this.idService.parse(page.id).date.toISOString(),
updatedAt: page.updatedAt.toISOString(),
userId: page.userId,
user: this.userEntityService.pack(page.user ?? page.userId, me), // { detail: true } すると無限ループするので注意
user: this.userEntityService.pack(page.user ?? page.userId, me), // { schema: 'UserDetailed' } すると無限ループするので注意
content: page.content,
variables: page.variables,
title: page.title,

View file

@ -38,7 +38,7 @@ export class RenoteMutingEntityService {
createdAt: this.idService.parse(muting.id).date.toISOString(),
muteeId: muting.muteeId,
mutee: this.userEntityService.pack(muting.muteeId, me, {
detail: true,
schema: 'UserDetailedNotMe',
}),
});
}

View file

@ -30,14 +30,6 @@ import type { NoteEntityService } from './NoteEntityService.js';
import type { DriveFileEntityService } from './DriveFileEntityService.js';
import type { PageEntityService } from './PageEntityService.js';
type IsUserDetailed<Detailed extends boolean> = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>;
type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends boolean> =
Detailed extends true ?
ExpectsMe extends true ? Packed<'MeDetailed'> :
ExpectsMe extends false ? Packed<'UserDetailedNotMe'> :
Packed<'UserDetailed'> :
Packed<'UserLite'>;
const Ajv = _Ajv.default;
const ajv = new Ajv();
@ -339,33 +331,34 @@ export class UserEntityService implements OnModuleInit {
return `${this.config.url}/users/${userId}`;
}
public async pack<ExpectsMe extends boolean | null = null, D extends boolean = false>(
public async pack<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(
src: MiUser['id'] | MiUser,
me?: { id: MiUser['id']; } | null | undefined,
options?: {
detail?: D,
schema?: S,
includeSecrets?: boolean,
userProfile?: MiUserProfile,
},
): Promise<IsMeAndIsUserDetailed<ExpectsMe, D>> {
): Promise<Packed<S>> {
const opts = Object.assign({
detail: false,
schema: 'UserLite',
includeSecrets: false,
}, options);
const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src });
const isDetailed = opts.schema !== 'UserLite';
const meId = me ? me.id : null;
const isMe = meId === user.id;
const iAmModerator = me ? await this.roleService.isModerator(me as MiUser) : false;
const relation = meId && !isMe && opts.detail ? await this.getRelation(meId, user.id) : null;
const pins = opts.detail ? await this.userNotePiningsRepository.createQueryBuilder('pin')
const relation = meId && !isMe && isDetailed ? await this.getRelation(meId, user.id) : null;
const pins = isDetailed ? await this.userNotePiningsRepository.createQueryBuilder('pin')
.where('pin.userId = :userId', { userId: user.id })
.innerJoinAndSelect('pin.note', 'note')
.orderBy('pin.id', 'DESC')
.getMany() : [];
const profile = opts.detail ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null;
const profile = isDetailed ? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id })) : null;
const followingCount = profile == null ? null :
(profile.followingVisibility === 'public') || isMe ? user.followingCount :
@ -377,15 +370,15 @@ export class UserEntityService implements OnModuleInit {
(profile.followersVisibility === 'followers') && (relation && relation.isFollowing) ? user.followersCount :
null;
const isModerator = isMe && opts.detail ? this.roleService.isModerator(user) : null;
const isAdmin = isMe && opts.detail ? this.roleService.isAdministrator(user) : null;
const unreadAnnouncements = isMe && opts.detail ?
const isModerator = isMe && isDetailed ? this.roleService.isModerator(user) : null;
const isAdmin = isMe && isDetailed ? this.roleService.isAdministrator(user) : null;
const unreadAnnouncements = isMe && isDetailed ?
(await this.announcementService.getUnreadAnnouncements(user)).map((announcement) => ({
createdAt: this.idService.parse(announcement.id).date.toISOString(),
...announcement,
})) : null;
const notificationsInfo = isMe && opts.detail ? await this.getNotificationsInfo(user.id) : null;
const notificationsInfo = isMe && isDetailed ? await this.getNotificationsInfo(user.id) : null;
const packed = {
id: user.id,
@ -423,7 +416,7 @@ export class UserEntityService implements OnModuleInit {
displayOrder: r.displayOrder,
}))) : undefined,
...(opts.detail ? {
...(isDetailed ? {
url: profile!.url,
uri: user.uri,
movedTo: user.movedToUri ? this.apPersonService.resolvePerson(user.movedToUri).then(user => user.id).catch(() => null) : null,
@ -481,7 +474,7 @@ export class UserEntityService implements OnModuleInit {
moderationNote: iAmModerator ? (profile!.moderationNote ?? '') : undefined,
} : {}),
...(opts.detail && isMe ? {
...(isDetailed && isMe ? {
avatarId: user.avatarId,
bannerId: user.bannerId,
isModerator: isModerator,
@ -554,19 +547,19 @@ export class UserEntityService implements OnModuleInit {
notify: relation.following?.notify ?? 'none',
withReplies: relation.following?.withReplies ?? false,
} : {}),
} as Promiseable<Packed<'User'>> as Promiseable<IsMeAndIsUserDetailed<ExpectsMe, D>>;
} as Promiseable<Packed<S>>;
return await awaitAll(packed);
}
public packMany<D extends boolean = false>(
public packMany<S extends 'MeDetailed' | 'UserDetailedNotMe' | 'UserDetailed' | 'UserLite' = 'UserLite'>(
users: (MiUser['id'] | MiUser)[],
me?: { id: MiUser['id'] } | null | undefined,
options?: {
detail?: D,
schema?: S,
includeSecrets?: boolean,
},
): Promise<IsUserDetailed<D>[]> {
): Promise<Packed<S>[]> {
return Promise.all(users.map(u => this.pack(u, me, options)));
}
}

View file

@ -6,7 +6,7 @@
// structredCloneが遅いため
// SEE: http://var.blog.jp/archives/86038606.html
type Cloneable = string | number | boolean | null | { [key: string]: Cloneable } | Cloneable[];
type Cloneable = string | number | boolean | null | undefined | { [key: string]: Cloneable } | Cloneable[];
export function deepClone<T extends Cloneable>(x: T): T {
if (typeof x === 'object') {
@ -14,7 +14,7 @@ export function deepClone<T extends Cloneable>(x: T): T {
if (Array.isArray(x)) return x.map(deepClone) as T;
const obj = {} as Record<string, Cloneable>;
for (const [k, v] of Object.entries(x)) {
obj[k] = deepClone(v);
obj[k] = v === undefined ? undefined : deepClone(v);
}
return obj as T;
} else {

View file

@ -26,7 +26,7 @@ import { packedBlockingSchema } from '@/models/json-schema/blocking.js';
import { packedNoteReactionSchema } from '@/models/json-schema/note-reaction.js';
import { packedHashtagSchema } from '@/models/json-schema/hashtag.js';
import { packedInviteCodeSchema } from '@/models/json-schema/invite-code.js';
import { packedPageSchema } from '@/models/json-schema/page.js';
import { packedPageSchema, packedPageBlockSchema } from '@/models/json-schema/page.js';
import { packedUserGroupSchema } from '@/models/json-schema/user-group.js';
import { packedNoteFavoriteSchema } from '@/models/json-schema/note-favorite.js';
import { packedChannelSchema } from '@/models/json-schema/channel.js';
@ -39,7 +39,7 @@ import { packedEmojiDetailedSchema, packedEmojiSimpleSchema } from '@/models/jso
import { packedFlashSchema } from '@/models/json-schema/flash.js';
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js';
import { packedSigninSchema } from '@/models/json-schema/signin.js';
import { packedRoleLiteSchema, packedRoleSchema } from '@/models/json-schema/role.js';
import { packedRoleLiteSchema, packedRoleSchema, packedRolePoliciesSchema } from '@/models/json-schema/role.js';
import { packedAdSchema } from '@/models/json-schema/ad.js';
import { packedReversiGameLiteSchema, packedReversiGameDetailedSchema } from '@/models/json-schema/reversi-game.js';
@ -71,6 +71,7 @@ export const refs = {
Hashtag: packedHashtagSchema,
InviteCode: packedInviteCodeSchema,
Page: packedPageSchema,
PageBlock: packedPageBlockSchema,
Channel: packedChannelSchema,
QueueCount: packedQueueCountSchema,
Antenna: packedAntennaSchema,
@ -83,12 +84,16 @@ export const refs = {
Signin: packedSigninSchema,
RoleLite: packedRoleLiteSchema,
Role: packedRoleSchema,
RolePolicies: packedRolePoliciesSchema,
ReversiGameLite: packedReversiGameLiteSchema,
ReversiGameDetailed: packedReversiGameDetailedSchema,
};
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;
export type KeyOf<x extends keyof typeof refs> = PropertiesToUnion<typeof refs[x]>;
type PropertiesToUnion<p extends Schema> = p['properties'] extends NonNullable<Obj> ? keyof p['properties'] : never;
type TypeStringef = 'null' | 'boolean' | 'integer' | 'number' | 'string' | 'array' | 'object' | 'any';
type StringDefToType<T extends TypeStringef> =
T extends 'null' ? null :

View file

@ -38,7 +38,7 @@ export class MiAnnouncement {
length: 256, nullable: false,
default: 'info',
})
public icon: string;
public icon: 'info' | 'warning' | 'error' | 'success';
// normal ... お知らせページ掲載
// banner ... お知らせページ掲載 + バナー表示
@ -47,7 +47,7 @@ export class MiAnnouncement {
length: 256, nullable: false,
default: 'normal',
})
public display: string;
public display: 'normal' | 'banner' | 'dialog';
@Column('boolean', {
default: false,

View file

@ -37,10 +37,12 @@ export const packedAnnouncementSchema = {
icon: {
type: 'string',
optional: false, nullable: false,
enum: ['info', 'warning', 'error', 'success'],
},
display: {
type: 'string',
optional: false, nullable: false,
enum: ['dialog', 'normal', 'banner'],
},
needConfirmationToRead: {
type: 'boolean',

View file

@ -25,7 +25,7 @@ export const packedBlockingSchema = {
blockee: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
} as const;

View file

@ -30,12 +30,12 @@ export const packedFollowingSchema = {
followee: {
type: 'object',
optional: true, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
follower: {
type: 'object',
optional: true, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
} as const;

View file

@ -30,7 +30,7 @@ export const packedMutingSchema = {
mutee: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
} as const;

View file

@ -91,6 +91,7 @@ export const packedNoteSchema = {
visibility: {
type: 'string',
optional: false, nullable: false,
enum: ['public', 'home', 'followers', 'specified'],
},
mentions: {
type: 'array',
@ -139,6 +140,48 @@ export const packedNoteSchema = {
poll: {
type: 'object',
optional: true, nullable: true,
properties: {
expiresAt: {
type: 'string',
optional: true, nullable: true,
format: 'date-time',
},
multiple: {
type: 'boolean',
optional: false, nullable: false,
},
choices: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
properties: {
isVoted: {
type: 'boolean',
optional: false, nullable: false,
},
text: {
type: 'string',
optional: false, nullable: false,
},
votes: {
type: 'number',
optional: false, nullable: false,
},
},
},
},
},
},
emojis: {
type: 'object',
optional: true, nullable: false,
additionalProperties: {
anyOf: [{
type: 'string',
}],
},
},
event: {
type: 'object',
@ -188,9 +231,23 @@ export const packedNoteSchema = {
type: 'string',
optional: false, nullable: true,
},
reactionEmojis: {
type: 'object',
optional: false, nullable: false,
additionalProperties: {
anyOf: [{
type: 'string',
}],
},
},
reactions: {
type: 'object',
optional: false, nullable: false,
additionalProperties: {
anyOf: [{
type: 'number',
}],
},
},
renoteCount: {
type: 'number',
@ -222,7 +279,7 @@ export const packedNoteSchema = {
},
myReaction: {
type: 'object',
type: 'string',
optional: true, nullable: true,
},
},

View file

@ -5,7 +5,7 @@
import { notificationTypes } from '@/types.js';
export const packedNotificationSchema = {
const baseSchema = {
type: 'object',
properties: {
id: {
@ -23,68 +23,368 @@ export const packedNotificationSchema = {
optional: false, nullable: false,
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: true, nullable: true,
},
userId: {
type: 'string',
optional: true, nullable: true,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: true, nullable: true,
},
reaction: {
type: 'string',
optional: true, nullable: true,
},
achievement: {
type: 'string',
optional: true, nullable: false,
},
body: {
type: 'string',
optional: true, nullable: true,
},
header: {
type: 'string',
optional: true, nullable: true,
},
icon: {
type: 'string',
optional: true, nullable: true,
},
reactions: {
type: 'array',
optional: true, nullable: true,
items: {
type: 'object',
properties: {
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
reaction: {
type: 'string',
optional: false, nullable: false,
},
},
required: ['user', 'reaction'],
},
} as const;
export const packedNotificationSchema = {
type: 'object',
oneOf: [{
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['note'],
},
},
users: {
type: 'array',
optional: true, nullable: true,
items: {
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['mention'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['reply'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['renote'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['quote'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['reaction'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
reaction: {
type: 'string',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['pollEnded'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['follow'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['receiveFollowRequest'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['followRequestAccepted'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['roleAssigned'],
},
role: {
type: 'object',
ref: 'Role',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['achievementEarned'],
},
achievement: {
type: 'string',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['app'],
},
body: {
type: 'string',
optional: false, nullable: false,
},
header: {
type: 'string',
optional: false, nullable: false,
},
icon: {
type: 'string',
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['reaction:grouped'],
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
reactions: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
properties: {
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
reaction: {
type: 'string',
optional: false, nullable: false,
},
},
required: ['user', 'reaction'],
},
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['renote:grouped'],
},
note: {
type: 'object',
ref: 'Note',
optional: false, nullable: false,
},
users: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['test'],
},
},
}],
} as const;

View file

@ -3,6 +3,107 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
const blockBaseSchema = {
type: 'object',
properties: {
id: {
type: 'string',
optional: false, nullable: false,
},
type: {
type: 'string',
optional: false, nullable: false,
},
},
} as const;
const textBlockSchema = {
type: 'object',
properties: {
...blockBaseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['text'],
},
text: {
type: 'string',
optional: false, nullable: false,
},
},
} as const;
const sectionBlockSchema = {
type: 'object',
properties: {
...blockBaseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['section'],
},
title: {
type: 'string',
optional: false, nullable: false,
},
children: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
ref: 'PageBlock',
},
},
},
} as const;
const imageBlockSchema = {
type: 'object',
properties: {
...blockBaseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['image'],
},
fileId: {
type: 'string',
optional: false, nullable: true,
},
},
} as const;
const noteBlockSchema = {
type: 'object',
properties: {
...blockBaseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['note'],
},
detailed: {
type: 'boolean',
optional: false, nullable: false,
},
note: {
type: 'string',
optional: false, nullable: true,
},
},
} as const;
export const packedPageBlockSchema = {
type: 'object',
oneOf: [
textBlockSchema,
sectionBlockSchema,
imageBlockSchema,
noteBlockSchema,
],
} as const;
export const packedPageSchema = {
type: 'object',
properties: {
@ -38,6 +139,7 @@ export const packedPageSchema = {
items: {
type: 'object',
optional: false, nullable: false,
ref: 'PageBlock',
},
},
variables: {

View file

@ -25,7 +25,7 @@ export const packedRenoteMutingSchema = {
mutee: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
} as const;

View file

@ -1,26 +1,103 @@
const rolePolicyValue = {
export const packedRolePoliciesSchema = {
type: 'object',
optional: false, nullable: false,
properties: {
value: {
oneOf: [
{
type: 'integer',
optional: false, nullable: false,
},
{
type: 'boolean',
optional: false, nullable: false,
},
],
gtlAvailable: {
type: 'boolean',
optional: false, nullable: false,
},
priority: {
ltlAvailable: {
type: 'boolean',
optional: false, nullable: false,
},
canPublicNote: {
type: 'boolean',
optional: false, nullable: false,
},
canInvite: {
type: 'boolean',
optional: false, nullable: false,
},
inviteLimit: {
type: 'integer',
optional: false, nullable: false,
},
useDefault: {
inviteLimitCycle: {
type: 'integer',
optional: false, nullable: false,
},
inviteExpirationTime: {
type: 'integer',
optional: false, nullable: false,
},
canManageCustomEmojis: {
type: 'boolean',
optional: false, nullable: false,
},
canManageAvatarDecorations: {
type: 'boolean',
optional: false, nullable: false,
},
canSearchNotes: {
type: 'boolean',
optional: false, nullable: false,
},
canUseTranslator: {
type: 'boolean',
optional: false, nullable: false,
},
canHideAds: {
type: 'boolean',
optional: false, nullable: false,
},
driveCapacityMb: {
type: 'integer',
optional: false, nullable: false,
},
alwaysMarkNsfw: {
type: 'boolean',
optional: false, nullable: false,
},
pinLimit: {
type: 'integer',
optional: false, nullable: false,
},
antennaLimit: {
type: 'integer',
optional: false, nullable: false,
},
wordMuteLimit: {
type: 'integer',
optional: false, nullable: false,
},
webhookLimit: {
type: 'integer',
optional: false, nullable: false,
},
clipLimit: {
type: 'integer',
optional: false, nullable: false,
},
noteEachClipsLimit: {
type: 'integer',
optional: false, nullable: false,
},
userListLimit: {
type: 'integer',
optional: false, nullable: false,
},
userEachUserListsLimit: {
type: 'integer',
optional: false, nullable: false,
},
rateLimitFactor: {
type: 'integer',
optional: false, nullable: false,
},
avatarDecorationLimit: {
type: 'integer',
optional: false, nullable: false,
},
},
} as const;
@ -121,31 +198,28 @@ export const packedRoleSchema = {
policies: {
type: 'object',
optional: false, nullable: false,
properties: {
pinLimit: rolePolicyValue,
canInvite: rolePolicyValue,
clipLimit: rolePolicyValue,
canHideAds: rolePolicyValue,
inviteLimit: rolePolicyValue,
antennaLimit: rolePolicyValue,
gtlAvailable: rolePolicyValue,
ltlAvailable: rolePolicyValue,
webhookLimit: rolePolicyValue,
canPublicNote: rolePolicyValue,
userListLimit: rolePolicyValue,
wordMuteLimit: rolePolicyValue,
alwaysMarkNsfw: rolePolicyValue,
canSearchNotes: rolePolicyValue,
driveCapacityMb: rolePolicyValue,
rateLimitFactor: rolePolicyValue,
inviteLimitCycle: rolePolicyValue,
noteEachClipsLimit: rolePolicyValue,
inviteExpirationTime: rolePolicyValue,
canManageCustomEmojis: rolePolicyValue,
userEachUserListsLimit: rolePolicyValue,
canManageAvatarDecorations: rolePolicyValue,
canUseTranslator: rolePolicyValue,
avatarDecorationLimit: rolePolicyValue,
additionalProperties: {
anyOf: [{
type: 'object',
properties: {
value: {
oneOf: [
{
type: 'integer',
},
{
type: 'boolean',
},
],
},
priority: {
type: 'integer',
},
useDefault: {
type: 'boolean',
},
},
}],
},
},
usersCount: {

View file

@ -603,104 +603,7 @@ export const packedMeDetailedOnlySchema = {
policies: {
type: 'object',
nullable: false, optional: false,
properties: {
gtlAvailable: {
type: 'boolean',
nullable: false, optional: false,
},
ltlAvailable: {
type: 'boolean',
nullable: false, optional: false,
},
canPublicNote: {
type: 'boolean',
nullable: false, optional: false,
},
canInvite: {
type: 'boolean',
nullable: false, optional: false,
},
inviteLimit: {
type: 'number',
nullable: false, optional: false,
},
inviteLimitCycle: {
type: 'number',
nullable: false, optional: false,
},
inviteExpirationTime: {
type: 'number',
nullable: false, optional: false,
},
canManageCustomEmojis: {
type: 'boolean',
nullable: false, optional: false,
},
canManageAvatarDecorations: {
type: 'boolean',
nullable: false, optional: false,
},
canSearchNotes: {
type: 'boolean',
nullable: false, optional: false,
},
canUseTranslator: {
type: 'boolean',
nullable: false, optional: false,
},
canHideAds: {
type: 'boolean',
nullable: false, optional: false,
},
driveCapacityMb: {
type: 'number',
nullable: false, optional: false,
},
alwaysMarkNsfw: {
type: 'boolean',
nullable: false, optional: false,
},
pinLimit: {
type: 'number',
nullable: false, optional: false,
},
antennaLimit: {
type: 'number',
nullable: false, optional: false,
},
wordMuteLimit: {
type: 'number',
nullable: false, optional: false,
},
webhookLimit: {
type: 'number',
nullable: false, optional: false,
},
clipLimit: {
type: 'number',
nullable: false, optional: false,
},
noteEachClipsLimit: {
type: 'number',
nullable: false, optional: false,
},
userListLimit: {
type: 'number',
nullable: false, optional: false,
},
userEachUserListsLimit: {
type: 'number',
nullable: false, optional: false,
},
rateLimitFactor: {
type: 'number',
nullable: false, optional: false,
},
avatarDecorationLimit: {
type: 'number',
nullable: false, optional: false,
},
},
ref: 'RolePolicies',
},
//#region secrets
email: {
@ -795,13 +698,5 @@ export const packedUserSchema = {
type: 'object',
ref: 'UserDetailed',
},
{
type: 'object',
ref: 'UserDetailedNotMe',
},
{
type: 'object',
ref: 'MeDetailed',
},
],
} as const;

View file

@ -290,9 +290,9 @@ export class QueueProcessorService implements OnApplicationShutdown {
}, {
...baseQueueOptions(this.config, QUEUE.RELATIONSHIP, this.redisForJobQueue),
autorun: false,
concurrency: this.config.relashionshipJobConcurrency ?? 16,
concurrency: this.config.relationshipJobConcurrency ?? 16,
limiter: {
max: this.config.relashionshipJobPerSec ?? 64,
max: this.config.relationshipJobPerSec ?? 64,
duration: 1000,
},
});

View file

@ -204,7 +204,7 @@ export class ServerService implements OnApplicationShutdown {
});
this.globalEventService.publishMainStream(profile.userId, 'meUpdated', await this.userEntityService.pack(profile.userId, { id: profile.userId }, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -157,7 +157,7 @@ export class ApiServerService {
return {
ok: true,
token: token.token,
user: await this.userEntityService.pack(token.userId, null, { detail: true }),
user: await this.userEntityService.pack(token.userId, null, { schema: 'UserDetailedNotMe' }),
};
} else {
return {

View file

@ -213,7 +213,7 @@ export class SignupApiService {
});
const res = await this.userEntityService.pack(account, account, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
});

View file

@ -4,8 +4,7 @@
*/
import { permissions } from 'cherrypick-js';
import type { Schema } from '@/misc/json-schema.js';
import { RolePolicies } from '@/core/RoleService.js';
import type { KeyOf, Schema } from '@/misc/json-schema.js';
import * as ep___admin_meta from './endpoints/admin/meta.js';
import * as ep___admin_abuseReportResolver_create from './endpoints/admin/abuse-report-resolver/create.js';
@ -838,7 +837,7 @@ interface IEndpointMetaBase {
*/
readonly requireAdmin?: boolean;
readonly requireRolePolicy?: keyof RolePolicies;
readonly requireRolePolicy?: KeyOf<'RolePolicies'>;
/**
*

View file

@ -62,17 +62,17 @@ export const meta = {
reporter: {
type: 'object',
nullable: false, optional: false,
ref: 'User',
ref: 'UserDetailedNotMe',
},
targetUser: {
type: 'object',
nullable: false, optional: false,
ref: 'User',
ref: 'UserDetailedNotMe',
},
assignee: {
type: 'object',
nullable: true, optional: true,
ref: 'User',
ref: 'UserDetailedNotMe',
},
},
},

View file

@ -11,6 +11,7 @@ import { SignupService } from '@/core/SignupService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { localUsernameSchema, passwordSchema } from '@/models/User.js';
import { DI } from '@/di-symbols.js';
import { Packed } from '@/misc/json-schema.js';
export const meta = {
tags: ['admin'],
@ -18,7 +19,7 @@ export const meta = {
res: {
type: 'object',
optional: false, nullable: false,
ref: 'User',
ref: 'MeDetailed',
properties: {
token: {
type: 'string',
@ -60,11 +61,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
});
const res = await this.userEntityService.pack(account, account, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
});
}) as Packed<'MeDetailed'> & { token: string };
(res as any).token = secret;
res.token = secret;
return res;
});

View file

@ -27,7 +27,7 @@ export const meta = {
res: {
type: 'object',
optional: false, nullable: false,
ref: 'User',
ref: 'UserDetailedNotMe',
},
} as const;
@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
const res = await this.userEntityService.pack(profile.user!, null, {
detail: true,
schema: 'UserDetailedNotMe',
});
return res;

View file

@ -92,7 +92,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return await Promise.all(assigns.map(async assign => ({
id: assign.id,
createdAt: this.idService.parse(assign.id).date.toISOString(),
user: await this.userEntityService.pack(assign.user!, me, { detail: true }),
user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
expiresAt: assign.expiresAt?.toISOString() ?? null,
})));
});

View file

@ -50,7 +50,7 @@ export const meta = {
user: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
ref: 'UserDetailedNotMe',
},
},
},

View file

@ -114,7 +114,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}

View file

@ -148,7 +148,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (user != null) {
return {
type: 'User',
object: await this.userEntityService.pack(user, me, { detail: true }),
object: await this.userEntityService.pack(user, me, { schema: 'UserDetailedNotMe' }),
};
} else if (note != null) {
try {

View file

@ -112,7 +112,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return {
accessToken: accessToken.token,
user: await this.userEntityService.pack(session.userId, null, {
detail: true,
schema: 'UserDetailedNotMe',
}),
};
});

View file

@ -102,7 +102,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
await this.userBlockingService.block(blocker, blockee);
return await this.userEntityService.pack(blockee.id, blocker, {
detail: true,
schema: 'UserDetailedNotMe',
});
});
}

View file

@ -103,7 +103,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
await this.userBlockingService.unblock(blocker, blockee);
return await this.userEntityService.pack(blockee.id, blocker, {
detail: true,
schema: 'UserDetailedNotMe',
});
});
}

View file

@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
relations: ['user'],
});
const users = await this.userEntityService.packMany(records.map(r => r.user!), null, { detail: false });
const users = await this.userEntityService.packMany(records.map(r => r.user!), null);
return records.map(r => ({
id: r.id,

View file

@ -54,7 +54,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
.limit(ps.limit)
.getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailedNotMe' });
});
}
}

View file

@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.limit(ps.limit).getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}

View file

@ -71,8 +71,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
userProfile.loggedInDates = [...userProfile.loggedInDates, today];
}
return await this.userEntityService.pack<true, true>(userProfile.user!, userProfile.user!, {
detail: true,
return await this.userEntityService.pack(userProfile.user!, userProfile.user!, {
schema: 'MeDetailed',
includeSecrets: isSecure,
userProfile,
});

View file

@ -64,7 +64,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -111,7 +111,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -74,7 +74,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));
});

View file

@ -97,7 +97,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));
});

View file

@ -69,7 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Publish meUpdated event
this.globalEventService.publishMainStream(me.id, 'meUpdated', await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
}));

View file

@ -66,8 +66,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err;
});
return await this.userEntityService.pack<true, true>(me.id, me, {
detail: true,
return await this.userEntityService.pack(me.id, me, {
schema: 'MeDetailed',
});
});
}

View file

@ -51,8 +51,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err;
});
return await this.userEntityService.pack<true, true>(me.id, me, {
detail: true,
return await this.userEntityService.pack(me.id, me, {
schema: 'MeDetailed',
});
});
}

View file

@ -43,7 +43,7 @@ export const meta = {
res: {
type: 'object',
ref: 'UserDetailed',
ref: 'MeDetailed',
},
} as const;
@ -106,7 +106,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
});
const iObj = await this.userEntityService.pack(me.id, me, {
detail: true,
schema: 'MeDetailed',
includeSecrets: true,
});

View file

@ -450,8 +450,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
verifiedLinks: [],
});
const iObj = await this.userEntityService.pack<true, true>(user.id, user, {
detail: true,
const iObj = await this.userEntityService.pack(user.id, user, {
schema: 'MeDetailed',
includeSecrets: isSecure,
});

View file

@ -307,6 +307,11 @@ export const meta = {
type: 'string',
optional: false, nullable: true,
},
policies: {
type: 'object',
optional: false, nullable: false,
ref: 'RolePolicies',
},
},
},
} as const;

View file

@ -55,7 +55,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
var: ps.var,
userId: me.id,
user: await this.userEntityService.pack(me.id, { id: page.userId }, {
detail: true,
schema: 'UserDetailed',
}),
});
});

View file

@ -52,7 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
host: acct.host ?? IsNull(),
})));
return await this.userEntityService.packMany(users.filter(x => x !== null) as MiUser[], me, { detail: true });
return await this.userEntityService.packMany(users.filter(x => x !== null) as MiUser[], me, { schema: 'UserDetailed' });
});
}
}

View file

@ -14,6 +14,32 @@ export const meta = {
requireCredential: false,
res: {
type: 'array',
items: {
type: 'object',
properties: {
createdAt: {
type: 'string',
format: 'date-time',
},
users: {
type: 'number',
},
data: {
type: 'object',
additionalProperties: {
anyOf: [{
type: 'number',
}],
},
},
},
required: [
'createdAt',
'users',
'data',
],
},
},
allowGet: true,

View file

@ -37,7 +37,7 @@ export const meta = {
},
user: {
type: 'object',
ref: 'User',
ref: 'UserDetailed',
},
},
required: ['id', 'user'],
@ -94,7 +94,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return await Promise.all(assigns.map(async assign => ({
id: assign.id,
user: await this.userEntityService.pack(assign.user!, me, { detail: true }),
user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
})));
});
}

View file

@ -89,7 +89,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}

View file

@ -122,7 +122,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Make replies object (includes weights)
const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({
user: await this.userEntityService.pack(user, me, { detail: true }),
user: await this.userEntityService.pack(user, me, { schema: 'UserDetailed' }),
weight: repliedUsers[user] / peak,
})));

View file

@ -46,7 +46,7 @@ export const meta = {
},
user: {
type: 'object',
ref: 'User',
ref: 'UserLite',
},
withReplies: {
type: 'boolean',

View file

@ -76,7 +76,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const users = await query.limit(ps.limit).offset(ps.offset).getMany();
return await this.userEntityService.packMany(users, me, { detail: true });
return await this.userEntityService.packMany(users, me, { schema: 'UserDetailed' });
});
}
}

View file

@ -131,7 +131,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
.getMany();
}
return await this.userEntityService.packMany(users, me, { detail: !!ps.detail });
return await this.userEntityService.packMany(users, me, { schema: ps.detail ? 'UserDetailed' : 'UserLite' });
});
}
}

View file

@ -141,7 +141,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
}
return await this.userEntityService.packMany(users, me, { detail: ps.detail });
return await this.userEntityService.packMany(users, me, { schema: ps.detail ? 'UserDetailed' : 'UserLite' });
});
}
}

View file

@ -116,7 +116,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
return await Promise.all(_users.map(u => this.userEntityService.pack(u, me, {
detail: true,
schema: 'UserDetailed',
})));
} else {
// Lookup user
@ -146,7 +146,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
return await this.userEntityService.pack(user, me, {
detail: true,
schema: 'UserDetailed',
});
}
});

View file

@ -547,10 +547,10 @@ export type Channels = {
mention: (payload: Note) => void;
reply: (payload: Note) => void;
renote: (payload: Note) => void;
follow: (payload: User) => void;
followed: (payload: User) => void;
unfollow: (payload: User) => void;
meUpdated: (payload: MeDetailed) => void;
follow: (payload: UserDetailedNotMe) => void;
followed: (payload: UserDetailed | UserLite) => void;
unfollow: (payload: UserDetailed) => void;
meUpdated: (payload: UserDetailed) => void;
pageEvent: (payload: PageEvent) => void;
urlUploadFinished: (payload: {
marker: string;
@ -649,6 +649,7 @@ export type Channels = {
params: {
listId: string;
withFiles?: boolean;
withRenotes?: boolean;
withCats?: boolean;
};
events: {
@ -700,7 +701,7 @@ export type Channels = {
fileUpdated: (payload: DriveFile) => void;
folderCreated: (payload: DriveFolder) => void;
folderDeleted: (payload: DriveFolder['id']) => void;
folderUpdated: (payload: DriveFile) => void;
folderUpdated: (payload: DriveFolder) => void;
};
receives: null;
};
@ -742,6 +743,46 @@ export type Channels = {
};
receives: null;
};
reversiGame: {
params: {
gameId: string;
};
events: {
started: (payload: {
game: ReversiGameDetailed;
}) => void;
ended: (payload: {
winnerId: User['id'] | null;
game: ReversiGameDetailed;
}) => void;
canceled: (payload: {
userId: User['id'];
}) => void;
changeReadyStates: (payload: {
user1: boolean;
user2: boolean;
}) => void;
updateSettings: (payload: {
userId: User['id'];
key: string;
value: any;
}) => void;
log: (payload: Record<string, any>) => void;
};
receives: {
putStone: {
pos: number;
id: string;
};
ready: boolean;
cancel: null | Record<string, never>;
updateSettings: {
key: string;
value: any;
};
claimTimeIsUp: null | Record<string, never>;
};
};
};
// @public (undocumented)
@ -1758,6 +1799,7 @@ declare namespace entities {
Hashtag,
InviteCode,
Page,
PageBlock,
Channel,
QueueCount,
Antenna,
@ -1770,6 +1812,7 @@ declare namespace entities {
Signin,
RoleLite,
Role,
RolePolicies,
ReversiGameLite,
ReversiGameDetailed
}
@ -2329,7 +2372,7 @@ type ModerationLog = {
id: ID;
createdAt: DateString;
userId: User['id'];
user: UserDetailed | null;
user: UserDetailedNotMe | null;
} & ({
type: 'updateServerSettings';
info: ModerationLogPayloads['updateServerSettings'];
@ -2656,6 +2699,9 @@ export const notificationTypes: readonly ["note", "follow", "mention", "reply",
// @public (undocumented)
type Page = components['schemas']['Page'];
// @public (undocumented)
type PageBlock = components['schemas']['PageBlock'];
// @public (undocumented)
type PageEvent = {
pageId: Page['id'];
@ -2804,6 +2850,9 @@ type Role = components['schemas']['Role'];
// @public (undocumented)
type RoleLite = components['schemas']['RoleLite'];
// @public (undocumented)
type RolePolicies = components['schemas']['RolePolicies'];
// @public (undocumented)
type RolesListResponse = operations['roles/list']['responses']['200']['content']['application/json'];

View file

@ -2,7 +2,7 @@
"type": "module",
"name": "cherrypick-js",
"version": "4.7.0-beta.1",
"basedMisskeyVersion": "2024.2.0-beta.3",
"basedMisskeyVersion": "2024.2.0-beta.7",
"description": "CherryPick SDK for JavaScript",
"types": "./built/dts/index.d.ts",
"exports": {
@ -20,7 +20,7 @@
"ts": "npm run ts-esm && npm run ts-dts",
"ts-esm": "tsc --outDir built/esm",
"ts-dts": "tsc --outDir built/dts --declaration true --emitDeclarationOnly true --declarationMap true",
"watch": "nodemon -w src -e ts,js,cjs,mjs,json --exec \"pnpm run build\"",
"watch": "nodemon -w src -e ts,js,cjs,mjs,json --exec \"pnpm run ts\"",
"tsd": "tsd",
"api": "pnpm api-extractor run --local --verbose",
"api-prod": "pnpm api-extractor run --verbose",
@ -40,7 +40,7 @@
"@misskey-dev/eslint-plugin": "1.0.0",
"@swc/jest": "0.2.31",
"@types/jest": "29.5.11",
"@types/node": "20.11.5",
"@types/node": "20.11.10",
"@typescript-eslint/eslint-plugin": "6.18.1",
"@typescript-eslint/parser": "6.18.1",
"eslint": "8.56.0",

View file

@ -1,7 +1,7 @@
/*
* version: 4.7.0-beta.1
* basedMisskeyVersion: 2024.2.0-beta.7
* generatedAt: 2024-01-25T07:07:45.745Z
* basedMisskeyVersion: 2024.2.0-beta.8
* generatedAt: 2024-01-31T08:08:55.554Z
*/
import type { SwitchCaseResponseType } from '../api.js';

View file

@ -1,7 +1,7 @@
/*
* version: 4.7.0-beta.1
* basedMisskeyVersion: 2024.2.0-beta.7
* generatedAt: 2024-01-25T07:07:45.742Z
* basedMisskeyVersion: 2024.2.0-beta.8
* generatedAt: 2024-01-31T08:08:55.552Z
*/
import type {

View file

@ -1,7 +1,7 @@
/*
* version: 4.7.0-beta.1
* basedMisskeyVersion: 2024.2.0-beta.7
* generatedAt: 2024-01-25T07:07:45.740Z
* basedMisskeyVersion: 2024.2.0-beta.8
* generatedAt: 2024-01-31T08:08:55.551Z
*/
import { operations } from './types.js';

View file

@ -1,7 +1,7 @@
/*
* version: 4.7.0-beta.1
* basedMisskeyVersion: 2024.2.0-beta.7
* generatedAt: 2024-01-25T07:07:45.738Z
* basedMisskeyVersion: 2024.2.0-beta.8
* generatedAt: 2024-01-31T08:08:55.546Z
*/
import { components } from './types.js';
@ -32,6 +32,7 @@ export type Blocking = components['schemas']['Blocking'];
export type Hashtag = components['schemas']['Hashtag'];
export type InviteCode = components['schemas']['InviteCode'];
export type Page = components['schemas']['Page'];
export type PageBlock = components['schemas']['PageBlock'];
export type Channel = components['schemas']['Channel'];
export type QueueCount = components['schemas']['QueueCount'];
export type Antenna = components['schemas']['Antenna'];
@ -44,5 +45,6 @@ export type Flash = components['schemas']['Flash'];
export type Signin = components['schemas']['Signin'];
export type RoleLite = components['schemas']['RoleLite'];
export type Role = components['schemas']['Role'];
export type RolePolicies = components['schemas']['RolePolicies'];
export type ReversiGameLite = components['schemas']['ReversiGameLite'];
export type ReversiGameDetailed = components['schemas']['ReversiGameDetailed'];

View file

@ -3,8 +3,8 @@
/*
* version: 4.7.0-beta.1
* basedMisskeyVersion: 2024.2.0-beta.7
* generatedAt: 2024-01-25T07:07:45.651Z
* basedMisskeyVersion: 2024.2.0-beta.8
* generatedAt: 2024-01-31T08:08:55.464Z
*/
/**
@ -4032,32 +4032,7 @@ export type components = {
unlockedAt: number;
}[];
loggedInDays: number;
policies: {
gtlAvailable: boolean;
ltlAvailable: boolean;
canPublicNote: boolean;
canInvite: boolean;
inviteLimit: number;
inviteLimitCycle: number;
inviteExpirationTime: number;
canManageCustomEmojis: boolean;
canManageAvatarDecorations: boolean;
canSearchNotes: boolean;
canUseTranslator: boolean;
canHideAds: boolean;
driveCapacityMb: number;
alwaysMarkNsfw: boolean;
pinLimit: number;
antennaLimit: number;
wordMuteLimit: number;
webhookLimit: number;
clipLimit: number;
noteEachClipsLimit: number;
userListLimit: number;
userEachUserListsLimit: number;
rateLimitFactor: number;
avatarDecorationLimit: number;
};
policies: components['schemas']['RolePolicies'];
email?: string | null;
emailVerified?: boolean | null;
securityKeysList?: {
@ -4074,7 +4049,7 @@ export type components = {
UserDetailedNotMe: components['schemas']['UserLite'] & components['schemas']['UserDetailedNotMeOnly'];
MeDetailed: components['schemas']['UserLite'] & components['schemas']['UserDetailedNotMeOnly'] & components['schemas']['MeDetailedOnly'];
UserDetailed: components['schemas']['UserDetailedNotMe'] | components['schemas']['MeDetailed'];
User: components['schemas']['UserLite'] | components['schemas']['UserDetailed'] | components['schemas']['UserDetailedNotMe'] | components['schemas']['MeDetailed'];
User: components['schemas']['UserLite'] | components['schemas']['UserDetailed'];
UserList: {
/**
* Format: id
@ -4131,8 +4106,10 @@ export type components = {
text: string;
title: string;
imageUrl: string | null;
icon: string;
display: string;
/** @enum {string} */
icon: 'info' | 'warning' | 'error' | 'success';
/** @enum {string} */
display: 'dialog' | 'normal' | 'banner';
needConfirmationToRead: boolean;
silence: boolean;
forYou: boolean;
@ -4203,13 +4180,26 @@ export type components = {
renote?: components['schemas']['Note'] | null;
disableRightClick?: boolean;
isHidden?: boolean;
visibility: string;
/** @enum {string} */
visibility: 'public' | 'home' | 'followers' | 'specified';
mentions?: string[];
visibleUserIds?: string[];
fileIds?: string[];
files?: components['schemas']['DriveFile'][];
tags?: string[];
poll?: Record<string, never> | null;
poll?: ({
/** Format: date-time */
expiresAt?: string | null;
multiple: boolean;
choices: {
isVoted: boolean;
text: string;
votes: number;
}[];
}) | null;
emojis?: {
[key: string]: string;
};
event?: Record<string, never> | null;
/**
* Format: id
@ -4226,14 +4216,19 @@ export type components = {
}) | null;
localOnly?: boolean;
reactionAcceptance: string | null;
reactions: Record<string, never>;
reactionEmojis: {
[key: string]: string;
};
reactions: {
[key: string]: number;
};
renoteCount: number;
repliesCount: number;
uri?: string;
url?: string;
reactionAndUserPairCache?: string[];
clippedCount?: number;
myReaction?: Record<string, never> | null;
myReaction?: string | null;
};
NoteReaction: {
/**
@ -4264,21 +4259,162 @@ export type components = {
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'note' | 'follow' | 'mention' | 'reply' | 'renote' | 'quote' | 'reaction' | 'pollEnded' | 'receiveFollowRequest' | 'followRequestAccepted' | 'roleAssigned' | 'groupInvited' | 'achievementEarned' | 'app' | 'test' | 'reaction:grouped' | 'renote:grouped';
user?: components['schemas']['UserLite'] | null;
type: 'note';
user: components['schemas']['UserLite'];
/** Format: id */
userId?: string | null;
note?: components['schemas']['Note'] | null;
reaction?: string | null;
achievement?: string;
body?: string | null;
header?: string | null;
icon?: string | null;
reactions?: {
userId: string;
note: components['schemas']['Note'];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'mention';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
note: components['schemas']['Note'];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'reply';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
note: components['schemas']['Note'];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'renote';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
note: components['schemas']['Note'];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'quote';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
note: components['schemas']['Note'];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'reaction';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
note: components['schemas']['Note'];
reaction: string;
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'pollEnded';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
note: components['schemas']['Note'];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'follow';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'receiveFollowRequest';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'followRequestAccepted';
user: components['schemas']['UserLite'];
/** Format: id */
userId: string;
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'roleAssigned';
role: components['schemas']['Role'];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'achievementEarned';
achievement: string;
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'app';
body: string;
header: string;
icon: string;
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'reaction:grouped';
note: components['schemas']['Note'];
reactions: {
user: components['schemas']['UserLite'];
reaction: string;
}[] | null;
users?: components['schemas']['UserLite'][] | null;
}[];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'renote:grouped';
note: components['schemas']['Note'];
users: components['schemas']['UserLite'][];
} | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'test';
};
DriveFile: {
/**
@ -4359,8 +4495,8 @@ export type components = {
followeeId: string;
/** Format: id */
followerId: string;
followee?: components['schemas']['UserDetailed'];
follower?: components['schemas']['UserDetailed'];
followee?: components['schemas']['UserDetailedNotMe'];
follower?: components['schemas']['UserDetailedNotMe'];
};
Muting: {
/**
@ -4374,7 +4510,7 @@ export type components = {
expiresAt: string | null;
/** Format: id */
muteeId: string;
mutee: components['schemas']['UserDetailed'];
mutee: components['schemas']['UserDetailedNotMe'];
};
RenoteMuting: {
/**
@ -4386,7 +4522,7 @@ export type components = {
createdAt: string;
/** Format: id */
muteeId: string;
mutee: components['schemas']['UserDetailed'];
mutee: components['schemas']['UserDetailedNotMe'];
};
Blocking: {
/**
@ -4398,7 +4534,7 @@ export type components = {
createdAt: string;
/** Format: id */
blockeeId: string;
blockee: components['schemas']['UserDetailed'];
blockee: components['schemas']['UserDetailedNotMe'];
};
Hashtag: {
/** @example cherrypick */
@ -4441,7 +4577,7 @@ export type components = {
/** Format: id */
userId: string;
user: components['schemas']['UserLite'];
content: Record<string, never>[];
content: components['schemas']['PageBlock'][];
variables: Record<string, never>[];
title: string;
name: string;
@ -4456,6 +4592,29 @@ export type components = {
likedCount: number;
isLiked?: boolean;
};
PageBlock: OneOf<[{
id: string;
/** @enum {string} */
type: 'text';
text: string;
}, {
id: string;
/** @enum {string} */
type: 'section';
title: string;
children: components['schemas']['PageBlock'][];
}, {
id: string;
/** @enum {string} */
type: 'image';
fileId: string | null;
}, {
id: string;
/** @enum {string} */
type: 'note';
detailed: boolean;
note: string | null;
}]>;
Channel: {
/**
* Format: id
@ -4677,129 +4836,40 @@ export type components = {
/** @example false */
canEditMembersByModerator: boolean;
policies: {
pinLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canInvite: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
clipLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canHideAds: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
inviteLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
antennaLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
gtlAvailable: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
ltlAvailable: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
webhookLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canPublicNote: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
userListLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
wordMuteLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
alwaysMarkNsfw: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canSearchNotes: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
driveCapacityMb: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
rateLimitFactor: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
inviteLimitCycle: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
noteEachClipsLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
inviteExpirationTime: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canManageCustomEmojis: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
userEachUserListsLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canManageAvatarDecorations: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canUseTranslator: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
avatarDecorationLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
[key: string]: {
value?: number | boolean;
priority?: number;
useDefault?: boolean;
};
};
usersCount: number;
});
RolePolicies: {
gtlAvailable: boolean;
ltlAvailable: boolean;
canPublicNote: boolean;
canInvite: boolean;
inviteLimit: number;
inviteLimitCycle: number;
inviteExpirationTime: number;
canManageCustomEmojis: boolean;
canManageAvatarDecorations: boolean;
canSearchNotes: boolean;
canUseTranslator: boolean;
canHideAds: boolean;
driveCapacityMb: number;
alwaysMarkNsfw: boolean;
pinLimit: number;
antennaLimit: number;
wordMuteLimit: number;
webhookLimit: number;
clipLimit: number;
noteEachClipsLimit: number;
userListLimit: number;
userEachUserListsLimit: number;
rateLimitFactor: number;
avatarDecorationLimit: number;
};
ReversiGameLite: {
/** Format: id */
id: string;
@ -5347,9 +5417,9 @@ export type operations = {
targetUserId: string;
/** Format: id */
assigneeId: string | null;
reporter: components['schemas']['User'];
targetUser: components['schemas']['User'];
assignee?: components['schemas']['User'] | null;
reporter: components['schemas']['UserDetailedNotMe'];
targetUser: components['schemas']['UserDetailedNotMe'];
assignee?: components['schemas']['UserDetailedNotMe'] | null;
})[];
};
};
@ -5404,7 +5474,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['User'];
'application/json': components['schemas']['MeDetailed'];
};
};
/** @description Client error */
@ -5509,7 +5579,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['User'];
'application/json': components['schemas']['UserDetailedNotMe'];
};
};
/** @description Client error */
@ -8818,7 +8888,7 @@ export type operations = {
info: Record<string, never>;
/** Format: id */
userId: string;
user: components['schemas']['UserDetailed'];
user: components['schemas']['UserDetailedNotMe'];
}[];
};
};
@ -11813,14 +11883,18 @@ export type operations = {
200: {
content: {
'application/json': {
'local.incCount': number[];
'local.incSize': number[];
'local.decCount': number[];
'local.decSize': number[];
'remote.incCount': number[];
'remote.incSize': number[];
'remote.decCount': number[];
'remote.decSize': number[];
local: {
incCount: number[];
incSize: number[];
decCount: number[];
decSize: number[];
};
remote: {
incCount: number[];
incSize: number[];
decCount: number[];
decSize: number[];
};
};
};
};
@ -11948,30 +12022,44 @@ export type operations = {
200: {
content: {
'application/json': {
'requests.failed': number[];
'requests.succeeded': number[];
'requests.received': number[];
'notes.total': number[];
'notes.inc': number[];
'notes.dec': number[];
'notes.diffs.normal': number[];
'notes.diffs.reply': number[];
'notes.diffs.renote': number[];
'notes.diffs.withFile': number[];
'users.total': number[];
'users.inc': number[];
'users.dec': number[];
'following.total': number[];
'following.inc': number[];
'following.dec': number[];
'followers.total': number[];
'followers.inc': number[];
'followers.dec': number[];
'drive.totalFiles': number[];
'drive.incFiles': number[];
'drive.decFiles': number[];
'drive.incUsage': number[];
'drive.decUsage': number[];
requests: {
failed: number[];
succeeded: number[];
received: number[];
};
notes: {
total: number[];
inc: number[];
dec: number[];
diffs: {
normal: number[];
reply: number[];
renote: number[];
withFile: number[];
};
};
users: {
total: number[];
inc: number[];
dec: number[];
};
following: {
total: number[];
inc: number[];
dec: number[];
};
followers: {
total: number[];
inc: number[];
dec: number[];
};
drive: {
totalFiles: number[];
incFiles: number[];
decFiles: number[];
incUsage: number[];
decUsage: number[];
};
};
};
};
@ -12031,20 +12119,28 @@ export type operations = {
200: {
content: {
'application/json': {
'local.total': number[];
'local.inc': number[];
'local.dec': number[];
'local.diffs.normal': number[];
'local.diffs.reply': number[];
'local.diffs.renote': number[];
'local.diffs.withFile': number[];
'remote.total': number[];
'remote.inc': number[];
'remote.dec': number[];
'remote.diffs.normal': number[];
'remote.diffs.reply': number[];
'remote.diffs.renote': number[];
'remote.diffs.withFile': number[];
local: {
total: number[];
inc: number[];
dec: number[];
diffs: {
normal: number[];
reply: number[];
renote: number[];
withFile: number[];
};
};
remote: {
total: number[];
inc: number[];
dec: number[];
diffs: {
normal: number[];
reply: number[];
renote: number[];
withFile: number[];
};
};
};
};
};
@ -12173,18 +12269,30 @@ export type operations = {
200: {
content: {
'application/json': {
'local.followings.total': number[];
'local.followings.inc': number[];
'local.followings.dec': number[];
'local.followers.total': number[];
'local.followers.inc': number[];
'local.followers.dec': number[];
'remote.followings.total': number[];
'remote.followings.inc': number[];
'remote.followings.dec': number[];
'remote.followers.total': number[];
'remote.followers.inc': number[];
'remote.followers.dec': number[];
local: {
followings: {
total: number[];
inc: number[];
dec: number[];
};
followers: {
total: number[];
inc: number[];
dec: number[];
};
};
remote: {
followings: {
total: number[];
inc: number[];
dec: number[];
};
followers: {
total: number[];
inc: number[];
dec: number[];
};
};
};
};
};
@ -12249,10 +12357,12 @@ export type operations = {
total: number[];
inc: number[];
dec: number[];
'diffs.normal': number[];
'diffs.reply': number[];
'diffs.renote': number[];
'diffs.withFile': number[];
diffs: {
normal: number[];
reply: number[];
renote: number[];
withFile: number[];
};
};
};
};
@ -12314,10 +12424,14 @@ export type operations = {
200: {
content: {
'application/json': {
'upv.user': number[];
'pv.user': number[];
'upv.visitor': number[];
'pv.visitor': number[];
upv: {
user: number[];
visitor: number[];
};
pv: {
user: number[];
visitor: number[];
};
};
};
};
@ -12379,8 +12493,12 @@ export type operations = {
200: {
content: {
'application/json': {
'local.count': number[];
'remote.count': number[];
local: {
count: number[];
};
remote: {
count: number[];
};
};
};
};
@ -12440,12 +12558,16 @@ export type operations = {
200: {
content: {
'application/json': {
'local.total': number[];
'local.inc': number[];
'local.dec': number[];
'remote.total': number[];
'remote.inc': number[];
'remote.dec': number[];
local: {
total: number[];
inc: number[];
dec: number[];
};
remote: {
total: number[];
inc: number[];
dec: number[];
};
};
};
};
@ -18996,7 +19118,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['UserDetailed'];
'application/json': components['schemas']['MeDetailed'];
};
};
/** @description Client error */
@ -20174,6 +20296,7 @@ export type operations = {
privacyPolicyUrl: string | null;
serverRules: string[];
themeColor: string | null;
policies: components['schemas']['RolePolicies'];
};
};
};
@ -24252,7 +24375,7 @@ export type operations = {
'application/json': {
/** Format: misskey:id */
id: string;
user: components['schemas']['User'];
user: components['schemas']['UserDetailed'];
}[];
};
};
@ -26679,7 +26802,7 @@ export type operations = {
createdAt: string;
/** Format: misskey:id */
userId: string;
user: components['schemas']['User'];
user: components['schemas']['UserLite'];
withReplies: boolean;
}[];
};
@ -27711,7 +27834,14 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'application/json': unknown;
'application/json': {
/** Format: date-time */
createdAt: string;
users: number;
data: {
[key: string]: number;
};
}[];
};
};
/** @description Client error */

View file

@ -1,5 +1,5 @@
import { ModerationLogPayloads } from './consts.js';
import { Announcement, EmojiDetailed, MeDetailed, Page, User, UserDetailed } from './autogen/models.js';
import { Announcement, EmojiDetailed, MeDetailed, Page, User, UserDetailedNotMe } from './autogen/models.js';
export * from './autogen/entities.js';
export * from './autogen/models.js';
@ -19,7 +19,7 @@ export type ModerationLog = {
id: ID;
createdAt: DateString;
userId: User['id'];
user: UserDetailed | null;
user: UserDetailedNotMe | null;
} & ({
type: 'updateServerSettings';
info: ModerationLogPayloads['updateServerSettings'];

View file

@ -2,12 +2,14 @@ import {
Antenna,
DriveFile,
DriveFolder,
MeDetailed,
Note,
Notification,
Signin,
User,
UserGroup,
UserDetailed,
UserDetailedNotMe,
UserLite,
} from './autogen/models.js';
import {
AnnouncementCreated,
@ -19,6 +21,7 @@ import {
QueueStatsLog,
ServerStats,
ServerStatsLog,
ReversiGameDetailed,
} from './entities.js';
export type Channels = {
@ -29,10 +32,10 @@ export type Channels = {
mention: (payload: Note) => void;
reply: (payload: Note) => void;
renote: (payload: Note) => void;
follow: (payload: User) => void; // 自分が他人をフォローしたとき
followed: (payload: User) => void; // 他人が自分をフォローしたとき
unfollow: (payload: User) => void; // 自分が他人をフォロー解除したとき
meUpdated: (payload: MeDetailed) => void;
follow: (payload: UserDetailedNotMe) => void; // 自分が他人をフォローしたとき
followed: (payload: UserDetailed | UserLite) => void; // 他人が自分をフォローしたとき
unfollow: (payload: UserDetailed) => void; // 自分が他人をフォロー解除したとき
meUpdated: (payload: UserDetailed) => void;
pageEvent: (payload: PageEvent) => void;
urlUploadFinished: (payload: { marker: string; file: DriveFile; }) => void;
readAllNotifications: () => void;
@ -128,6 +131,7 @@ export type Channels = {
params: {
listId: string;
withFiles?: boolean;
withRenotes?: boolean;
withCats?: boolean;
};
events: {
@ -179,7 +183,7 @@ export type Channels = {
fileUpdated: (payload: DriveFile) => void;
folderCreated: (payload: DriveFolder) => void;
folderDeleted: (payload: DriveFolder['id']) => void;
folderUpdated: (payload: DriveFile) => void;
folderUpdated: (payload: DriveFolder) => void;
};
receives: null;
};
@ -220,6 +224,32 @@ export type Channels = {
}
};
receives: null;
};
reversiGame: {
params: {
gameId: string;
};
events: {
started: (payload: { game: ReversiGameDetailed; }) => void;
ended: (payload: { winnerId: User['id'] | null; game: ReversiGameDetailed; }) => void;
canceled: (payload: { userId: User['id']; }) => void;
changeReadyStates: (payload: { user1: boolean; user2: boolean; }) => void;
updateSettings: (payload: { userId: User['id']; key: string; value: any; }) => void;
log: (payload: Record<string, any>) => void;
};
receives: {
putStone: {
pos: number;
id: string;
};
ready: boolean;
cancel: null | Record<string, never>;
updateSettings: {
key: string;
value: any;
};
claimTimeIsUp: null | Record<string, never>;
}
}
};

View file

@ -17,3 +17,8 @@ declare const _DATA_TRANSFER_DECK_COLUMN_: string;
// for dev-mode
declare const _LANGS_FULL_: string[][];
// TagCanvas
interface Window {
TagCanvas: any;
}

View file

@ -21,15 +21,15 @@
"@fontsource/jetbrains-mono": "^5.0.12",
"@github/webauthn-json": "2.1.1",
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
"@misskey-dev/browser-image-resizer": "2.2.1-misskey.10",
"@misskey-dev/browser-image-resizer": "2024.1.0",
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-replace": "5.0.5",
"@rollup/pluginutils": "5.1.0",
"@syuilo/aiscript": "0.17.0",
"@tabler/icons-webfont": "2.44.0",
"@twemoji/parser": "15.0.0",
"@vitejs/plugin-vue": "5.0.2",
"@vue/compiler-sfc": "3.4.3",
"@vitejs/plugin-vue": "5.0.3",
"@vue/compiler-sfc": "3.4.15",
"autosize": "6.0.1",
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.6",
"astring": "1.8.6",
@ -43,7 +43,7 @@
"chartjs-plugin-zoom": "2.0.1",
"cherrypick-js": "workspace:*",
"cherrypick-mfm-js": "0.24.0-cherrypick.4",
"chromatic": "10.3.1",
"chromatic": "10.6.1",
"compare-versions": "6.1.0",
"cropperjs": "2.0.0-beta.4",
"date-fns": "2.30.0",
@ -69,7 +69,7 @@
"strict-event-emitter-types": "2.0.0",
"temml": "0.10.20",
"textarea-caret": "3.1.0",
"three": "0.160.0",
"three": "0.160.1",
"throttle-debounce": "5.0.0",
"tinycolor2": "1.6.0",
"tinyld": "^1.3.4",
@ -84,8 +84,8 @@
"vuedraggable": "next"
},
"devDependencies": {
"@misskey-dev/eslint-plugin": "^1.0.0",
"@misskey-dev/summaly": "^5.0.3",
"@misskey-dev/eslint-plugin": "1.0.0",
"@misskey-dev/summaly": "5.0.3",
"@storybook/addon-actions": "7.6.10",
"@storybook/addon-essentials": "7.6.10",
"@storybook/addon-interactions": "7.6.10",
@ -110,13 +110,13 @@
"@types/estree": "1.0.5",
"@types/matter-js": "0.19.6",
"@types/micromatch": "4.0.6",
"@types/node": "20.11.5",
"@types/node": "20.11.10",
"@types/prismjs": "^1.26.0",
"@types/punycode": "2.1.3",
"@types/sanitize-html": "2.9.5",
"@types/throttle-debounce": "5.0.2",
"@types/tinycolor2": "1.4.6",
"@types/uuid": "9.0.7",
"@types/uuid": "9.0.8",
"@types/ws": "8.5.10",
"@typescript-eslint/eslint-plugin": "6.18.1",
"@typescript-eslint/parser": "6.18.1",
@ -145,7 +145,7 @@
"vite-plugin-turbosnap": "1.0.3",
"vitest": "0.34.6",
"vitest-fetch-mock": "0.2.2",
"vue-eslint-parser": "9.4.0",
"vue-eslint-parser": "9.4.2",
"vue-tsc": "1.8.27"
}
}

View file

@ -22,7 +22,7 @@ import { getAccountFromId } from '@/scripts/get-account-from-id.js';
import { deckStore } from '@/ui/deck/deck-store.js';
import { miLocalStorage } from '@/local-storage.js';
import { fetchCustomEmojis } from '@/custom-emojis.js';
import { setupRouter } from '@/global/router/definition.js';
import { setupRouter } from '@/router/definition.js';
import { popup } from '@/os.js';
export async function common(createVue: () => App<Element>) {

View file

@ -19,7 +19,7 @@ import { claimAchievement, claimedAchievements } from '@/scripts/achievements.js
import { initializeSw } from '@/scripts/initialize-sw.js';
import { deckStore } from '@/ui/deck/deck-store.js';
import { emojiPicker } from '@/scripts/emoji-picker.js';
import { mainRouter } from '@/global/router/main.js';
import { mainRouter } from '@/router/main.js';
import { userName } from '@/filters/user.js';
import { vibrate } from '@/scripts/vibrate.js';

View file

@ -39,7 +39,7 @@ import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
user: Misskey.entities.User;
user: Misskey.entities.UserDetailed;
initialComment?: string;
}>();

View file

@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div>
<div v-if="achievements" :class="$style.root">
<div v-for="achievement in achievements" :key="achievement" :class="$style.achievement" class="_panel">
<div v-for="achievement in achievements" :key="achievement.name" :class="$style.achievement" class="_panel">
<div :class="$style.icon">
<div
:class="[$style.iconFrame, {

View file

@ -10,8 +10,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkAsUi v-if="!g(child).hidden" :component="g(child)" :components="props.components" :size="size"/>
</template>
</div>
<span v-else-if="c.type === 'text'" :class="{ [$style.fontSerif]: c.font === 'serif', [$style.fontMonospace]: c.font === 'monospace' }" :style="{ fontSize: c.size ? `${c.size * 100}%` : null, fontWeight: c.bold ? 'bold' : null, color: c.color ?? null }">{{ c.text }}</span>
<Mfm v-else-if="c.type === 'mfm'" :class="{ [$style.fontSerif]: c.font === 'serif', [$style.fontMonospace]: c.font === 'monospace' }" :style="{ fontSize: c.size ? `${c.size * 100}%` : null, fontWeight: c.bold ? 'bold' : null, color: c.color ?? null }" :text="c.text" @clickEv="c.onClickEv"/>
<span v-else-if="c.type === 'text'" :class="{ [$style.fontSerif]: c.font === 'serif', [$style.fontMonospace]: c.font === 'monospace' }" :style="{ fontSize: c.size ? `${c.size * 100}%` : undefined, fontWeight: c.bold ? 'bold' : undefined, color: c.color }">{{ c.text }}</span>
<Mfm v-else-if="c.type === 'mfm'" :class="{ [$style.fontSerif]: c.font === 'serif', [$style.fontMonospace]: c.font === 'monospace' }" :style="{ fontSize: c.size ? `${c.size * 100}%` : null, fontWeight: c.bold ? 'bold' : null, color: c.color ?? null }" :text="c.text ?? ''" @clickEv="c.onClickEv"/>
<MkButton v-else-if="c.type === 'button'" :primary="c.primary" :rounded="c.rounded" :disabled="c.disabled" :small="size === 'small'" inline @click="c.onClick">{{ c.text }}</MkButton>
<div v-else-if="c.type === 'buttons'" class="_buttons" :style="{ justifyContent: align }">
<MkButton v-for="button in c.buttons" :primary="button.primary" :rounded="button.rounded" :disabled="button.disabled" inline :small="size === 'small'" @click="button.onClick">{{ button.text }}</MkButton>
@ -20,19 +20,19 @@ SPDX-License-Identifier: AGPL-3.0-only
<template v-if="c.label" #label>{{ c.label }}</template>
<template v-if="c.caption" #caption>{{ c.caption }}</template>
</MkSwitch>
<MkTextarea v-else-if="c.type === 'textarea'" :modelValue="c.default" @update:modelValue="c.onInput">
<MkTextarea v-else-if="c.type === 'textarea'" :modelValue="c.default ?? null" @update:modelValue="c.onInput">
<template v-if="c.label" #label>{{ c.label }}</template>
<template v-if="c.caption" #caption>{{ c.caption }}</template>
</MkTextarea>
<MkInput v-else-if="c.type === 'textInput'" :small="size === 'small'" :modelValue="c.default" @update:modelValue="c.onInput">
<MkInput v-else-if="c.type === 'textInput'" :small="size === 'small'" :modelValue="c.default ?? null" @update:modelValue="c.onInput">
<template v-if="c.label" #label>{{ c.label }}</template>
<template v-if="c.caption" #caption>{{ c.caption }}</template>
</MkInput>
<MkInput v-else-if="c.type === 'numberInput'" :small="size === 'small'" :modelValue="c.default" type="number" @update:modelValue="c.onInput">
<MkInput v-else-if="c.type === 'numberInput'" :small="size === 'small'" :modelValue="c.default ?? null" type="number" @update:modelValue="c.onInput">
<template v-if="c.label" #label>{{ c.label }}</template>
<template v-if="c.caption" #caption>{{ c.caption }}</template>
</MkInput>
<MkSelect v-else-if="c.type === 'select'" :small="size === 'small'" :modelValue="c.default" @update:modelValue="c.onChange">
<MkSelect v-else-if="c.type === 'select'" :small="size === 'small'" :modelValue="c.default ?? null" @update:modelValue="c.onChange">
<template v-if="c.label" #label>{{ c.label }}</template>
<template v-if="c.caption" #caption>{{ c.caption }}</template>
<option v-for="item in c.items" :key="item.value" :value="item.value">{{ item.text }}</option>
@ -42,8 +42,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkPostForm
fixed
:instant="true"
:initialText="c.form.text"
:initialCw="c.form.cw"
:initialText="c.form?.text"
:initialCw="c.form?.cw"
/>
</div>
<MkFolder v-else-if="c.type === 'folder'" :defaultOpen="c.opened">
@ -52,7 +52,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkAsUi v-if="!g(child).hidden" :component="g(child)" :components="props.components" :size="size"/>
</template>
</MkFolder>
<div v-else-if="c.type === 'container'" :class="[$style.container, { [$style.fontSerif]: c.font === 'serif', [$style.fontMonospace]: c.font === 'monospace' }]" :style="{ textAlign: c.align ?? null, backgroundColor: c.bgColor ?? null, color: c.fgColor ?? null, borderWidth: c.borderWidth ? `${c.borderWidth}px` : 0, borderColor: c.borderColor ?? 'var(--divider)', padding: c.padding ? `${c.padding}px` : 0, borderRadius: c.rounded ? '8px' : 0 }">
<div v-else-if="c.type === 'container'" :class="[$style.container, { [$style.fontSerif]: c.font === 'serif', [$style.fontMonospace]: c.font === 'monospace' }]" :style="{ textAlign: c.align, backgroundColor: c.bgColor, color: c.fgColor, borderWidth: c.borderWidth ? `${c.borderWidth}px` : 0, borderColor: c.borderColor ?? 'var(--divider)', padding: c.padding ? `${c.padding}px` : 0, borderRadius: c.rounded ? '8px' : 0 }">
<template v-for="child in c.children" :key="child">
<MkAsUi v-if="!g(child).hidden" :component="g(child)" :components="props.components" :size="size" :align="c.align"/>
</template>
@ -68,7 +68,7 @@ import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import MkTextarea from '@/components/MkTextarea.vue';
import MkSelect from '@/components/MkSelect.vue';
import { AsUiComponent } from '@/scripts/aiscript/ui.js';
import { AsUiComponent, AsUiRoot, AsUiPostFormButton } from '@/scripts/aiscript/ui.js';
import MkFolder from '@/components/MkFolder.vue';
import MkPostForm from '@/components/MkPostForm.vue';
@ -85,20 +85,32 @@ const props = withDefaults(defineProps<{
const c = props.component;
function g(id) {
return props.components.find(x => x.value.id === id).value;
const v = props.components.find(x => x.value.id === id)?.value;
if (v) return v;
return {
id: 'dummy',
type: 'root',
children: [],
} as AsUiRoot;
}
const valueForSwitch = ref(c.default ?? false);
const valueForSwitch = ref('default' in c && typeof c.default === 'boolean' ? c.default : false);
function onSwitchUpdate(v) {
valueForSwitch.value = v;
if (c.onChange) c.onChange(v);
if ('onChange' in c && c.onChange) {
c.onChange(v as never);
}
}
function openPostForm() {
const form = (c as AsUiPostFormButton).form;
if (!form) return;
os.post({
initialText: c.form.text,
initialCw: c.form.cw,
initialText: form.text,
initialCw: form.cw,
instant: true,
});
}

View file

@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkA
v-else class="_button"
:class="[$style.root, { [$style.inline]: inline, [$style.primary]: primary, [$style.gradate]: gradate, [$style.danger]: danger, [$style.rounded]: rounded, [$style.full]: full, [$style.small]: small, [$style.large]: large, [$style.transparent]: transparent, [$style.asLike]: asLike }]"
:to="to"
:to="to ?? '#'"
@mousedown="onMousedown"
>
<div ref="ripples" :class="$style.ripples" :data-children-class="$style.ripple"></div>

Some files were not shown because too many files have changed in this diff Show more