Skip to content

Commit

Permalink
Merge pull request misskey-dev#70 from lqvp/feature/hanamode
Browse files Browse the repository at this point in the history
  • Loading branch information
hitalin authored Nov 29, 2024
2 parents 2c32581 + c4ddc78 commit 8f0e071
Show file tree
Hide file tree
Showing 70 changed files with 2,537 additions and 70 deletions.
5 changes: 5 additions & 0 deletions .config/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,10 @@ signToActivityPubGet: true
# Upload or download file size limits (bytes)
#maxFileSize: 262144000

# timeout and maximum size for imports (e.g. note imports)
#import:
# downloadTimeout: 30
# maxFileSize: 262144000

# PID File of master process
#pidFile: /tmp/misskey.pid
26 changes: 26 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ mentions: "Mentions"
directNotes: "Direct notes"
importAndExport: "Import / Export"
import: "Import"
importOrigin: "Import Source"
importNoteInfo: "You can import notes exported from other services."
importNoteDisclaimer: "Not all notes can be imported. In cases where Misskey has been modified, or the export is from a completely different platform, import may not be possible at all."
importNoteWarm: "Imported notes may only be visible on your user page."
export: "Export"
files: "Files"
download: "Download"
Expand Down Expand Up @@ -1607,6 +1611,9 @@ _achievements:
title: "I Am a Cat"
description: "Mark your account as a cat"
flavor: "I'll give you a name later."
_markedAsHanaModeUser:
title: "Wish I were born a small person like a violet"
description: "Unlocked Hana Mode to take the first step of your tiny, comfy fedi experience"
_following1:
title: "Following your first user"
description: "Follow a user"
Expand Down Expand Up @@ -1781,6 +1788,7 @@ _role:
ltlAvailable: "Can view the local timeline"
canPublicNote: "Can send public notes"
mentionMax: "Maximum number of mentions in a note"
canImportNotes: "Can import notes"
canInvite: "Can create instance invite codes"
inviteLimit: "Invite limit"
inviteLimitCycle: "Invite limit cooldown"
Expand Down Expand Up @@ -2352,6 +2360,7 @@ _instanceCharts:
filesTotal: "Cumulative number of files"
_timelines:
home: "Home"
hanami: "Hanami"
local: "Local"
social: "Social"
global: "Global"
Expand Down Expand Up @@ -2742,6 +2751,7 @@ _contextMenu:
app: "Application"
appWithShift: "Application with shift key"
native: "Native"

_reactionChecksMuting:
title: "Check mutings when get reactions"
caption: "Check mutings when get reactions, but cache does not work and may increase traffic"
Expand Down Expand Up @@ -2770,3 +2780,19 @@ _hideReactionCount:
self: "Only my notes"
others: "Only notes of others"
all: "All notes"

_hana:
hanaSettings: "HanaMisskey Settings"
hanaMode: "Hana Mode"
_hanaModeSwitcher:
recommendedFor: "Recommended for"
normal: "Normal"
normal1: "You can use the LTL (Local Timeline)"
normal2: "Posts set to 'Public' will appear on the LTL"
normalRecommend: "For those who want to prioritize interaction with users on the same server"
hana1: "LTL is not available"
hana2: "Posts set to 'Public' will not appear on the LTL"
hana3: "You can use the 'Hana Timeline,' which allows you to browse the latest notes from users you follow and popular posts from the Fediverse"
hanaRecommend: "For those who want a decentralized SNS experience similar to a private server, while still emphasizing interaction with external servers as well"
saveConfirmDescription: "There is a limit on how many times you can switch modes within a certain period."

102 changes: 102 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,22 @@ export interface Locale extends ILocale {
* インポート
*/
"import": string;
/**
* インポート元
*/
"importOrigin": string;
/**
* 他サービスでエクスポートしたノートなどをインポートすることができます。
*/
"importNoteInfo": string;
/**
* すべてのノートがインポートできるわけではありません。改変のないMisskey以外では全くインポートできない場合もあります。
*/
"importNoteDisclaimer": string;
/**
* インポートされたノートは、ユーザーページ以外には表示されない場合があります。
*/
"importNoteWarm": string;
/**
* エクスポート
*/
Expand Down Expand Up @@ -5870,6 +5886,10 @@ export interface Locale extends ILocale {
};
};
"_timelineDescription": {
/**
* はなみタイムラインでは、フォローしているアカウントの投稿に加えて、連合しているサーバーの人気な投稿も見られます。
*/
"hanami": string;
/**
* ホームタイムラインでは、あなたがフォローしているアカウントの投稿を見られます。
*/
Expand Down Expand Up @@ -6433,6 +6453,16 @@ export interface Locale extends ILocale {
*/
"flavor": string;
};
"_markedAsHanaModeUser": {
/**
* 菫ほどな小さき人に生まれたし
*/
"title": string;
/**
* はなモードを有効にした
*/
"description": string;
};
"_following1": {
/**
* はじめてのフォロー
Expand Down Expand Up @@ -7033,6 +7063,10 @@ export interface Locale extends ILocale {
* ローカルタイムラインの閲覧
*/
"ltlAvailable": string;
/**
* はなみタイムラインの閲覧
*/
"hanamiTlAvailable": string;
/**
* パブリック投稿の許可
*/
Expand All @@ -7041,6 +7075,10 @@ export interface Locale extends ILocale {
* ノート内の最大メンション数
*/
"mentionMax": string;
/**
* ノートのインポート
*/
"canImportNotes": string;
/**
* サーバー招待コードの発行
*/
Expand Down Expand Up @@ -7187,6 +7225,10 @@ export interface Locale extends ILocale {
* botユーザー
*/
"isBot": string;
/**
* はなモードが有効なユーザー
*/
"isInHanaMode": string;
/**
* サスペンド済みユーザー
*/
Expand Down Expand Up @@ -9250,6 +9292,10 @@ export interface Locale extends ILocale {
* ホーム
*/
"home": string;
/**
* はなみ
*/
"hanami": string;
/**
* ローカル
*/
Expand Down Expand Up @@ -10847,6 +10893,62 @@ export interface Locale extends ILocale {
*/
"all": string;
};
"_hana": {
/**
* はなみすきー設定
*/
"hanaSettings": string;
/**
* はなモード
*/
"hanaMode": string;
/**
* はな
*/
"hanaModeShort": string;
"_hanaModeSwitcher": {
/**
* こんな方におすすめ
*/
"recomenddedFor": string;
/**
* 通常
*/
"normal": string;
/**
* LTLが使えます
*/
"normal1": string;
/**
* 公開範囲「パブリック」で投稿した内容はLTLに表示されます
*/
"normal2": string;
/**
* サーバー内のユーザーとの交流を重視したい方
*/
"normalRecommend": string;
/**
* LTLが使えません
*/
"hana1": string;
/**
* 公開範囲「パブリック」で投稿した内容はLTLに表示されません
*/
"hana2": string;
/**
* フォロー中ユーザーの最新のノートとFediverseの人気の投稿をザッピングできる「はなみタイムライン」が使用できます
*/
"hana3": string;
/**
* おひとりさまサーバーのような分散SNS体験をしたい方(内々での交流だけでなく、外部サーバーとの交流もしっかり重視したい方)
*/
"hanaRecommend": string;
/**
* 一定期間にモードを変更できる回数には制限があります。
*/
"saveConfirmDescription": string;
};
};
}
declare const locales: {
[lang: string]: Locale;
Expand Down
28 changes: 28 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ mentions: "あなた宛て"
directNotes: "ダイレクト投稿"
importAndExport: "インポートとエクスポート"
import: "インポート"
importOrigin: "インポート元"
importNoteInfo: "他サービスでエクスポートしたノートなどをインポートすることができます。"
importNoteDisclaimer: "すべてのノートがインポートできるわけではありません。改変のないMisskey以外では全くインポートできない場合もあります。"
importNoteWarm: "インポートされたノートは、ユーザーページ以外には表示されない場合があります。"
export: "エクスポート"
files: "ファイル"
download: "ダウンロード"
Expand Down Expand Up @@ -1482,6 +1486,7 @@ _initialTutorial:
description: "ここで紹介した機能はほんの一部にすぎません。Misskeyの使い方をより詳しく知るには、{link}をご覧ください。"

_timelineDescription:
hanami: "はなみタイムラインでは、フォローしているアカウントの投稿に加えて、連合しているサーバーの人気な投稿も見られます。"
home: "ホームタイムラインでは、あなたがフォローしているアカウントの投稿を見られます。"
local: "ローカルタイムラインでは、このサーバーにいるユーザー全員の投稿を見られます。"
social: "ソーシャルタイムラインには、ホームタイムラインとローカルタイムラインの投稿が両方表示されます。"
Expand Down Expand Up @@ -1644,6 +1649,9 @@ _achievements:
title: "吾輩は猫である"
description: "アカウントをCatとして設定した"
flavor: "名前はまだない。"
_markedAsHanaModeUser:
title: "菫ほどな小さき人に生まれたし"
description: "はなモードを有効にした"
_following1:
title: "はじめてのフォロー"
description: "初めてフォローした"
Expand Down Expand Up @@ -1817,8 +1825,10 @@ _role:
_options:
gtlAvailable: "グローバルタイムラインの閲覧"
ltlAvailable: "ローカルタイムラインの閲覧"
hanamiTlAvailable: "はなみタイムラインの閲覧"
canPublicNote: "パブリック投稿の許可"
mentionMax: "ノート内の最大メンション数"
canImportNotes: "ノートのインポート"
canInvite: "サーバー招待コードの発行"
inviteLimit: "招待コードの作成可能数"
inviteLimitCycle: "招待コードの発行間隔"
Expand Down Expand Up @@ -1856,6 +1866,7 @@ _role:
isRemote: "リモートユーザー"
isCat: "猫ユーザー"
isBot: "botユーザー"
isInHanaMode: "はなモードが有効なユーザー"
isSuspended: "サスペンド済みユーザー"
isLocked: "鍵アカウントユーザー"
isExplorable: "「アカウントを見つけやすくする」が有効なユーザー"
Expand Down Expand Up @@ -2437,6 +2448,7 @@ _instanceCharts:

_timelines:
home: "ホーム"
hanami: "はなみ"
local: "ローカル"
social: "ソーシャル"
global: "グローバル"
Expand Down Expand Up @@ -2890,3 +2902,19 @@ _hideReactionCount:
self: "自分のノートのみ"
others: "自分以外のノートのみ"
all: "全てのノート"

_hana:
hanaSettings: "はなみすきー設定"
hanaMode: "はなモード"
hanaModeShort: "はな"
_hanaModeSwitcher:
recomenddedFor: "こんな方におすすめ"
normal: "通常"
normal1: "LTLが使えます"
normal2: "公開範囲「パブリック」で投稿した内容はLTLに表示されます"
normalRecommend: "サーバー内のユーザーとの交流を重視したい方"
hana1: "LTLが使えません"
hana2: "公開範囲「パブリック」で投稿した内容はLTLに表示されません"
hana3: "フォロー中ユーザーの最新のノートとFediverseの人気の投稿をザッピングできる「はなみタイムライン」が使用できます"
hanaRecommend: "おひとりさまサーバーのような分散SNS体験をしたい方(内々での交流だけでなく、外部サーバーとの交流もしっかり重視したい方)"
saveConfirmDescription: "一定期間にモードを変更できる回数には制限があります。"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export class AddIsInHanaModeColumnToMiUser1723641187454 {
name = 'AddIsInHanaModeColumnToMiUser1723641187454'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "user" ADD "isInHanaMode" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`COMMENT ON COLUMN "user"."isInHanaMode" IS 'Whether the User is in Hana Mode.'`);
}

async down(queryRunner) {
await queryRunner.query(`COMMENT ON COLUMN "user"."isInHanaMode" IS 'Whether the User is in Hana Mode.'`);
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "isInHanaMode"`);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export class AddIsNoteInHanaModeColumnToMiNote1723664940877 {
name = 'AddIsNoteInHanaModeColumnToMiNote1723664940877'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "note" ADD "isNoteInHanaMode" boolean NOT NULL DEFAULT false`);
}

async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "isNoteInHanaMode"`);
}
}
13 changes: 13 additions & 0 deletions packages/backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ type Source = {
perChannelMaxNoteCacheCount?: number;
perUserNotificationsMaxCount?: number;
deactivateAntennaThreshold?: number;

import?: {
downloadTimeout: number;
maxFileSize: number;
};

pidFile: string;
};

Expand Down Expand Up @@ -181,6 +187,12 @@ export type Config = {
perChannelMaxNoteCacheCount: number;
perUserNotificationsMaxCount: number;
deactivateAntennaThreshold: number;

import: {
downloadTimeout: number;
maxFileSize: number;
} | undefined;

pidFile: string;
};

Expand Down Expand Up @@ -292,6 +304,7 @@ export function loadConfig(): Config {
perChannelMaxNoteCacheCount: config.perChannelMaxNoteCacheCount ?? 1000,
perUserNotificationsMaxCount: config.perUserNotificationsMaxCount ?? 500,
deactivateAntennaThreshold: config.deactivateAntennaThreshold ?? (1000 * 60 * 60 * 24 * 7),
import: config.import,
pidFile: config.pidFile,
};
}
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/core/AchievementService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const ACHIEVEMENT_TYPES = [
'myNoteFavorited1',
'profileFilled',
'markedAsCat',
'markedAsHanaModeUser',
'following1',
'following10',
'following50',
Expand Down
8 changes: 4 additions & 4 deletions packages/backend/src/core/DownloadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export class DownloadService {
}

@bindThis
public async downloadUrl(url: string, path: string): Promise<{
public async downloadUrl(url: string, path: string, options: { timeout?: number, operationTimeout?: number, maxSize?: number} = {} ): Promise<{
filename: string;
}> {
this.logger.info(`Downloading ${chalk.cyan(url)} to ${chalk.cyanBright(path)} ...`);

const timeout = 30 * 1000;
const operationTimeout = 60 * 1000;
const maxSize = this.config.maxFileSize;
const timeout = options.timeout ?? 30 * 1000;
const operationTimeout = options.operationTimeout ?? 60 * 1000;
const maxSize = options.maxSize ?? this.config.maxFileSize;

const urlObj = new URL(url);
let filename = urlObj.pathname.split('/').pop() ?? 'untitled';
Expand Down
Loading

0 comments on commit 8f0e071

Please sign in to comment.