Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/misskey-dev/misskey into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
tamaina committed Feb 14, 2023
2 parents 57c94a5 + c1f1e0e commit d0aba46
Show file tree
Hide file tree
Showing 31 changed files with 329 additions and 544 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "Misskey",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"workspaceFolder": "/workspace",
"features": {
"ghcr.io/devcontainers-contrib/features/pnpm:2": {}
},
"forwardPorts": [3000],
"postCreateCommand": ".devcontainer/init.sh"
"postCreateCommand": "sudo chmod 755 .devcontainer/init.sh && .devcontainer/init.sh"
}
7 changes: 4 additions & 3 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
dockerfile: Dockerfile

volumes:
- ../..:/workspaces:cached
- ../:/workspace:cached

command: sleep infinity

Expand All @@ -21,7 +21,7 @@ services:
networks:
- internal_network
volumes:
- ../redis:/data
- redis-data:/data
healthcheck:
test: "redis-cli ping"
interval: 5s
Expand All @@ -37,14 +37,15 @@ services:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: misskey
volumes:
- ../db:/var/lib/postgresql/data
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"
interval: 5s
retries: 20

volumes:
postgres-data:
redis-data:

networks:
internal_network:
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -xe

sudo chown -R node /workspace
git submodule update --init
pnpm install --frozen-lockfile
cp .devcontainer/devcontainer.yml .config/default.yml
Expand Down
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ indent_style = tab
indent_size = 2
charset = utf-8
insert_final_newline = true
end_of_line = lf

[*.yml]
indent_style = space
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.glb -diff -text
*.blend -diff -text
*.afdesign -diff -text
* text=auto eol=lf
36 changes: 18 additions & 18 deletions .github/workflows/check_copyright_year.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Check copyright year

on:
push:
branches:
- master
- develop

jobs:
check_copyright_year:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- run: |
if [ "$(grep Copyright COPYING | sed -e 's/.*2014-\([0-9]*\) .*/\1/g')" -ne "$(date +%Y)" ]; then
echo "Please change copyright year!"
exit 1
fi
name: Check copyright year

on:
push:
branches:
- master
- develop

jobs:
check_copyright_year:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- run: |
if [ "$(grep Copyright COPYING | sed -e 's/.*2014-\([0-9]*\) .*/\1/g')" -ne "$(date +%Y)" ]; then
echo "Please change copyright year!"
exit 1
fi
108 changes: 54 additions & 54 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
name: Lint

on:
push:
branches:
- master
- develop
pull_request:

jobs:
pnpm_install:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
submodules: true
- uses: pnpm/action-setup@v2
with:
version: 7
run_install: false
- uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile

lint:
needs: [pnpm_install]
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
workspace:
- backend
- frontend
- sw
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
submodules: true
- uses: pnpm/action-setup@v2
with:
version: 7
run_install: false
- uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- run: pnpm --filter ${{ matrix.workspace }} run lint
name: Lint

on:
push:
branches:
- master
- develop
pull_request:

jobs:
pnpm_install:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
submodules: true
- uses: pnpm/action-setup@v2
with:
version: 7
run_install: false
- uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile

lint:
needs: [pnpm_install]
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
workspace:
- backend
- frontend
- sw
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
submodules: true
- uses: pnpm/action-setup@v2
with:
version: 7
run_install: false
- uses: actions/[email protected]
with:
node-version: 18.x
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- run: pnpm --filter ${{ matrix.workspace }} run lint
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
You should also include the user name that made the change.
-->
## 13.x.x (unreleased)

### Improvements
- Server: URLプレビュー(summaly)はプロキシを通すように

### Bugfixes
-

## 13.6.1 (2023/02/12)

### Improvements
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ command.

### Dev Container
Instead of running `pnpm` locally, you can use Dev Container to set up your development environment.
To use Dev Container, open the project directory on VSCode with Dev Containers installed.
To use Dev Container, open the project directory on VSCode with Dev Containers installed.
**Note:** If you are using Windows, please clone the repository with WSL. Using Git for Windows will result in broken files due to the difference in how newlines are handled.

It will run the following command automatically inside the container.
``` bash
Expand Down
1 change: 1 addition & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v2
name: misskey
version: 0.0.0
description: This chart is created for the purpose of previewing Pull Requests. Do not use this for production use.
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"speakeasy": "2.0.0",
"strict-event-emitter-types": "2.0.0",
"stringz": "2.1.0",
"summaly": "2.7.0",
"summaly": "github:misskey-dev/summaly",
"systeminformation": "5.17.8",
"tinycolor2": "1.6.0",
"tmp": "0.2.1",
Expand Down
144 changes: 72 additions & 72 deletions packages/backend/src/server/api/endpoints/clips/remove-note.ts
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { ClipNotesRepository, ClipsRepository } from '@/models/index.js';
import { DI } from '@/di-symbols.js';
import { ApiError } from '../../error.js';
import { GetterService } from '@/server/api/GetterService.js';

export const meta = {
tags: ['account', 'notes', 'clips'],

requireCredential: true,

kind: 'write:account',

errors: {
noSuchClip: {
message: 'No such clip.',
code: 'NO_SUCH_CLIP',
id: 'b80525c6-97f7-49d7-a42d-ebccd49cfd52',
},

noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: 'aff017de-190e-434b-893e-33a9ff5049d8',
},
},
} as const;

export const paramDef = {
type: 'object',
properties: {
clipId: { type: 'string', format: 'misskey:id' },
noteId: { type: 'string', format: 'misskey:id' },
},
required: ['clipId', 'noteId'],
} as const;

// eslint-disable-next-line import/no-default-export
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
@Inject(DI.clipsRepository)
private clipsRepository: ClipsRepository,

@Inject(DI.clipNotesRepository)
private clipNotesRepository: ClipNotesRepository,

private getterService: GetterService,
) {
super(meta, paramDef, async (ps, me) => {
const clip = await this.clipsRepository.findOneBy({
id: ps.clipId,
userId: me.id,
});

if (clip == null) {
throw new ApiError(meta.errors.noSuchClip);
}

const note = await this.getterService.getNote(ps.noteId).catch(err => {
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
throw err;
});

await this.clipNotesRepository.delete({
noteId: note.id,
clipId: clip.id,
});
});
}
}
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { ClipNotesRepository, ClipsRepository } from '@/models/index.js';
import { DI } from '@/di-symbols.js';
import { ApiError } from '../../error.js';
import { GetterService } from '@/server/api/GetterService.js';

export const meta = {
tags: ['account', 'notes', 'clips'],

requireCredential: true,

kind: 'write:account',

errors: {
noSuchClip: {
message: 'No such clip.',
code: 'NO_SUCH_CLIP',
id: 'b80525c6-97f7-49d7-a42d-ebccd49cfd52',
},

noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: 'aff017de-190e-434b-893e-33a9ff5049d8',
},
},
} as const;

export const paramDef = {
type: 'object',
properties: {
clipId: { type: 'string', format: 'misskey:id' },
noteId: { type: 'string', format: 'misskey:id' },
},
required: ['clipId', 'noteId'],
} as const;

// eslint-disable-next-line import/no-default-export
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
@Inject(DI.clipsRepository)
private clipsRepository: ClipsRepository,

@Inject(DI.clipNotesRepository)
private clipNotesRepository: ClipNotesRepository,

private getterService: GetterService,
) {
super(meta, paramDef, async (ps, me) => {
const clip = await this.clipsRepository.findOneBy({
id: ps.clipId,
userId: me.id,
});

if (clip == null) {
throw new ApiError(meta.errors.noSuchClip);
}

const note = await this.getterService.getNote(ps.noteId).catch(err => {
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
throw err;
});

await this.clipNotesRepository.delete({
noteId: note.id,
clipId: clip.id,
});
});
}
}
Loading

0 comments on commit d0aba46

Please sign in to comment.