From 1974d8f58b460953f9c6577f28963dc4985daa67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Wed, 6 Feb 2019 13:37:20 +0900 Subject: [PATCH 1/4] Add URL validation (#4148) --- src/config/load.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config/load.ts b/src/config/load.ts index fc3e69919..5bb01f3d4 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -47,14 +47,21 @@ export default function load() { return Object.assign(config, mixin); } -function validateUrl(url: string) { +function tryCreateUrl(url: string) { try { return new URL(url); } catch (e) { - throw `url="${url}" is not a valid URL`; + throw `url="${url}" is not a valid URL.`; } } +function validateUrl(url: string) { + const result = tryCreateUrl(url); + if (result.pathname.replace('/', '').length) throw `url="${url}" is not a valid URL, has a pathname.`; + if (!url.includes(result.host)) throw `url="${url}" is not a valid URL, has an invalid hostname.`; + return result; +} + function normalizeUrl(url: string) { return url.endsWith('/') ? url.substr(0, url.length - 1) : url; } From e9955e01d60773b96017acc1c6cd3dfae4dfb3e6 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Wed, 6 Feb 2019 13:42:35 +0900 Subject: [PATCH 2/4] Introduce option type (#4150) * Introduce option type * Improve test naming --- src/prelude/maybe.ts | 20 ++++++++++++++++++++ test/prelude/maybe.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/prelude/maybe.ts create mode 100644 test/prelude/maybe.ts diff --git a/src/prelude/maybe.ts b/src/prelude/maybe.ts new file mode 100644 index 000000000..f9ac95c0b --- /dev/null +++ b/src/prelude/maybe.ts @@ -0,0 +1,20 @@ +export interface Maybe { + isJust(): this is Just; +} + +export type Just = Maybe & { + get(): T +}; + +export function just(value: T): Just { + return { + isJust: () => true, + get: () => value + }; +} + +export function nothing(): Maybe { + return { + isJust: () => false, + }; +} diff --git a/test/prelude/maybe.ts b/test/prelude/maybe.ts new file mode 100644 index 000000000..470eec220 --- /dev/null +++ b/test/prelude/maybe.ts @@ -0,0 +1,28 @@ +/* + * Tests of Maybe + * + * How to run the tests: + * > mocha test/prelude/maybe.ts --require ts-node/register + * + * To specify test: + * > mocha test/prelude/maybe.ts --require ts-node/register -g 'test name' + */ + +import * as assert from 'assert'; +import { just, nothing } from '../../src/prelude/maybe'; + +describe('just', () => { + it('has a value', () => { + assert.deepStrictEqual(just(3).isJust(), true); + }); + + it('has the inverse called get', () => { + assert.deepStrictEqual(just(3).get(), 3); + }); +}); + +describe('nothing', () => { + it('has no value', () => { + assert.deepStrictEqual(nothing().isJust(), false); + }); +}); From b299988bb5472210de291a96627bc9b57d474684 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Wed, 6 Feb 2019 13:52:32 +0900 Subject: [PATCH 3/4] Simplify comment (#4164) --- src/misc/logger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc/logger.ts b/src/misc/logger.ts index 609c25584..7b669c3bb 100644 --- a/src/misc/logger.ts +++ b/src/misc/logger.ts @@ -45,7 +45,7 @@ export default class Logger { this.log(important ? chalk.bgGreen.white('DONE') : chalk.green('DONE'), chalk.green(message), important); } - public debug(message: string, important = false): void { // デバッグ用に使う(開発者にとっては必要だが利用者にとっては不要な情報) + public debug(message: string, important = false): void { // デバッグ用に使う(開発者に必要だが利用者に不要な情報) if (process.env.NODE_ENV != 'production' || program.verbose) { this.log(chalk.gray('VERB'), chalk.gray(message), important); } From 5e0bdd8a783851a268569a5d4bf413a799f2eb28 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 6 Feb 2019 13:56:00 +0900 Subject: [PATCH 4/4] New Crowdin translations (#4147) * New translations ja-JP.yml (Catalan) * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (English) * New translations ja-JP.yml (French) * New translations ja-JP.yml (German) * New translations ja-JP.yml (Italian) * New translations ja-JP.yml (Korean) * New translations ja-JP.yml (Polish) * New translations ja-JP.yml (Portuguese) * New translations ja-JP.yml (Russian) * New translations ja-JP.yml (Spanish) * New translations ja-JP.yml (Japanese, Kansai) * New translations ja-JP.yml (Dutch) * New translations ja-JP.yml (Norwegian) * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (English) --- locales/ca-ES.yml | 3 +++ locales/de-DE.yml | 3 +++ locales/en-US.yml | 3 +++ locales/es-ES.yml | 3 +++ locales/fr-FR.yml | 3 +++ locales/it-IT.yml | 3 +++ locales/ja-KS.yml | 3 +++ locales/ko-KR.yml | 3 +++ locales/nl-NL.yml | 3 +++ locales/no-NO.yml | 3 +++ locales/pl-PL.yml | 3 +++ locales/pt-PT.yml | 3 +++ locales/ru-RU.yml | 3 +++ locales/zh-CN.yml | 3 +++ 14 files changed, 42 insertions(+) diff --git a/locales/ca-ES.yml b/locales/ca-ES.yml index 1440ed4f2..7a8ad1376 100644 --- a/locales/ca-ES.yml +++ b/locales/ca-ES.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "メールアドレス" email-verified: "メールアドレスが確認されました" email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "ユーザー" rename: "リスト名を変更" diff --git a/locales/de-DE.yml b/locales/de-DE.yml index a66c3f2bb..b0f713045 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "メールアドレス" email-verified: "メールアドレスが確認されました" email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "ユーザー" rename: "リスト名を変更" diff --git a/locales/en-US.yml b/locales/en-US.yml index be4933f92..46af233c0 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "Email Address" email-verified: "Your email has been verified." email-not-verified: "Email address is not confirmed. Please check your inbox." + export: "Export" + export-notes: "Export all of your Notes" + export-requested: "You have requested an export. This may take a while. After the export is complete, the resulting file will be added to the drive." common/views/components/user-list-editor.vue: users: "User" rename: "Rename list" diff --git a/locales/es-ES.yml b/locales/es-ES.yml index b97b0c728..2fbff4798 100644 --- a/locales/es-ES.yml +++ b/locales/es-ES.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "Correo electrónico" email-verified: "メールアドレスが確認されました" email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "Usuarios" rename: "リスト名を変更" diff --git a/locales/fr-FR.yml b/locales/fr-FR.yml index 19ae86139..0f63e523a 100644 --- a/locales/fr-FR.yml +++ b/locales/fr-FR.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "Adresse de courrier électronique" email-verified: "L’adresse du courrier électronique a été vérifiée." email-not-verified: "Adresse de courriel n’est pas confirmée. Veuillez vérifier votre boite de réception." + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "Utilisateur·rice" rename: "Renommer la liste" diff --git a/locales/it-IT.yml b/locales/it-IT.yml index 55efd0819..d06a7aa4d 100644 --- a/locales/it-IT.yml +++ b/locales/it-IT.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "メールアドレス" email-verified: "メールアドレスが確認されました" email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "ユーザー" rename: "リスト名を変更" diff --git a/locales/ja-KS.yml b/locales/ja-KS.yml index 300ba98a7..af61e29f1 100644 --- a/locales/ja-KS.yml +++ b/locales/ja-KS.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "メールアドレス" email-verified: "このメールアドレスOKや!" email-not-verified: "メールアドレスが確認されとらん。メールボックスもっぺん見てくれへん?" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "ユーザー" rename: "リスト名を変更" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index a5016804b..8c99c8170 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "메일 주소" email-verified: "매일 주소가 확인되었습니다" email-not-verified: "메일 주소가 확인되지 않았습니다. 받은 편지함을 확인하여 주시기 바랍니다." + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "사용자" rename: "리스트 이름 바꾸기" diff --git a/locales/nl-NL.yml b/locales/nl-NL.yml index 5a8964114..ea042a101 100644 --- a/locales/nl-NL.yml +++ b/locales/nl-NL.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "メールアドレス" email-verified: "メールアドレスが確認されました" email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "ユーザー" rename: "リスト名を変更" diff --git a/locales/no-NO.yml b/locales/no-NO.yml index 7c2d5ff4c..25f4bfcc9 100644 --- a/locales/no-NO.yml +++ b/locales/no-NO.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "メールアドレス" email-verified: "メールアドレスが確認されました" email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "ユーザー" rename: "リスト名を変更" diff --git a/locales/pl-PL.yml b/locales/pl-PL.yml index 4e9995185..ebfcb80e8 100644 --- a/locales/pl-PL.yml +++ b/locales/pl-PL.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "Adres e-mail" email-verified: "Twój adres e-mail został zweryfikowany." email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "Użytkownicy" rename: "Zmień nazwę listy" diff --git a/locales/pt-PT.yml b/locales/pt-PT.yml index 185adca2f..e5c2d0bea 100644 --- a/locales/pt-PT.yml +++ b/locales/pt-PT.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "メールアドレス" email-verified: "メールアドレスが確認されました" email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "ユーザー" rename: "リスト名を変更" diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml index 2a695ed0a..02c7540d6 100644 --- a/locales/ru-RU.yml +++ b/locales/ru-RU.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "メールアドレス" email-verified: "メールアドレスが確認されました" email-not-verified: "メールアドレスが確認されていません。メールボックスをご確認ください。" + export: "エクスポート" + export-notes: "すべての投稿のエクスポート" + export-requested: "エクスポートをリクエストしました。これには時間がかかる場合があります。エクスポートが終わると、ドライブにファイルが追加されます。" common/views/components/user-list-editor.vue: users: "ユーザー" rename: "リスト名を変更" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index cc3345bca..c2c6534b3 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -509,6 +509,9 @@ common/views/components/profile-editor.vue: email-address: "电子邮件地址" email-verified: "电子邮件地址已验证" email-not-verified: "邮件地址尚未验证。 请检查您的邮箱。" + export: "导出" + export-notes: "导出所有帖子" + export-requested: "导出请求已提交。可能需要花一些时间。导出的文件将保存到网盘中。" common/views/components/user-list-editor.vue: users: "用户" rename: "重命名列表"