Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodeinfoでyojo-artを名乗る #565

Merged
merged 26 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG_YOJO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 1.2.0

### General
- Change: nodeinfoでyojo-artを名乗る [#565](https://github.com/yojo-art/cherrypick/pull/565)
- Fix: ノートを編集する時に検索許可範囲を記憶する [#558](https://github.com/yojo-art/cherrypick/pull/558)

### Client
Expand Down
86 changes: 48 additions & 38 deletions locales/index.d.ts

Large diffs are not rendered by default.

77 changes: 40 additions & 37 deletions locales/ja-JP.yml

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "cherrypick",
"version": "4.13.0-yojo1.2.0",
"name": "yojo-art",
"version": "1.2.0",
"basedMisskeyVersion": "2024.10.1",
"basedCherrypickVersion": "4.13.0",
"codename": "nasubi",
"repository": {
"type": "git",
"url": "https://github.com/kokonect-link/cherrypick.git"
"url": "https://github.com/yojo-art/cherrypick.git"
},
"packageManager": "pnpm@9.6.0",
"workspaces": [
Expand Down
9 changes: 5 additions & 4 deletions packages/backend/src/boot/master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ function greet() {
console.log(chalk.hex('#ffa9c3').bold(' \\/ \\/ \\/ \\/ ') + chalk.hex('#95e3e8').bold(' \\/ \\/'));
//#endregion

console.log(chalk.hex('#ffa9c3').bold(' Cherry') + chalk.hex('#95e3e8').bold('Pick') + (' is an open-source decentralized microblogging platform based from') + (chalk.hex('#9ec23f').bold(' Misskey') + ('.')));
console.log(chalk.hex('#ffbb00')(' If you like ') + chalk.hex('#ffa9c3').bold('Cherry') + chalk.hex('#95e3e8').bold('Pick') + chalk.hex('#ffbb00')(', please donate to support development. https://www.patreon.com/noridev & https://www.paypal.me/noridev & https://toss.me/noridev'));
console.log(chalk.hex('#ffa9c3').bold(' yojo') + chalk.hex('#98e2cf').bold('-') + chalk.hex('#95e3e8').bold('art') + (' is an open-source decentralized microblogging platform based from') + (chalk.hex('#9ec23f').bold(' Misskey') + (' and ') + chalk.hex('#ffa9c3').bold(' Cherry') + chalk.hex('#95e3e8').bold('Pick') + '.'));
console.log(chalk.hex('#ffbb00')(' If you like ') + chalk.hex('#ffa9c3').bold(' yojo') + chalk.hex('#98e2cf').bold('-') + chalk.hex('#95e3e8').bold('art') + chalk.hex('#ffbb00')(', please donate to support development. https://yojo-art.fanbox.cc/'));
// console.log(chalk.hex('#ffa9c3').bold(' KOKO') + chalk.hex('#95e3e8').bold('NECT') + chalk.hex('#ffa9c3')(' with') + chalk.hex('#95e3e8').bold(' NoriDev.'));

console.log('');
console.log(chalkTemplate`--- ${os.hostname()} {gray (PID: ${process.pid.toString()})} ---`);
}

bootLogger.info('Welcome to CherryPick!');
bootLogger.info(`CherryPick v${meta.version}`, null, true);
bootLogger.info('Welcome to yojo-art!');
bootLogger.info(`yojo-art v${meta.version}`, null, true);
bootLogger.info(`Based on Misskey v${meta.basedMisskeyVersion}`, null, true);
bootLogger.info(`Based on Cherrypick v${meta.basedCherrypickVersion}`, null, true);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export type Config = {

version: string;
basedMisskeyVersion: string;
basedCherrypickVersion: string;
publishTarballInsteadOfProvideRepositoryUrl: boolean;
setupPassword: string | undefined;
host: string;
Expand Down Expand Up @@ -261,6 +262,7 @@ export function loadConfig(): Config {
const url = tryCreateUrl(config.url ?? process.env.CHERRYPICK_URL ?? '');
const version = meta.version;
const basedMisskeyVersion = meta.basedMisskeyVersion;
const basedCherrypickVersion = meta.basedCherrypickVersion;
const host = url.host;
const hostname = url.hostname;
const scheme = url.protocol.replace(/:$/, '');
Expand All @@ -284,6 +286,7 @@ export function loadConfig(): Config {
return {
version,
basedMisskeyVersion,
basedCherrypickVersion,
publishTarballInsteadOfProvideRepositoryUrl: !!config.publishTarballInsteadOfProvideRepositoryUrl,
setupPassword: config.setupPassword,
url: url.origin,
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/core/FetchInstanceMetadataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type NodeInfo = {
name?: unknown;
version?: unknown;
basedMisskeyVersion?: unknown;
basedCherrypickVersion?: unknown;
};
metadata?: {
name?: unknown;
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/core/entities/MetaEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class MetaEntityService {

version: this.config.version,
basedMisskeyVersion: this.config.basedMisskeyVersion,
basedCherrypickVersion: this.config.basedCherrypickVersion,
providesTarball: this.config.publishTarballInsteadOfProvideRepositoryUrl,

name: instance.name,
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/src/models/json-schema/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export const packedMetaLiteSchema = {
type: 'string',
optional: false, nullable: false,
},
basedCherrypickVersion: {
type: 'string',
optional: false, nullable: false,
},
providesTarball: {
type: 'boolean',
optional: false, nullable: false,
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/server/NodeinfoServerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ export class NodeinfoServerService {
* ソフトウェアの名前を変更すると、一部の独自機能が使用できなくなったり、CherryPickとして認識されないなどの不利益が発生する場合があります。
* フォーク開発者はこの点に注意して修正を行ってください。
*/
name: 'cherrypick',
name: 'yojo-art',
version: this.config.version,
basedMisskeyVersion: this.config.basedMisskeyVersion,
basedCherrypickVersion: this.config.basedCherrypickVersion,
homepage: nodeinfo_homepage,
repository: meta.repositoryUrl,
},
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/server/api/endpoints/admin/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
maintainerEmail: instance.maintainerEmail,
version: this.config.version,
basedMisskeyVersion: this.config.basedMisskeyVersion,
basedCherrypickVersion: this.config.basedCherrypickVersion,
name: instance.name,
shortName: instance.shortName,
uri: this.config.url,
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/server/api/openapi/gen-spec.ts
penginn-net marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export function genOpenapiSpec(config: Config, includeSelfRef = false) {
openapi: '3.1.0',

info: {
version: `${config.version} (${config.basedMisskeyVersion})`,
title: 'CherryPick API',
version: `${config.version} (${config.basedCherrypickVersion}) (${config.basedMisskeyVersion})`,
title: 'yojo-art API',
},

externalDocs: {
description: 'Repository',
url: 'https://github.com/kokonect-link/cherrypick',
url: 'https://github.com/yojo-art/cherrypick',
},

servers: [{
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/src/server/web/ClientServerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export class ClientServerService {
defaultContext: {
version: this.config.version,
basedMisskeyVersion: this.config.basedMisskeyVersion,
basedCherrypickVersion: this.config.basedCherrypickVersion,
config: this.config,
},
});
Expand Down Expand Up @@ -876,6 +877,7 @@ export class ClientServerService {
return await reply.view('info-card', {
version: this.config.version,
basedMisskeyVersion: this.config.basedMisskeyVersion,
basedCherrypickVersion: this.config.basedCherrypickVersion,
host: this.config.host,
meta: this.meta,
originalUsersCount: await this.usersRepository.countBy({ host: IsNull() }),
Expand All @@ -888,13 +890,15 @@ export class ClientServerService {
return await reply.view('bios', {
version: this.config.version,
basedMisskeyVersion: this.config.basedMisskeyVersion,
basedCherrypickVersion: this.config.basedCherrypickVersion,
});
});

fastify.get('/cli', async (request, reply) => {
return await reply.view('cli', {
version: this.config.version,
basedMisskeyVersion: this.config.basedMisskeyVersion,
basedCherrypickVersion: this.config.basedCherrypickVersion,
});
});

Expand Down
5 changes: 5 additions & 0 deletions packages/backend/src/server/web/boot.embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
const meta = await metaRes.json();
const v = meta.version;
const basedMisskeyVersion = meta.basedMisskeyVersion;
const basedCherrypickVersion = meta.basedCherrypickVersion;
if (v == null) {
renderError('META_FETCH_V');
return;
Expand All @@ -71,6 +72,10 @@
renderError('META_FETCH_BASEDMISSKEY_V');
return;
}
if (basedCherrypickVersion == null) {
renderError('META_FETCH_BASEDCHERRYPICK_V');
return;
}

// for https://github.com/misskey-dev/misskey/issues/10202
if (lang == null || lang.toString == null || lang.toString() === 'null') {
Expand Down
5 changes: 5 additions & 0 deletions packages/backend/src/server/web/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
const meta = await metaRes.json();
const v = meta.version;
const basedMisskeyVersion = meta.basedMisskeyVersion;
const basedCherrypickVersion = meta.basedCherrypickVersion;
if (v == null) {
renderError('META_FETCH_V');
return;
Expand All @@ -61,6 +62,10 @@
renderError('META_FETCH_BASEDMISSKEY_V');
return;
}
if (basedCherrypickVersion == null) {
renderError('META_FETCH_BASEDCHERRYPICK_V');
return;
}

// for https://github.com/misskey-dev/misskey/issues/10202
if (lang == null || lang.toString == null || lang.toString() === 'null') {
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/server/web/views/base-embed.pug
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ html(class='embed')
script.
var VERSION = "#{version}";
var BASED_MISSKEY_VERSION = "#{basedMisskeyVersion}";
var BASED_CHERRYPICK_VERSION = "#{basedCherrypickVersion}";
var CLIENT_ENTRY = "#{entry.file}";

script(type='application/json' id='cherrypick_meta' data-generated-at=now)
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/server/web/views/base.pug
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ html
script.
var VERSION = "#{version}";
var BASED_MISSKEY_VERSION = "#{basedMisskeyVersion}";
var BASED_CHERRYPICK_VERSION = "#{basedCherrypickVersion}";
var CLIENT_ENTRY = "#{entry.file}";

script(type='application/json' id='cherrypick_meta' data-generated-at=now)
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/test/e2e/nodeinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('nodeinfo', () => {
assert.strictEqual(res.headers.get('Access-Control-Allow-Origin'), '*');

const nodeInfo = await res.json() as any;
assert.strictEqual(nodeInfo.software.name, 'cherrypick');
assert.strictEqual(nodeInfo.software.name, 'yojo-art');
});

test('nodeinfo 2.0', async () => {
Expand All @@ -24,6 +24,6 @@ describe('nodeinfo', () => {
assert.strictEqual(res.headers.get('Access-Control-Allow-Origin'), '*');

const nodeInfo = await res.json() as any;
assert.strictEqual(nodeInfo.software.name, 'cherrypick');
assert.strictEqual(nodeInfo.software.name, 'yojo-art');
});
});
7 changes: 4 additions & 3 deletions packages/cherrypick-js/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"type": "module",
"name": "cherrypick-js",
"version": "4.13.0-yojo1.2.0",
"version": "1.2.0",
"basedMisskeyVersion": "2024.10.1",
"description": "CherryPick SDK for JavaScript",
"basedCherrypickVersion": "4.13.0",
"description": "yojo-art SDK for JavaScript",
"license": "MIT",
"main": "./built/index.js",
"types": "./built/index.d.ts",
Expand Down Expand Up @@ -35,7 +36,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/kokonect-link/cherrypick.git",
"url": "https://github.com/yojo-art/cherrypick.git",
"directory": "packages/cherrypick-js"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/cherrypick-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5355,6 +5355,7 @@ export type components = {
maintainerEmail: string | null;
version: string;
basedMisskeyVersion: string;
basedCherrypickVersion: string;
providesTarball: boolean;
name: string | null;
shortName: string | null;
Expand Down
1 change: 1 addition & 0 deletions packages/frontend-embed/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type FIXME = any;
declare const _LANGS_: string[][];
declare const _VERSION_: string;
declare const _BASEDMISSKEYVERSION_: string;
declare const _BASEDCHERRYPICKVERSION_: string;
declare const _ENV_: string;
declare const _DEV_: boolean;
declare const _PERF_PREFIX_: string;
Expand Down
3 changes: 3 additions & 0 deletions packages/frontend-embed/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export default [
_DATA_TRANSFER_DRIVE_FILE_: false,
_DATA_TRANSFER_DRIVE_FOLDER_: false,
_DATA_TRANSFER_DECK_COLUMN_: false,

// yojo-art
_BASEDCHERRYPICKVERSION_: false,
},
parser,
parserOptions: {
Expand Down
1 change: 1 addition & 0 deletions packages/frontend-embed/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function getConfig(): UserConfig {
define: {
_VERSION_: JSON.stringify(meta.version),
_BASEDMISSKEYVERSION_: JSON.stringify(meta.basedMisskeyVersion),
_BASEDCHERRYPICKVERSION_: JSON.stringify(meta.basedCherrypickVersion),
_LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]) => [k, v._lang_])),
_ENV_: JSON.stringify(process.env.NODE_ENV),
_DEV_: process.env.NODE_ENV !== 'production',
Expand Down
1 change: 1 addition & 0 deletions packages/frontend-shared/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type FIXME = any;
declare const _LANGS_: string[][];
declare const _VERSION_: string;
declare const _BASEDMISSKEYVERSION_: string;
declare const _BASEDCHERRYPICKVERSION_: string;
declare const _ENV_: string;
declare const _DEV_: boolean;
declare const _PERF_PREFIX_: string;
Expand Down
1 change: 1 addition & 0 deletions packages/frontend-shared/js/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const preParseLocale = localStorage.getItem('locale');
export let locale: Locale = preParseLocale ? JSON.parse(preParseLocale) : null;
export const version = _VERSION_;
export const basedMisskeyVersion = _BASEDMISSKEYVERSION_;
export const basedCherrypickVersion = _BASEDCHERRYPICKVERSION_;
export const instanceName = (siteName === 'CherryPick' || siteName == null) ? host : siteName;
export const ui = localStorage.getItem('ui');
export const debug = localStorage.getItem('debug') === 'true';
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type FIXME = any;
declare const _LANGS_: string[][];
declare const _VERSION_: string;
declare const _BASEDMISSKEYVERSION_: string;
declare const _BASEDCHERRYPICKVERSION_: string;
declare const _ENV_: string;
declare const _DEV_: boolean;
declare const _PERF_PREFIX_: string;
Expand Down
3 changes: 3 additions & 0 deletions packages/frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export default [
_DATA_TRANSFER_DRIVE_FILE_: false,
_DATA_TRANSFER_DRIVE_FOLDER_: false,
_DATA_TRANSFER_DECK_COLUMN_: false,

// yojo-art
_BASEDCHERRYPICKVERSION_: false,
},
parser,
parserOptions: {
Expand Down
11 changes: 7 additions & 4 deletions packages/frontend/src/boot/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { computed, watch, version as vueVersion, App, defineAsyncComponent } from 'vue';
import { compareVersions } from 'compare-versions';
import { version, basedMisskeyVersion, lang, updateLocale, locale } from '@@/js/config.js';
import { version, basedMisskeyVersion, basedCherrypickVersion, lang, updateLocale, locale } from '@@/js/config.js';
import widgets from '@/widgets/index.js';
import directives from '@/directives/index.js';
import components from '@/components/index.js';
Expand Down Expand Up @@ -75,16 +75,18 @@ export async function common(createVue: () => App<Element>) {
//#region クライアントが更新されたかチェック
const lastVersion = miLocalStorage.getItem('lastVersion');
const lastBasedMisskeyVersion = miLocalStorage.getItem('lastBasedMisskeyVersion');
if (lastVersion !== version || lastBasedMisskeyVersion !== basedMisskeyVersion) {
const lastBasedCherrypickVersion = miLocalStorage.getItem('lastBasedCherrypickVersion');
if (lastVersion !== version || lastBasedMisskeyVersion !== basedMisskeyVersion || lastBasedCherrypickVersion !== basedCherrypickVersion) {
if (lastVersion == null) miLocalStorage.setItem('lastVersion', version);
else if (compareVersions(version, lastVersion) === 0 || compareVersions(version, lastVersion) === 1) miLocalStorage.setItem('lastVersion', version);
miLocalStorage.setItem('lastBasedMisskeyVersion', basedMisskeyVersion);
miLocalStorage.setItem('lastBasedCherrypickVersion', basedCherrypickVersion);

// テーマリビルドするため
miLocalStorage.removeItem('theme');

try { // 変なバージョン文字列来るとcompareVersionsでエラーになるため
if ((lastVersion != null && compareVersions(version, lastVersion) === 1) || (lastBasedMisskeyVersion != null && compareVersions(basedMisskeyVersion, lastBasedMisskeyVersion) === 1)) {
if ((lastVersion != null && compareVersions(version, lastVersion) === 1) || (lastBasedMisskeyVersion != null && compareVersions(basedMisskeyVersion, lastBasedMisskeyVersion) === 1) || (lastBasedCherrypickVersion != null && compareVersions(basedCherrypickVersion, lastBasedCherrypickVersion) === 1)) {
isClientUpdated = true;
} else if (lastVersion != null && compareVersions(version, lastVersion) === -1) isClientMigrated = true;
} catch (err) { /* empty */ }
Expand All @@ -93,7 +95,7 @@ export async function common(createVue: () => App<Element>) {

//#region Detect language & fetch translations
const localeVersion = miLocalStorage.getItem('localeVersion');
const localeOutdated = (localeVersion == null || localeVersion !== version || lastBasedMisskeyVersion !== basedMisskeyVersion || locale == null);
const localeOutdated = (localeVersion == null || localeVersion !== version || lastBasedMisskeyVersion !== basedMisskeyVersion || lastBasedCherrypickVersion !== basedCherrypickVersion || locale == null);
if (localeOutdated) {
const res = await window.fetch(`/assets/locales/${lang}.${version}.json`);
if (res.status === 200) {
Expand Down Expand Up @@ -136,6 +138,7 @@ export async function common(createVue: () => App<Element>) {
fetchInstanceMetaPromise.then(() => {
miLocalStorage.setItem('v', instance.version);
miLocalStorage.setItem('basedMisskeyVersion', instance.basedMisskeyVersion);
miLocalStorage.setItem('basedCherrypickVersion', instance.basedCherrypickVersion);
});

//#region loginId
Expand Down
Loading
Loading