Merge branch 'develop' into fix-7311

This commit is contained in:
かっこかり 2024-04-17 08:53:44 +09:00 committed by GitHub
commit 7dfd93f418
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 89 additions and 75 deletions

View File

@ -5,24 +5,23 @@ on:
branches: branches:
- master - master
- develop - develop
- improve-misskey-js-autogen-check
paths: paths:
- packages/backend/** - packages/backend/**
jobs: jobs:
check-misskey-js-autogen: # pull_request_target safety: permissions: read-all, and there are no secrets used in this job
generate-misskey-js:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
pull-requests: write contents: read
if: ${{ github.event.pull_request.mergeable == null || github.event.pull_request.mergeable == true }}
env:
api_json_name: "api-head.json"
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.1
with: with:
submodules: true submodules: true
ref: ${{ github.event.pull_request.head.sha }} ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: setup pnpm - name: setup pnpm
uses: pnpm/action-setup@v3 uses: pnpm/action-setup@v3
@ -39,79 +38,81 @@ jobs:
- name: install dependencies - name: install dependencies
run: pnpm i --frozen-lockfile run: pnpm i --frozen-lockfile
- name: wait get-api-diff # generate api.json
uses: lewagon/wait-on-check-action@v1.3.3 - name: Copy Config
run: cp .config/example.yml .config/default.yml
- name: Build
run: pnpm build
- name: Generate API JSON
run: pnpm --filter backend generate-api-json
# build misskey js
- name: Build misskey-js
run: |-
cp packages/backend/built/api.json packages/misskey-js/generator/api.json
pnpm run --filter misskey-js-type-generator generate
# packages/misskey-js/generator/built/autogen
- name: Upload Generated
uses: actions/upload-artifact@v4
with: with:
ref: ${{ github.event.pull_request.head.sha }} name: generated-misskey-js
check-regexp: get-from-misskey .+ path: packages/misskey-js/generator/built/autogen
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30
- name: Download artifact # pull_request_target safety: permissions: read-all, and there are no secrets used in this job
uses: actions/github-script@v7.0.1 get-actual-misskey-js:
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ github.event.pull_request.mergeable == null || github.event.pull_request.mergeable == true }}
steps:
- name: checkout
uses: actions/checkout@v4.1.1
with: with:
script: | submodules: true
const fs = require('fs'); ref: refs/pull/${{ github.event.pull_request.number }}/merge
const workflows = await github.rest.actions.listWorkflowRunsForRepo({ - name: Upload From Merged
owner: context.repo.owner, uses: actions/upload-artifact@v4
repo: context.repo.repo, with:
head_sha: `${{ github.event.pull_request.head.sha }}` name: actual-misskey-js
}).then(x => x.data.workflow_runs); path: packages/misskey-js/src/autogen
console.log(workflows.map(x => ({name: x.name, title: x.display_title}))); # pull_request_target safety: nothing is cloned from repository
comment-misskey-js-autogen:
runs-on: ubuntu-latest
needs: [generate-misskey-js, get-actual-misskey-js]
permissions:
pull-requests: write
steps:
- name: download generated-misskey-js
uses: actions/download-artifact@v4
with:
name: generated-misskey-js
path: misskey-js-generated
const run_id = workflows.find(x => x.name.includes("Get api.json from Misskey")).id; - name: download actual-misskey-js
uses: actions/download-artifact@v4
with:
name: actual-misskey-js
path: misskey-js-actual
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - name: check misskey-js changes
owner: context.repo.owner, id: check-changes
repo: context.repo.repo, run: |
run_id: run_id, diff -r -u --label=generated --label=on-tree ./misskey-js-generated ./misskey-js-actual > misskey-js.diff || true
});
let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => { if [ -s misskey-js.diff ]; then
return artifact.name.startsWith("api-artifact-") || artifact.name == "api-artifact" echo "changes=true" >> $GITHUB_OUTPUT
}); else
echo "changes=false" >> $GITHUB_OUTPUT
fi
await Promise.all(matchArtifacts.map(async (artifact) => { - name: Print full diff
let download = await github.rest.actions.downloadArtifact({ run: cat ./misskey-js.diff
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
await fs.promises.writeFile(`${process.env.GITHUB_WORKSPACE}/${artifact.name}.zip`, Buffer.from(download.data));
}));
- name: unzip artifacts
run: |-
find . -mindepth 1 -maxdepth 1 -type f -name '*.zip' -exec unzip {} -d . ';'
ls -la
- name: get head checksum
run: |-
checksum=$(realpath head_checksum)
cd packages/misskey-js/src
find autogen -type f -exec sh -c 'echo $(sed -E "s/^\s+\*\s+generatedAt:.+$//" {} | sha256sum | cut -d" " -f 1) {}' \; > $checksum
cd ../../..
- name: build autogen
run: |-
checksum=$(realpath ${api_json_name}_checksum)
mv $api_json_name packages/misskey-js/generator/api.json
cd packages/misskey-js/generator
pnpm run generate
cd built
find autogen -type f -exec sh -c 'echo $(sed -E "s/^\s+\*\s+generatedAt:.+$//" {} | sha256sum | cut -d" " -f 1) {}' \; > $checksum
cd ../../../..
- name: check update for type definitions
run: diff head_checksum ${api_json_name}_checksum
- name: send message - name: send message
if: failure() if: steps.check-changes.outputs.changes == 'true'
uses: thollander/actions-comment-pull-request@v2 uses: thollander/actions-comment-pull-request@v2
with: with:
comment_tag: check-misskey-js-autogen comment_tag: check-misskey-js-autogen
@ -125,7 +126,7 @@ jobs:
``` ```
- name: send message - name: send message
if: success() if: steps.check-changes.outputs.changes == 'false'
uses: thollander/actions-comment-pull-request@v2 uses: thollander/actions-comment-pull-request@v2
with: with:
comment_tag: check-misskey-js-autogen comment_tag: check-misskey-js-autogen

View File

@ -42,6 +42,7 @@
- Fix: CWのみの引用リートが詳細ページで純粋なリートとして誤って扱われてしまう問題を修正 - Fix: CWのみの引用リートが詳細ページで純粋なリートとして誤って扱われてしまう問題を修正
- Fix: ート詳細ページにおいてCW付き引用リートのCWボタンのラベルに「引用」が含まれていない問題を修正 - Fix: ート詳細ページにおいてCW付き引用リートのCWボタンのラベルに「引用」が含まれていない問題を修正
- Fix: ダイアログの入力で字数制限に違反していてもEnterキーが押せてしまう問題を修正 - Fix: ダイアログの入力で字数制限に違反していてもEnterキーが押せてしまう問題を修正
- Fix: ダイレクト投稿の宛先が保存されない問題を修正
### Server ### Server
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
@ -54,6 +55,7 @@
- Fix: リプライのみの引用リートと、CWのみの引用リートが純粋なリートとして誤って扱われてしまう問題を修正 - Fix: リプライのみの引用リートと、CWのみの引用リートが純粋なリートとして誤って扱われてしまう問題を修正
- Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように - Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606) (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606)
- Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正
## 2024.3.1 ## 2024.3.1

View File

@ -19,6 +19,6 @@
</head> </head>
<body> <body>
<redoc spec-url="/api.json" expand-responses="200" expand-single-schema-field="true"></redoc> <redoc spec-url="/api.json" expand-responses="200" expand-single-schema-field="true"></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script> <script src="https://cdn.redoc.ly/redoc/v2.1.3/bundles/redoc.standalone.js" integrity="sha256-u4DgqzYXoArvNF/Ymw3puKexfOC6lYfw0sfmeliBJ1I=" crossorigin="anonymous"></script>
</body> </body>
</html> </html>

View File

@ -214,6 +214,8 @@ export class FileServerService {
} }
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream'); reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream');
reply.header('Content-Length', file.file.size);
reply.header('Cache-Control', 'max-age=31536000, immutable');
reply.header('Content-Disposition', reply.header('Content-Disposition',
contentDisposition( contentDisposition(
'inline', 'inline',
@ -256,6 +258,7 @@ export class FileServerService {
return fs.createReadStream(file.path); return fs.createReadStream(file.path);
} else { } else {
reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.file.type) ? file.file.type : 'application/octet-stream'); reply.header('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.file.type) ? file.file.type : 'application/octet-stream');
reply.header('Content-Length', file.file.size);
reply.header('Cache-Control', 'max-age=31536000, immutable'); reply.header('Cache-Control', 'max-age=31536000, immutable');
reply.header('Content-Disposition', contentDisposition('inline', file.filename)); reply.header('Content-Disposition', contentDisposition('inline', file.filename));
@ -530,9 +533,7 @@ export class FileServerService {
if (!file.storedInternal) { if (!file.storedInternal) {
if (!(file.isLink && file.uri)) return '204'; if (!(file.isLink && file.uri)) return '204';
const result = await this.downloadAndDetectTypeFromUrl(file.uri); const result = await this.downloadAndDetectTypeFromUrl(file.uri);
if (!file.size) { file.size = (await fs.promises.stat(result.path)).size; // DB file.sizeは正確とは限らないので
file.size = (await fs.promises.stat(result.path)).size;
}
return { return {
...result, ...result,
url: file.uri, url: file.uri,

View File

@ -388,7 +388,7 @@ function addMissingMention() {
for (const x of extractMentions(ast)) { for (const x of extractMentions(ast)) {
if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) { if (!visibleUsers.value.some(u => (u.username === x.username) && (u.host === x.host))) {
misskeyApi('users/show', { username: x.username, host: x.host }).then(user => { misskeyApi('users/show', { username: x.username, host: x.host }).then(user => {
visibleUsers.value.push(user); pushVisibleUser(user);
}); });
} }
} }
@ -679,6 +679,7 @@ function saveDraft() {
localOnly: localOnly.value, localOnly: localOnly.value,
files: files.value, files: files.value,
poll: poll.value, poll: poll.value,
visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(x => x.id) : undefined,
}, },
}; };
@ -960,6 +961,15 @@ onMounted(() => {
if (draft.data.poll) { if (draft.data.poll) {
poll.value = draft.data.poll; poll.value = draft.data.poll;
} }
if (draft.data.visibleUserIds) {
misskeyApi('users/show', { userIds: draft.data.visibleUserIds }).then(users => {
for (let i = 0; i < users.length; i++) {
if (users[i].id === draft.data.visibleUserIds[i]) {
pushVisibleUser(users[i]);
}
}
});
}
} }
} }