feat: license violation protection (#13285)

* spec(frontend): aboutページにリポジトリ・フィードバックのURLを表示させる

Cherry-picked from MisskeyIO#441
Cherry-picked from MisskeyIO#438

* feat: license violation protection

* build: fix typo

* build: fix typo

* fix: farewell to the static type land

* fix: key typo

* fix: import typo

* fix: properly interpret `prominently`

* docs: add disclaimer

* docs: update CHANGELOG

* chore: add gap

---------

Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
Acid Chicken (硫酸鶏)
2024-02-17 13:34:50 +09:00
committed by GitHub
parent fa243276c5
commit acba96c1d3
19 changed files with 371 additions and 26 deletions

View File

@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class MakeRepositoryUrlNullable1707808106310 {
name = 'MakeRepositoryUrlNullable1707808106310'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "repositoryUrl" DROP NOT NULL`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "repositoryUrl" SET NOT NULL`);
}
}

View File

@@ -57,6 +57,8 @@ type Source = {
scope?: 'local' | 'global' | string[];
};
publishTarballInsteadOfProvideRepositoryUrl?: boolean;
proxy?: string;
proxySmtp?: string;
proxyBypassHosts?: string[];
@@ -145,6 +147,7 @@ export type Config = {
signToActivityPubGet: boolean | undefined;
version: string;
publishTarballInsteadOfProvideRepositoryUrl: boolean;
host: string;
hostname: string;
scheme: string;
@@ -209,6 +212,7 @@ export function loadConfig(): Config {
return {
version,
publishTarballInsteadOfProvideRepositoryUrl: !!config.publishTarballInsteadOfProvideRepositoryUrl,
url: url.origin,
port: config.port ?? parseInt(process.env.PORT ?? '', 10),
socket: config.socket,

View File

@@ -357,9 +357,9 @@ export class MiMeta {
@Column('varchar', {
length: 1024,
default: 'https://github.com/misskey-dev/misskey',
nullable: false,
nullable: true,
})
public repositoryUrl: string;
public repositoryUrl: string | null;
@Column('varchar', {
length: 1024,

View File

@@ -429,7 +429,7 @@ export const meta = {
},
repositoryUrl: {
type: 'string',
optional: false, nullable: false,
optional: false, nullable: true,
},
summalyProxy: {
type: 'string',

View File

@@ -104,8 +104,8 @@ export const paramDef = {
swPublicKey: { type: 'string', nullable: true },
swPrivateKey: { type: 'string', nullable: true },
tosUrl: { type: 'string', nullable: true },
repositoryUrl: { type: 'string' },
feedbackUrl: { type: 'string' },
repositoryUrl: { type: 'string', nullable: true },
feedbackUrl: { type: 'string', nullable: true },
impressumUrl: { type: 'string', nullable: true },
privacyPolicyUrl: { type: 'string', nullable: true },
useObjectStorage: { type: 'boolean' },
@@ -402,7 +402,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
if (ps.repositoryUrl !== undefined) {
set.repositoryUrl = ps.repositoryUrl;
set.repositoryUrl = URL.canParse(ps.repositoryUrl!) ? ps.repositoryUrl : null;
}
if (ps.feedbackUrl !== undefined) {

View File

@@ -37,6 +37,10 @@ export const meta = {
type: 'string',
optional: false, nullable: false,
},
providesTarball: {
type: 'boolean',
optional: false, nullable: false,
},
name: {
type: 'string',
optional: false, nullable: false,
@@ -69,12 +73,12 @@ export const meta = {
},
repositoryUrl: {
type: 'string',
optional: false, nullable: false,
optional: false, nullable: true,
default: 'https://github.com/misskey-dev/misskey',
},
feedbackUrl: {
type: 'string',
optional: false, nullable: false,
optional: false, nullable: true,
default: 'https://github.com/misskey-dev/misskey/issues/new',
},
defaultDarkTheme: {
@@ -352,6 +356,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
maintainerEmail: instance.maintainerEmail,
version: this.config.version,
providesTarball: this.config.publishTarballInsteadOfProvideRepositoryUrl,
name: instance.name,
shortName: instance.shortName,