Skip to content

Commit

Permalink
Merge remote-branch 'misskey/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Feb 2, 2024
2 parents c927d64 + c38f5ee commit a78c37a
Show file tree
Hide file tree
Showing 38 changed files with 258 additions and 214 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/check-misskey-js-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check CherryPick JS version

on:
push:
branches: [ develop ]
paths:
- packages/cherrypick-js/package.json
- package.json
pull_request:
branches: [ develop ]
paths:
- packages/cherrypick-js/package.json
- package.json

jobs:
check-version:
# ルートの package.json と packages/cherrypick-js/package.json のバージョンが一致しているかを確認する
name: Check version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Check version
run: |
if [ "$(jq -r '.version' package.json)" != "$(jq -r '.version' packages/cherrypick-js/package.json)" ]; then
echo "Version mismatch!"
exit 1
fi
67 changes: 12 additions & 55 deletions .github/workflows/deploy-test-environment.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,23 @@
name: Deploy test environment
name: deploy-test-environment

on:
push:
#push:
workflow_dispatch:
inputs:
repository:
description: 'Repository to deploy (optional)'
type: string
required: false
branch:
description: 'Branch to deploy (optional)'
branch_or_hash:
description: 'Branch or Commit hash to deploy (optional)'
type: string
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
uses: joinmisskey/misskey-tga/.github/workflows/deploy-test-environment.yml@main
with:
repository: ${{ github.event.inputs.repository }}
branch_or_hash: ${{ github.event.inputs.branch_or_hash }}
secrets:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
2 changes: 1 addition & 1 deletion .github/workflows/ok-to-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
private_key: ${{ secrets.DEPLOYBOT_PRIVATE_KEY }}

- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v3
uses: peter-evans/slash-command-dispatch@v4
env:
TOKEN: ${{ steps.generate_token.outputs.token }}
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Test
run: pnpm --filter backend test-and-coverage
- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/backend/coverage/coverage-final.json
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
- name: Test
run: pnpm --filter backend test-and-coverage:e2e
- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/backend/coverage/coverage-final.json
16 changes: 1 addition & 15 deletions .github/workflows/test-cherrypick-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,7 @@ jobs:
CI: true

- name: Upload Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/cherrypick-js/coverage/coverage-final.json

check-version:
# ルートの package.json と packages/cherrypick-js/package.json のバージョンが一致しているかを確認する
name: Check version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Check version
run: |
if [ "$(jq -r '.version' package.json)" != "$(jq -r '.version' packages/cherrypick-js/package.json)" ]; then
echo "Version mismatch!"
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/test-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Test
run: pnpm --filter frontend test-and-coverage
- name: Upload Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/frontend/coverage/coverage-final.json
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
- Feat: [mCaptcha](https://github.com/mCaptcha/mCaptcha)のサポートを追加
- Fix: リストライムラインの「リノートを表示」が正しく機能しない問題を修正
- Feat: Add support for TrueMail
- Fix: リモートユーザーのリアクション一覧がすべて見えてしまうのを修正
* すべてのリモートユーザーのリアクション一覧を見えないようにします
- Enhance: モデレーターはすべてのユーザーのリアクション一覧を見られるように

### Client
- Feat: 新しいゲームを追加
Expand Down Expand Up @@ -58,6 +61,7 @@
- Fix: プラグインで`Plugin:register_note_post_interruptor`を使用すると、ノートが投稿できなくなる問題を修正
- Enhance: ページ遷移時にPlayerを閉じるように
- Fix: iOSで大きな画像を変換してアップロードできない問題を修正
- Fix: 「アニメーション画像を再生しない」もしくは「データセーバー(アイコン)」を有効にしていても、アイコンデコレーションのアニメーションが停止されない問題を修正

### Server
- Enhance: 連合先のレートリミットに引っかかった際にリトライするようになりました
Expand All @@ -71,6 +75,7 @@
- Fix: ipv4とipv6の両方が利用可能な環境でallowedPrivateNetworksが設定されていた場合プライベートipの検証ができていなかった問題を修正
- Fix: properly handle cc followers
- Fix: ジョブに関する設定の名前を修正 relashionshipJobPerSec -> relationshipJobPerSec
- Fix: コントロールパネル->モデレーション->「誰でも新規登録できるようにする」の初期値をONからOFFに変更 #13122

### Service Worker
- Enhance: オフライン表示のデザインを改善・多言語対応
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/generate_api_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js'
import { writeFileSync } from "node:fs";

const config = loadConfig();
const spec = genOpenapiSpec(config);
const spec = genOpenapiSpec(config, true);

writeFileSync('./built/api.json', JSON.stringify(spec), 'utf-8');
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey, cherrypick contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class FixMetaDisableRegistration1706791962000 {
name = 'FixMetaDisableRegistration1706791962000'

async up(queryRunner) {
await queryRunner.query(`alter table meta alter column "disableRegistration" set default true;`);
}

async down(queryRunner) {
await queryRunner.query(`alter table meta alter column "disableRegistration" set default false;`);
}
}
2 changes: 1 addition & 1 deletion packages/backend/src/core/entities/UserEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ export class UserEntityService implements OnModuleInit {
}),
pinnedPageId: profile!.pinnedPageId,
pinnedPage: profile!.pinnedPageId ? this.pageEntityService.pack(profile!.pinnedPageId, me) : null,
publicReactions: profile!.publicReactions,
publicReactions: this.isLocalUser(user) ? profile!.publicReactions : false, // https://github.com/misskey-dev/misskey/issues/12964
followersVisibility: profile!.followersVisibility,
followingVisibility: profile!.followingVisibility,
twoFactorEnabled: profile!.twoFactorEnabled,
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/misc/json-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export interface Schema extends OfSchema {
readonly example?: any;
readonly format?: string;
readonly ref?: keyof typeof refs;
readonly selfRef?: boolean;
readonly enum?: ReadonlyArray<string | null>;
readonly default?: (this['type'] extends TypeStringef ? StringDefToType<this['type']> : any) | null;
readonly maxLength?: number;
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/models/json-schema/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const sectionBlockSchema = {
type: 'object',
optional: false, nullable: false,
ref: 'PageBlock',
selfRef: true,
},
},
},
Expand Down
26 changes: 22 additions & 4 deletions packages/backend/src/server/api/endpoints/users/reactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { QueryService } from '@/core/QueryService.js';
import { NoteReactionEntityService } from '@/core/entities/NoteReactionEntityService.js';
import { DI } from '@/di-symbols.js';
import { MiNoteReaction } from '@/models/_.js';
import { CacheService } from '@/core/CacheService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { RoleService } from '@/core/RoleService.js';
import { ApiError } from '../../error.js';

export const meta = {
Expand All @@ -35,6 +38,11 @@ export const meta = {
code: 'REACTIONS_NOT_PUBLIC',
id: '673a7dd2-6924-1093-e0c0-e68456ceae5c',
},
isRemoteUser: {
message: 'Currently unavailable to display reactions of remote users. See https://github.com/misskey-dev/misskey/issues/12964',
code: 'IS_REMOTE_USER',
id: '6b95fa98-8cf9-2350-e284-f0ffdb54a805',
},
},
} as const;

Expand Down Expand Up @@ -63,14 +71,24 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
@Inject(DI.noteReactionsRepository)
private noteReactionsRepository: NoteReactionsRepository,

private cacheService: CacheService,
private userEntityService: UserEntityService,
private noteReactionEntityService: NoteReactionEntityService,
private queryService: QueryService,
private roleService: RoleService,
) {
super(meta, paramDef, async (ps, me) => {
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: ps.userId });

if ((me == null || me.id !== ps.userId) && !profile.publicReactions) {
throw new ApiError(meta.errors.reactionsNotPublic);
const iAmModerator = me ? await this.roleService.isModerator(me) : false; // Moderators can see reactions of all users
if (!iAmModerator) {
const user = await this.cacheService.findUserById(ps.userId);
if (this.userEntityService.isRemoteUser(user)) {
throw new ApiError(meta.errors.isRemoteUser);
}

const profile = await this.userProfilesRepository.findOneByOrFail({ userId: ps.userId });
if ((me == null || me.id !== ps.userId) && !profile.publicReactions) {
throw new ApiError(meta.errors.reactionsNotPublic);
}
}

const query = this.notesRepository.createQueryBuilder('note')
Expand Down
10 changes: 5 additions & 5 deletions packages/backend/src/server/api/openapi/gen-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import type { Config } from '@/config.js';
import endpoints, { IEndpoint } from '../endpoints.js';
import { errors as basicErrors } from './errors.js';
import { schemas, convertSchemaToOpenApiSchema } from './schemas.js';
import { getSchemas, convertSchemaToOpenApiSchema } from './schemas.js';

export function genOpenapiSpec(config: Config) {
export function genOpenapiSpec(config: Config, includeSelfRef = false) {
const spec = {
openapi: '3.1.0',

Expand All @@ -31,7 +31,7 @@ export function genOpenapiSpec(config: Config) {
paths: {} as any,

components: {
schemas: schemas,
schemas: getSchemas(includeSelfRef),

securitySchemes: {
bearerAuth: {
Expand All @@ -57,7 +57,7 @@ export function genOpenapiSpec(config: Config) {
}
}

const resSchema = endpoint.meta.res ? convertSchemaToOpenApiSchema(endpoint.meta.res, 'res') : {};
const resSchema = endpoint.meta.res ? convertSchemaToOpenApiSchema(endpoint.meta.res, 'res', includeSelfRef) : {};

let desc = (endpoint.meta.description ? endpoint.meta.description : 'No description provided.') + '\n\n';

Expand All @@ -72,7 +72,7 @@ export function genOpenapiSpec(config: Config) {
}

const requestType = endpoint.meta.requireFile ? 'multipart/form-data' : 'application/json';
const schema = { ...convertSchemaToOpenApiSchema(endpoint.params, 'param') };
const schema = { ...convertSchemaToOpenApiSchema(endpoint.params, 'param', false) };

if (endpoint.meta.requireFile) {
schema.properties = {
Expand Down
Loading

0 comments on commit a78c37a

Please sign in to comment.