Merge branch 'develop' of https://github.com/kokonect-link/cherrypick into develop

This commit is contained in:
NoriDev 2023-09-22 11:42:10 +09:00
commit 59ad05a702
10 changed files with 99 additions and 89 deletions

View file

@ -56,17 +56,17 @@ dbReplications: false
# You can configure any number of replicas here # You can configure any number of replicas here
#dbSlaves: #dbSlaves:
# - # -
# host: # host: localhost
# port: # port: 5433
# db: # db: cherrypick
# user: # user: example-cherrypick-user
# pass: # pass: example-cherrypick-pass
# - # -
# host: # host: localhost
# port: # port: 5434
# db: # db: cherrypick
# user: # user: example-cherrypick-user
# pass: # pass: example-cherrypick-pass
# ┌─────────────────────┐ # ┌─────────────────────┐
#───┘ Redis configuration └───────────────────────────────────── #───┘ Redis configuration └─────────────────────────────────────
@ -154,6 +154,9 @@ id: 'aidx'
# saKeyPath: /path/to/service-account-key.json # saKeyPath: /path/to/service-account-key.json
# logName: cherrypick # logName: cherrypick
# Override the file URL rendering in ActivityPub (Object Storage file only)
#apFileBaseUrl: https://example.tld/
# Proxy for HTTP/HTTPS # Proxy for HTTP/HTTPS
#proxy: http://127.0.0.1:3128 #proxy: http://127.0.0.1:3128

View file

@ -60,17 +60,17 @@ dbReplications: false
# You can configure any number of replicas here # You can configure any number of replicas here
#dbSlaves: #dbSlaves:
# - # -
# host: # host: localhost
# port: # port: 5433
# db: # db: cherrypick
# user: # user: example-cherrypick-user
# pass: # pass: example-cherrypick-pass
# - # -
# host: # host: localhost
# port: # port: 5434
# db: # db: cherrypick
# user: # user: example-cherrypick-user
# pass: # pass: example-cherrypick-pass
# ┌─────────────────────┐ # ┌─────────────────────┐
#───┘ Redis configuration └───────────────────────────────────── #───┘ Redis configuration └─────────────────────────────────────
@ -172,6 +172,9 @@ id: 'aidx'
# saKeyPath: /path/to/service-account-key.json # saKeyPath: /path/to/service-account-key.json
# logName: cherrypick # logName: cherrypick
# Override the file URL rendering in ActivityPub (Object Storage file only)
#apFileBaseUrl: https://example.tld/
# Proxy for HTTP/HTTPS # Proxy for HTTP/HTTPS
#proxy: http://127.0.0.1:3128 #proxy: http://127.0.0.1:3128

View file

@ -56,17 +56,17 @@ dbReplications: false
# You can configure any number of replicas here # You can configure any number of replicas here
#dbSlaves: #dbSlaves:
# - # -
# host: # host: localhost
# port: # port: 5433
# db: # db: cherrypick
# user: # user: example-cherrypick-user
# pass: # pass: example-cherrypick-pass
# - # -
# host: # host: localhost
# port: # port: 5434
# db: # db: cherrypick
# user: # user: example-cherrypick-user
# pass: # pass: example-cherrypick-pass
# ┌─────────────────────┐ # ┌─────────────────────┐
#───┘ Redis configuration └───────────────────────────────────── #───┘ Redis configuration └─────────────────────────────────────
@ -154,6 +154,9 @@ id: 'aidx'
# saKeyPath: /path/to/service-account-key.json # saKeyPath: /path/to/service-account-key.json
# logName: cherrypick # logName: cherrypick
# Override the file URL rendering in ActivityPub (Object Storage file only)
#apFileBaseUrl: https://example.tld/
# Proxy for HTTP/HTTPS # Proxy for HTTP/HTTPS
#proxy: http://127.0.0.1:3128 #proxy: http://127.0.0.1:3128

View file

@ -77,17 +77,17 @@ dbReplications: false
# You can configure any number of replicas here # You can configure any number of replicas here
#dbSlaves: #dbSlaves:
# - # -
# host: # host: localhost
# port: # port: 5433
# db: # db: cherrypick
# user: # user: example-cherrypick-user
# pass: # pass: example-cherrypick-pass
# - # -
# host: # host: localhost
# port: # port: 5434
# db: # db: cherrypick
# user: # user: example-cherrypick-user
# pass: # pass: example-cherrypick-pass
# ┌─────────────────────┐ # ┌─────────────────────┐
#───┘ Redis configuration └───────────────────────────────────── #───┘ Redis configuration └─────────────────────────────────────
@ -174,6 +174,9 @@ id: "aidx"
# saKeyPath: /path/to/service-account-key.json # saKeyPath: /path/to/service-account-key.json
# logName: cherrypick # logName: cherrypick
# Override the file URL rendering in ActivityPub (Object Storage file only)
#apFileBaseUrl: https://example.tld/
# Proxy for HTTP/HTTPS # Proxy for HTTP/HTTPS
#proxy: http://127.0.0.1:3128 #proxy: http://127.0.0.1:3128

View file

@ -86,6 +86,8 @@ type Source = {
logName?: string; logName?: string;
} }
apFileBaseUrl?: string;
mediaProxy?: string; mediaProxy?: string;
proxyRemoteFiles?: boolean; proxyRemoteFiles?: boolean;
videoThumbnailGenerator?: string; videoThumbnailGenerator?: string;
@ -145,6 +147,7 @@ export type Config = {
relashionshipJobPerSec: number | undefined; relashionshipJobPerSec: number | undefined;
deliverJobMaxAttempts: number | undefined; deliverJobMaxAttempts: number | undefined;
inboxJobMaxAttempts: number | undefined; inboxJobMaxAttempts: number | undefined;
apFileBaseUrl: string | undefined;
proxyRemoteFiles: boolean | undefined; proxyRemoteFiles: boolean | undefined;
signToActivityPubGet: boolean | undefined; signToActivityPubGet: boolean | undefined;
@ -250,6 +253,7 @@ export function loadConfig(): Config {
inboxJobMaxAttempts: config.inboxJobMaxAttempts, inboxJobMaxAttempts: config.inboxJobMaxAttempts,
proxyRemoteFiles: config.proxyRemoteFiles, proxyRemoteFiles: config.proxyRemoteFiles,
signToActivityPubGet: config.signToActivityPubGet, signToActivityPubGet: config.signToActivityPubGet,
apFileBaseUrl: config.apFileBaseUrl,
mediaProxy: externalMediaProxy ?? internalMediaProxy, mediaProxy: externalMediaProxy ?? internalMediaProxy,
externalMediaProxyEnabled: externalMediaProxy !== null && externalMediaProxy !== internalMediaProxy, externalMediaProxyEnabled: externalMediaProxy !== null && externalMediaProxy !== internalMediaProxy,
videoThumbnailGenerator: config.videoThumbnailGenerator ? videoThumbnailGenerator: config.videoThumbnailGenerator ?

View file

@ -166,7 +166,7 @@ export class ApRendererService {
return { return {
type: 'Document', type: 'Document',
mediaType: file.webpublicType ?? file.type, mediaType: file.webpublicType ?? file.type,
url: this.driveFileEntityService.getPublicUrl(file), url: this.driveFileEntityService.getPublicUrl(file, undefined, true),
name: file.comment, name: file.comment,
}; };
} }
@ -245,7 +245,7 @@ export class ApRendererService {
public renderImage(file: MiDriveFile): IApImage { public renderImage(file: MiDriveFile): IApImage {
return { return {
type: 'Image', type: 'Image',
url: this.driveFileEntityService.getPublicUrl(file), url: this.driveFileEntityService.getPublicUrl(file, undefined, true),
sensitive: file.isSensitive, sensitive: file.isSensitive,
name: file.comment, name: file.comment,
}; };

View file

@ -250,8 +250,8 @@ export class ApPersonService implements OnModuleInit {
return { return {
avatarId: avatar?.id ?? null, avatarId: avatar?.id ?? null,
bannerId: banner?.id ?? null, bannerId: banner?.id ?? null,
avatarUrl: avatar ? this.driveFileEntityService.getPublicUrl(avatar, 'avatar') : null, avatarUrl: avatar ? this.driveFileEntityService.getPublicUrl(avatar, 'avatar', true) : null,
bannerUrl: banner ? this.driveFileEntityService.getPublicUrl(banner) : null, bannerUrl: banner ? this.driveFileEntityService.getPublicUrl(banner, undefined, true) : null,
avatarBlurhash: avatar?.blurhash ?? null, avatarBlurhash: avatar?.blurhash ?? null,
bannerBlurhash: banner?.blurhash ?? null, bannerBlurhash: banner?.blurhash ?? null,
}; };

View file

@ -107,7 +107,7 @@ export class DriveFileEntityService {
} }
@bindThis @bindThis
public getPublicUrl(file: MiDriveFile, mode?: 'avatar'): string { // static = thumbnail public getPublicUrl(file: MiDriveFile, mode?: 'avatar', ap?: boolean): string { // static = thumbnail
// リモートかつメディアプロキシ // リモートかつメディアプロキシ
if (file.uri != null && file.userHost != null && this.config.externalMediaProxyEnabled) { if (file.uri != null && file.userHost != null && this.config.externalMediaProxyEnabled) {
return this.getProxiedUrl(file.uri, mode); return this.getProxiedUrl(file.uri, mode);
@ -129,6 +129,16 @@ export class DriveFileEntityService {
if (mode === 'avatar') { if (mode === 'avatar') {
return this.getProxiedUrl(url, 'avatar'); return this.getProxiedUrl(url, 'avatar');
} }
if (ap && this.config.apFileBaseUrl) {
const baseUrl = this.config.apFileBaseUrl;
const isValidBaseUrl = /^https?:\/\/[\w.-]+\.[a-zA-Z]{2,}(\/.*)?$/i.test(baseUrl);
if (isValidBaseUrl) {
const trimmedBaseUrl = baseUrl.replace(/\/$/, '');
return url.replace(/^https?:\/\/[\w.-]+\.[a-zA-Z]{2,}/, trimmedBaseUrl);
}
}
return url; return url;
} }

View file

@ -17,6 +17,7 @@
}, },
"dependencies": { "dependencies": {
"@discordapp/twemoji": "14.1.2", "@discordapp/twemoji": "14.1.2",
"@fontsource/jetbrains-mono": "^5.0.12",
"@github/webauthn-json": "2.1.1", "@github/webauthn-json": "2.1.1",
"@rollup/plugin-alias": "5.0.0", "@rollup/plugin-alias": "5.0.0",
"@rollup/plugin-json": "6.0.0", "@rollup/plugin-json": "6.0.0",
@ -54,6 +55,8 @@
"json5": "2.2.3", "json5": "2.2.3",
"matter-js": "0.19.0", "matter-js": "0.19.0",
"photoswipe": "5.4.1", "photoswipe": "5.4.1",
"pretendard": "^1.3.8",
"pretendard-jp": "^1.3.8",
"prismjs": "1.29.0", "prismjs": "1.29.0",
"punycode": "2.3.0", "punycode": "2.3.0",
"querystring": "0.2.1", "querystring": "0.2.1",

View file

@ -6,44 +6,28 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
@mixin font($font-family, $font-weight, $font-style, $font-local, $font-url) { @import "@fontsource/jetbrains-mono/100.css";
@font-face { @import "@fontsource/jetbrains-mono/100-italic.css";
font-family: $font-family; @import "@fontsource/jetbrains-mono/200.css";
font-weight: $font-weight; @import "@fontsource/jetbrains-mono/200-italic.css";
font-style: $font-style; @import "@fontsource/jetbrains-mono/300.css";
font-display: swap; @import "@fontsource/jetbrains-mono/300-italic.css";
src: local($font-local), url($font-url) format('woff2'); @import "@fontsource/jetbrains-mono/400.css";
} @import "@fontsource/jetbrains-mono/400-italic.css";
} @import "@fontsource/jetbrains-mono/500.css";
@import "@fontsource/jetbrains-mono/500-italic.css";
@import "@fontsource/jetbrains-mono/600.css";
@import "@fontsource/jetbrains-mono/600-italic.css";
@import "@fontsource/jetbrains-mono/700.css";
@import "@fontsource/jetbrains-mono/700-italic.css";
@import "@fontsource/jetbrains-mono/800.css";
@import "@fontsource/jetbrains-mono/800-italic.css";
@import "pretendard/dist/web/static/pretendard-dynamic-subset.css";
@import "pretendard-jp/dist/web/static/pretendard-jp-dynamic-subset.css";
@include font( $default-font: "Pretendard JP", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Hiragino Sans", "Apple SD Gothic Neo", Meiryo, "Noto Sans JP", "Noto Sans KR", "Malgun Gothic", Osaka, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
'Pretendard JP', $system-font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", Roboto, "Noto Sans KR", "Segoe UI", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
400, $monospace-font: "JetBrains Mono", "Pretendard JP", Pretendard, Fira code, Fira Mono, Consolas, Menlo, Courier, monospace !important;
normal,
'Pretendard JP Regular',
'https://cdn.jsdelivr.net/gh/orioncactus/pretendard/packages/pretendard-jp/dist/web/static/woff2/PretendardJP-Regular.woff2'
);
@include font(
'Pretendard JP',
700,
normal,
'Pretendard JP Bold',
'https://cdn.jsdelivr.net/gh/orioncactus/pretendard/packages/pretendard-jp/dist/web/static/woff2/PretendardJP-Bold.woff2'
);
@include font(
'JetBrains Mono',
400,
normal,
'JetBrains Mono Regular',
'https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono@master/fonts/webfonts/JetBrainsMono-Regular.woff2'
);
@include font(
'JetBrains Mono',
700,
normal,
'JetBrains Mono Bold',
'https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono@master/fonts/webfonts/JetBrainsMono-Bold.woff2'
);
:root { :root {
--radius: 12px; --radius: 12px;
@ -80,10 +64,7 @@ html {
accent-color: var(--accent); accent-color: var(--accent);
overflow: auto; overflow: auto;
overflow-wrap: break-word; overflow-wrap: break-word;
font-family: "Pretendard JP", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, font-family: $default-font;
Roboto, "Helvetica Neue", "Segoe UI", "Hiragino Sans", "Apple SD Gothic Neo",
Meiryo, "Noto Sans JP", "Noto Sans KR", "Malgun Gothic", Osaka,
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
// incoming changes from v13 // incoming changes from v13
// font-family: 'Hiragino Maru Gothic Pro', "BIZ UDGothic", Roboto, HelveticaNeue, Arial, sans-serif; // font-family: 'Hiragino Maru Gothic Pro', "BIZ UDGothic", Roboto, HelveticaNeue, Arial, sans-serif;
font-size: 14px; font-size: 14px;
@ -199,7 +180,7 @@ html {
} }
&.useSystemFont { &.useSystemFont {
font-family: system-ui; font-family: $system-font;
} }
} }
@ -515,12 +496,12 @@ hr {
} }
._monospace { ._monospace {
font-family: "Pretendard JP", "JetBrains Mono", Fira code, Fira Mono, Consolas, Menlo, Courier, monospace !important; font-family: $monospace-font
} }
code[class*="language-"], code[class*="language-"],
pre[class*="language-"] { pre[class*="language-"] {
font-family: "JetBrains Mono", "Pretendard JP" , Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace !important; font-family: $monospace-font
} }
.prism-editor__textarea:focus { .prism-editor__textarea:focus {