Merge branch 'develop' of https://codeberg.org/calckey/calckey into upstream/develop
This commit is contained in:
commit
0c5c3f8e07
|
@ -13,6 +13,9 @@ node_modules
|
||||||
**/node_modules
|
**/node_modules
|
||||||
report.*.json
|
report.*.json
|
||||||
|
|
||||||
|
# Rust
|
||||||
|
packages/backend/native-utils/target/*
|
||||||
|
|
||||||
# Cypress
|
# Cypress
|
||||||
cypress/screenshots
|
cypress/screenshots
|
||||||
cypress/videos
|
cypress/videos
|
||||||
|
@ -25,9 +28,6 @@ coverage
|
||||||
!/.config/example.yml
|
!/.config/example.yml
|
||||||
!/.config/docker_example.env
|
!/.config/docker_example.env
|
||||||
|
|
||||||
#docker dev config
|
|
||||||
/dev/docker-compose.yml
|
|
||||||
|
|
||||||
# misskey
|
# misskey
|
||||||
built
|
built
|
||||||
db
|
db
|
||||||
|
@ -47,3 +47,4 @@ packages/backend/assets/instance.css
|
||||||
# dockerignore custom
|
# dockerignore custom
|
||||||
.git
|
.git
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
|
46
Dockerfile
46
Dockerfile
|
@ -1,10 +1,19 @@
|
||||||
## Install dev and compilation dependencies, build files
|
## Install dev and compilation dependencies, build files
|
||||||
FROM node:19-alpine as build
|
FROM alpine:3.18 as build
|
||||||
WORKDIR /calckey
|
WORKDIR /calckey
|
||||||
|
|
||||||
# Install compilation dependencies
|
# Install compilation dependencies
|
||||||
RUN apk update
|
RUN apk add --no-cache --no-progress git alpine-sdk python3 nodejs-current npm rust cargo vips
|
||||||
RUN apk add --no-cache --no-progress git alpine-sdk python3 rust cargo vips
|
|
||||||
|
# Copy only the cargo dependency-related files first, to cache efficiently
|
||||||
|
COPY packages/backend/native-utils/Cargo.toml packages/backend/native-utils/Cargo.toml
|
||||||
|
COPY packages/backend/native-utils/Cargo.lock packages/backend/native-utils/Cargo.lock
|
||||||
|
COPY packages/backend/native-utils/src/lib.rs packages/backend/native-utils/src/
|
||||||
|
COPY packages/backend/native-utils/migration/Cargo.toml packages/backend/native-utils/migration/Cargo.toml
|
||||||
|
COPY packages/backend/native-utils/migration/src/lib.rs packages/backend/native-utils/migration/src/
|
||||||
|
|
||||||
|
# Install cargo dependencies
|
||||||
|
RUN cargo fetch --locked --manifest-path /calckey/packages/backend/native-utils/Cargo.toml
|
||||||
|
|
||||||
# Copy only the dependency-related files first, to cache efficiently
|
# Copy only the dependency-related files first, to cache efficiently
|
||||||
COPY package.json pnpm*.yaml ./
|
COPY package.json pnpm*.yaml ./
|
||||||
|
@ -16,27 +25,31 @@ COPY packages/backend/native-utils/package.json packages/backend/native-utils/pa
|
||||||
COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json
|
COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json
|
||||||
COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json
|
COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json
|
||||||
|
|
||||||
# Configure corepack and pnpm
|
# Configure corepack and pnpm, and install dev mode dependencies for compilation
|
||||||
RUN corepack enable
|
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm i --frozen-lockfile
|
||||||
RUN corepack prepare pnpm@latest --activate
|
|
||||||
|
|
||||||
# Install dev mode dependencies for compilation
|
# Copy in the rest of the native-utils rust files
|
||||||
RUN pnpm i --frozen-lockfile
|
COPY packages/backend/native-utils/.cargo packages/backend/native-utils/.cargo
|
||||||
|
COPY packages/backend/native-utils/build.rs packages/backend/native-utils/
|
||||||
|
COPY packages/backend/native-utils/src packages/backend/native-utils/src/
|
||||||
|
COPY packages/backend/native-utils/migration/src packages/backend/native-utils/migration/src/
|
||||||
|
|
||||||
# Copy in the rest of the files, to compile from TS to JS
|
# Compile native-utils
|
||||||
|
RUN pnpm run --filter native-utils build
|
||||||
|
|
||||||
|
# Copy in the rest of the files to compile
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN pnpm run build
|
RUN env NODE_ENV=production sh -c "pnpm run --filter '!native-utils' build && pnpm run gulp"
|
||||||
|
|
||||||
# Trim down the dependencies to only the prod deps
|
# Trim down the dependencies to only those for production
|
||||||
RUN pnpm i --prod --frozen-lockfile
|
RUN pnpm i --prod --frozen-lockfile
|
||||||
|
|
||||||
|
|
||||||
## Runtime container
|
## Runtime container
|
||||||
FROM node:19-alpine
|
FROM alpine:3.18
|
||||||
WORKDIR /calckey
|
WORKDIR /calckey
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN apk add --no-cache --no-progress tini ffmpeg vips-dev zip unzip rust cargo
|
RUN apk add --no-cache --no-progress tini ffmpeg vips-dev zip unzip nodejs-current
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
|
@ -52,8 +65,9 @@ COPY --from=build /calckey/built /calckey/built
|
||||||
COPY --from=build /calckey/packages/backend/built /calckey/packages/backend/built
|
COPY --from=build /calckey/packages/backend/built /calckey/packages/backend/built
|
||||||
COPY --from=build /calckey/packages/backend/assets/instance.css /calckey/packages/backend/assets/instance.css
|
COPY --from=build /calckey/packages/backend/assets/instance.css /calckey/packages/backend/assets/instance.css
|
||||||
COPY --from=build /calckey/packages/backend/native-utils/built /calckey/packages/backend/native-utils/built
|
COPY --from=build /calckey/packages/backend/native-utils/built /calckey/packages/backend/native-utils/built
|
||||||
COPY --from=build /calckey/packages/backend/native-utils/target /calckey/packages/backend/native-utils/target
|
|
||||||
|
|
||||||
RUN corepack enable
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
VOLUME "/calckey/files"
|
||||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
ENTRYPOINT [ "/sbin/tini", "--" ]
|
||||||
CMD [ "pnpm", "run", "migrateandstart" ]
|
CMD [ "pnpm", "run", "migrateandstart" ]
|
||||||
|
|
|
@ -19,8 +19,6 @@ services:
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
volumes:
|
volumes:
|
||||||
- ./.cargo-cache:/root/.cargo
|
|
||||||
- ./.cargo-target:/calckey/packages/backend/native-utils/target
|
|
||||||
- ./files:/calckey/files
|
- ./files:/calckey/files
|
||||||
- ./.config:/calckey/.config:ro
|
- ./.config:/calckey/.config:ro
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,14 @@ path = "src/lib.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
convert = ["dep:native-utils"]
|
convert = ["dep:native-utils", "dep:indicatif", "dep:futures"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1.0.96"
|
serde_json = "1.0.96"
|
||||||
native-utils = { path = "../", optional = true }
|
native-utils = { path = "../", optional = true }
|
||||||
indicatif = { version = "0.17.4", features = ["tokio"] }
|
indicatif = { version = "0.17.4", features = ["tokio"], optional = true }
|
||||||
tokio = { version = "1.28.2", features = ["full"] }
|
tokio = { version = "1.28.2", features = ["full"] }
|
||||||
futures = "0.3.28"
|
futures = { version = "0.3.28", optional = true }
|
||||||
serde_yaml = "0.9.21"
|
serde_yaml = "0.9.21"
|
||||||
serde = { version = "1.0.163", features = ["derive"] }
|
serde = { version = "1.0.163", features = ["derive"] }
|
||||||
urlencoding = "2.1.2"
|
urlencoding = "2.1.2"
|
||||||
|
|
|
@ -34,10 +34,12 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"artifacts": "napi artifacts",
|
"artifacts": "napi artifacts",
|
||||||
"build": "napi build --features napi --platform --release ./built/",
|
"build": "pnpm run build:napi && pnpm run build:migration",
|
||||||
"build:debug": "napi build --platform",
|
"build:napi": "napi build --features napi --platform --release ./built/",
|
||||||
|
"build:migration": "cargo build --locked --release --manifest-path ./migration/Cargo.toml && cp -v ./target/release/migration ./built/migration",
|
||||||
|
"build:debug": "napi build --platform ./built/ && cargo build --manifest-path ./migration/Cargo.toml",
|
||||||
"prepublishOnly": "napi prepublish -t npm",
|
"prepublishOnly": "napi prepublish -t npm",
|
||||||
"test": "pnpm run cargo:test && pnpm run build && ava",
|
"test": "pnpm run cargo:test && pnpm run build:napi && ava",
|
||||||
"universal": "napi universal",
|
"universal": "napi universal",
|
||||||
"version": "napi version",
|
"version": "napi version",
|
||||||
"format": "cargo fmt --all",
|
"format": "cargo fmt --all",
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
"start:test": "NODE_ENV=test pnpm node ./built/index.js",
|
"start:test": "NODE_ENV=test pnpm node ./built/index.js",
|
||||||
"migrate": "pnpm run migrate:typeorm && pnpm run migrate:cargo",
|
"migrate": "pnpm run migrate:typeorm && pnpm run migrate:cargo",
|
||||||
"migrate:typeorm": "typeorm migration:run -d ormconfig.js",
|
"migrate:typeorm": "typeorm migration:run -d ormconfig.js",
|
||||||
"migrate:cargo": "cargo run --manifest-path ./native-utils/migration/Cargo.toml -- up",
|
"migrate:cargo": "./native-utils/built/migration up",
|
||||||
"revertmigration": "pnpm run revertmigration:cargo && pnpm run revertmigration:typeorm",
|
"revertmigration": "pnpm run revertmigration:cargo && pnpm run revertmigration:typeorm",
|
||||||
"revertmigration:typeorm": "typeorm migration:revert -d ormconfig.js",
|
"revertmigration:typeorm": "typeorm migration:revert -d ormconfig.js",
|
||||||
"revertmigration:cargo": "cargo run --manifest-path ./native-utils/migration/Cargo.toml -- down",
|
"revertmigration:cargo": "./native-utils/built/migration down",
|
||||||
"check:connect": "node ./check_connect.js",
|
"check:connect": "node ./check_connect.js",
|
||||||
"build": "pnpm swc src -d built -D",
|
"build": "pnpm swc src -d built -D",
|
||||||
"watch": "pnpm swc src -d built -D -w",
|
"watch": "pnpm swc src -d built -D -w",
|
||||||
|
@ -20,9 +20,6 @@
|
||||||
"test": "pnpm run mocha",
|
"test": "pnpm run mocha",
|
||||||
"format": "pnpm rome format * --write"
|
"format": "pnpm rome format * --write"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
|
||||||
"chokidar": "^3.3.1"
|
|
||||||
},
|
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@swc/core-android-arm64": "1.3.11",
|
"@swc/core-android-arm64": "1.3.11",
|
||||||
"@tensorflow/tfjs-node": "3.21.1"
|
"@tensorflow/tfjs-node": "3.21.1"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
export function isDuplicateKeyValueError(e: unknown | Error): boolean {
|
export function isDuplicateKeyValueError(e: unknown | Error): boolean {
|
||||||
return (e as Error).message?.startsWith("duplicate key value");
|
const nodeError = e as NodeJS.ErrnoException;
|
||||||
|
return nodeError.code === "23505";
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,11 @@ export async function createImage(
|
||||||
const image = (await new Resolver().resolve(value)) as any;
|
const image = (await new Resolver().resolve(value)) as any;
|
||||||
|
|
||||||
if (image.url == null) {
|
if (image.url == null) {
|
||||||
throw new Error("invalid image: url not privided");
|
throw new Error("Invalid image, URL not provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!image.url.startsWith("https://") && !image.url.startsWith("http://")) {
|
if (!image.url.startsWith("https://") && !image.url.startsWith("http://")) {
|
||||||
throw new Error("invalid image: unexpected shcema of url: " + image.url);
|
throw new Error(`Invalid image, unexpected schema: ${image.url}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(`Creating the Image: ${image.url}`);
|
logger.info(`Creating the Image: ${image.url}`);
|
||||||
|
|
|
@ -182,7 +182,7 @@ export function genOpenapiSpec() {
|
||||||
...(endpoint.meta.limit
|
...(endpoint.meta.limit
|
||||||
? {
|
? {
|
||||||
"429": {
|
"429": {
|
||||||
description: "To many requests",
|
description: "Too many requests",
|
||||||
content: {
|
content: {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
schema: {
|
schema: {
|
||||||
|
|
|
@ -16,11 +16,12 @@
|
||||||
:note="appearNote.reply"
|
:note="appearNote.reply"
|
||||||
class="reply-to"
|
class="reply-to"
|
||||||
/>
|
/>
|
||||||
<div v-if="!detailedView"
|
<div
|
||||||
|
v-if="!detailedView"
|
||||||
class="note-context"
|
class="note-context"
|
||||||
@click="noteClick"
|
@click="noteClick"
|
||||||
:class="{
|
:class="{
|
||||||
collapsedReply: collapsedReply && appearNote.reply
|
collapsedReply: collapsedReply && appearNote.reply,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
|
@ -71,7 +72,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-if="collapsedReply && appearNote.reply" class="info">
|
<div v-if="collapsedReply && appearNote.reply" class="info">
|
||||||
<MkAvatar class="avatar" :user="appearNote.reply.user" />
|
<MkAvatar class="avatar" :user="appearNote.reply.user" />
|
||||||
<MkUserName class="username" :user="appearNote.reply.user"></MkUserName>
|
<MkUserName
|
||||||
|
class="username"
|
||||||
|
:user="appearNote.reply.user"
|
||||||
|
></MkUserName>
|
||||||
<Mfm
|
<Mfm
|
||||||
class="summary"
|
class="summary"
|
||||||
:text="getNoteSummary(appearNote.reply)"
|
:text="getNoteSummary(appearNote.reply)"
|
||||||
|
@ -92,10 +96,7 @@
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="header-container">
|
<div class="header-container">
|
||||||
<MkAvatar class="avatar" :user="appearNote.user" />
|
<MkAvatar class="avatar" :user="appearNote.user" />
|
||||||
<XNoteHeader
|
<XNoteHeader class="header" :note="appearNote" />
|
||||||
class="header"
|
|
||||||
:note="appearNote"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<MkSubNoteContent
|
<MkSubNoteContent
|
||||||
|
@ -747,14 +748,14 @@ defineExpose({
|
||||||
}
|
}
|
||||||
.info {
|
.info {
|
||||||
color: var(--fgTransparentWeak);
|
color: var(--fgTransparentWeak);
|
||||||
transition: color .2s;
|
transition: color 0.2s;
|
||||||
}
|
}
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 1.2em;
|
width: 1.2em;
|
||||||
height: 1.2em;
|
height: 1.2em;
|
||||||
border-radius: 2em;
|
border-radius: 2em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-right: .4em;
|
margin-right: 0.4em;
|
||||||
background: var(--panelHighlight);
|
background: var(--panelHighlight);
|
||||||
}
|
}
|
||||||
.username {
|
.username {
|
||||||
|
@ -765,7 +766,8 @@ defineExpose({
|
||||||
content: ": ";
|
content: ": ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:hover, &:focus-within {
|
&:hover,
|
||||||
|
&:focus-within {
|
||||||
.info {
|
.info {
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,11 @@
|
||||||
"
|
"
|
||||||
:key="notification.id"
|
:key="notification.id"
|
||||||
:note="notification.note"
|
:note="notification.note"
|
||||||
:collapsedReply="true"
|
:collapsedReply="
|
||||||
|
notification.type === 'reply' ||
|
||||||
|
(notification.type === 'mention' &&
|
||||||
|
notification.note.replyId != null)
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<XNotification
|
<XNotification
|
||||||
v-else
|
v-else
|
||||||
|
|
|
@ -1,26 +1,30 @@
|
||||||
const fs = require('fs');
|
const fs = require('node:fs');
|
||||||
const execa = require('execa');
|
const execa = require('execa');
|
||||||
|
const { join } = require('node:path');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
fs.rmSync(__dirname + '/../packages/backend/built', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/backend/built'), { recursive: true, force: true });
|
||||||
fs.rmSync(__dirname + '/../packages/backend/node_modules', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/backend/node_modules'), { recursive: true, force: true });
|
||||||
|
|
||||||
fs.rmSync(__dirname + '/../packages/client/built', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/built'), { recursive: true, force: true });
|
||||||
fs.rmSync(__dirname + '/../packages/client/node_modules', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/node_modules'), { recursive: true, force: true });
|
||||||
|
|
||||||
fs.rmSync(__dirname + '/../packages/sw/built', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/client/built'), { recursive: true, force: true });
|
||||||
fs.rmSync(__dirname + '/../packages/sw/node_modules', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/client/node_modules'), { recursive: true, force: true });
|
||||||
|
|
||||||
fs.rmSync(__dirname + '/../built', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/sw/built'), { recursive: true, force: true });
|
||||||
fs.rmSync(__dirname + '/../node_modules', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/sw/node_modules'), { recursive: true, force: true });
|
||||||
|
|
||||||
|
fs.rmSync(join(__dirname, '/../built'), { recursive: true, force: true });
|
||||||
|
fs.rmSync(join(__dirname, '/../node_modules'), { recursive: true, force: true });
|
||||||
|
|
||||||
execa('pnpm', ['store', 'prune'], {
|
execa('pnpm', ['store', 'prune'], {
|
||||||
cwd: __dirname + '/../',
|
cwd: join(__dirname, '/../'),
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
});
|
});
|
||||||
|
|
||||||
execa('cargo', ['clean'], {
|
execa('cargo', ['clean'], {
|
||||||
cwd: __dirname + '/../packages/backend/native-utils',
|
cwd: join(__dirname, '/../packages/backend/native-utils'),
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
const fs = require('fs');
|
const fs = require('node:fs');
|
||||||
|
const { join } = require('node:path');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
fs.rmSync(__dirname + '/../packages/backend/built', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/backend/built'), { recursive: true, force: true });
|
||||||
fs.rmSync(__dirname + '/../packages/client/built', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/backend/native-utils/built'), { recursive: true, force: true });
|
||||||
fs.rmSync(__dirname + '/../packages/sw/built', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/client/built'), { recursive: true, force: true });
|
||||||
fs.rmSync(__dirname + '/../built', { recursive: true, force: true });
|
fs.rmSync(join(__dirname, '/../packages/sw/built'), { recursive: true, force: true });
|
||||||
|
fs.rmSync(join(__dirname, '/../built'), { recursive: true, force: true });
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue