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: "重命名列表" 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; } 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); } 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); + }); +});