From 58a04ce1a54a56d12e1a1af7badf02fc924a9db6 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 5 May 2019 04:04:30 +0900 Subject: [PATCH 01/12] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E3=81=AE=E5=87=A6=E7=90=86=E3=81=A8=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=93=E3=82=B9=E9=80=A3=E6=90=BAView?= =?UTF-8?q?=E3=81=8C=E3=82=BB=E3=83=83=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=AF?= =?UTF-8?q?=E3=83=83=E3=82=AD=E3=83=BC=E3=82=92=E4=BD=9C=E3=82=89=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=20(#4856)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/common/views/components/settings/integration.vue | 6 +++++- src/client/app/store.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/app/common/views/components/settings/integration.vue b/src/client/app/common/views/components/settings/integration.vue index b91880679..8ac0c134c 100644 --- a/src/client/app/common/views/components/settings/integration.vue +++ b/src/client/app/common/views/components/settings/integration.vue @@ -54,7 +54,11 @@ export default Vue.extend({ }, mounted() { - document.cookie = `i=${this.$store.state.i.token}`; + if (!document.cookie.match(/i=(\w+)/)) { + document.cookie = `i=${this.$store.state.i.token}; path=/;` + + ` domain=${document.location.hostname}; max-age=31536000;` + + (document.location.protocol.startsWith('https') ? ' secure' : ''); + } this.$watch('$store.state.i', () => { if (this.$store.state.i.twitter) { if (this.twitterForm) this.twitterForm.close(); diff --git a/src/client/app/store.ts b/src/client/app/store.ts index a6f2a0b00..b137f7998 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -126,7 +126,7 @@ export default (os: MiOS) => new Vuex.Store({ logout(ctx) { ctx.commit('updateI', null); - document.cookie = 'i=;'; + document.cookie = `i=; max-age=0; domain=${document.location.hostname}`; localStorage.removeItem('i'); }, From 5fb0a995dd2d9cf65ed93fca78502f42a7c3e22d Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 5 May 2019 09:27:55 +0900 Subject: [PATCH 02/12] =?UTF-8?q?=E6=A7=98=E3=80=85=E3=81=AA=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20(#4859)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Typo, Redundant code, Syntax error の修正 --- locales/ja-JP.yml | 4 ++-- src/client/app/app.styl | 2 +- src/client/app/auth/views/index.vue | 2 +- src/client/app/common/hotkey.ts | 2 +- src/client/app/common/scripts/should-mute-note.ts | 6 +++--- .../app/common/views/components/analog-clock.vue | 2 +- .../app/common/views/components/messaging.vue | 2 +- .../views/components/page-editor/page-editor.vue | 4 ++-- .../common/views/components/settings/theme.vue | 2 +- .../app/common/views/components/ui/input.vue | 2 +- .../app/common/views/components/user-list.vue | 2 +- src/client/app/common/views/deck/deck.column.vue | 2 +- .../app/common/views/deck/deck.user-column.vue | 2 +- .../app/common/views/directives/autocomplete.ts | 4 ++-- src/client/app/common/views/pages/page/page.vue | 2 +- src/client/app/desktop/views/components/drive.vue | 9 +++++++-- src/client/app/desktop/views/components/notes.vue | 2 +- .../app/desktop/views/components/post-form.vue | 2 +- .../app/desktop/views/components/window.vue | 2 +- src/client/app/desktop/views/pages/welcome.vue | 2 +- src/client/app/mios.ts | 2 +- src/client/app/mobile/views/components/drive.vue | 15 ++++++++++----- src/client/app/mobile/views/components/notes.vue | 2 +- .../app/mobile/views/components/notifications.vue | 2 +- .../app/mobile/views/components/post-form.vue | 4 ++-- .../app/mobile/views/components/ui.header.vue | 2 +- src/client/app/reset.styl | 2 +- src/mfm/language.ts | 4 ++-- src/mfm/prelude.ts | 2 +- src/misc/aiscript/evaluator.ts | 2 +- src/models/repositories/user.ts | 2 +- src/server/api/endpoints/drive/files.ts | 2 +- src/server/api/endpoints/drive/stream.ts | 2 +- src/server/api/index.ts | 2 +- src/server/api/openapi/schemas.ts | 2 +- tslint.json | 2 +- webpack.config.ts | 2 +- 37 files changed, 59 insertions(+), 49 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6aac41c7d..60378df1b 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1865,8 +1865,8 @@ pages: font: "フォント" fontSerif: "セリフ" fontSansSerif: "サンセリフ" - set-eye-catchig-image: "アイキャッチ画像を設定" - remove-eye-catchig-image: "アイキャッチ画像を削除" + set-eye-catching-image: "アイキャッチ画像を設定" + remove-eye-catching-image: "アイキャッチ画像を削除" choose-block: "ブロックを追加" select-type: "種類を選択" enter-variable-name: "変数名を決めてください" diff --git a/src/client/app/app.styl b/src/client/app/app.styl index a98ece7a5..6389aa0a8 100644 --- a/src/client/app/app.styl +++ b/src/client/app/app.styl @@ -34,7 +34,7 @@ body .peg display block position absolute - right 0px + right 0 width 100px height 100% box-shadow 0 0 10px var(--primary), 0 0 5px var(--primary) diff --git a/src/client/app/auth/views/index.vue b/src/client/app/auth/views/index.vue index 9bf2acba7..ad9b1e4e3 100644 --- a/src/client/app/auth/views/index.vue +++ b/src/client/app/auth/views/index.vue @@ -98,7 +98,7 @@ export default Vue.extend({ margin 0 auto text-align center background #fff - box-shadow 0px 4px 16px rgba(#000, 0.2) + box-shadow 0 4px 16px rgba(#000, 0.2) > .fetching margin 0 diff --git a/src/client/app/common/hotkey.ts b/src/client/app/common/hotkey.ts index b2afd57ae..a53d3f479 100644 --- a/src/client/app/common/hotkey.ts +++ b/src/client/app/common/hotkey.ts @@ -52,7 +52,7 @@ function match(e: KeyboardEvent, patterns: action['patterns']): boolean { pattern.ctrl == e.ctrlKey && pattern.shift == e.shiftKey && pattern.alt == e.altKey && - e.metaKey == false + !e.metaKey ); } diff --git a/src/client/app/common/scripts/should-mute-note.ts b/src/client/app/common/scripts/should-mute-note.ts index c5f189894..8fd788862 100644 --- a/src/client/app/common/scripts/should-mute-note.ts +++ b/src/client/app/common/scripts/should-mute-note.ts @@ -11,9 +11,9 @@ export default function(me, settings, note) { return ( (!isMyNote && note.reply && includesMutedWords(note.reply.text)) || (!isMyNote && note.renote && includesMutedWords(note.renote.text)) || - (settings.showMyRenotes === false && isMyNote && isPureRenote) || - (settings.showRenotedMyNotes === false && isPureRenote && note.renote.userId == me.id) || - (settings.showLocalRenotes === false && isPureRenote && note.renote.user.host == null) || + (!settings.showMyRenotes && isMyNote && isPureRenote) || + (!settings.showRenotedMyNotes && isPureRenote && note.renote.userId == me.id) || + (!settings.showLocalRenotes && isPureRenote && note.renote.user.host == null) || (!isMyNote && includesMutedWords(note.text)) ); } diff --git a/src/client/app/common/views/components/analog-clock.vue b/src/client/app/common/views/components/analog-clock.vue index 4ba578a1a..5eb7ffd15 100644 --- a/src/client/app/common/views/components/analog-clock.vue +++ b/src/client/app/common/views/components/analog-clock.vue @@ -80,7 +80,7 @@ export default Vue.extend({ ms(): number { return this.now.getMilliseconds() * this.smooth; - } + }, s(): number { return this.now.getSeconds(); }, diff --git a/src/client/app/common/views/components/messaging.vue b/src/client/app/common/views/components/messaging.vue index 957fd389d..f884a599d 100644 --- a/src/client/app/common/views/components/messaging.vue +++ b/src/client/app/common/views/components/messaging.vue @@ -202,7 +202,7 @@ export default Vue.extend({ left 0 z-index 1 width 100% - box-shadow 0 0px 2px rgba(#000, 0.2) + box-shadow 0 0 2px rgba(#000, 0.2) > .form background rgba(0, 0, 0, 0.02) diff --git a/src/client/app/common/views/components/page-editor/page-editor.vue b/src/client/app/common/views/components/page-editor/page-editor.vue index d70049121..baccda8a4 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.vue +++ b/src/client/app/common/views/components/page-editor/page-editor.vue @@ -36,10 +36,10 @@
- {{ $t('set-eye-catchig-image') }} + {{ $t('set-eye-catching-image') }}
- {{ $t('remove-eye-catchig-image') }} + {{ $t('remove-eye-catching-image') }}
diff --git a/src/client/app/common/views/components/settings/theme.vue b/src/client/app/common/views/components/settings/theme.vue index 3440aacb2..b1f7b2bc4 100644 --- a/src/client/app/common/views/components/settings/theme.vue +++ b/src/client/app/common/views/components/settings/theme.vue @@ -273,7 +273,7 @@ export default Vue.extend({ import_() { (this.$refs.file as any).click(); - } + }, export_() { const blob = new Blob([this.selectedThemeCode], { diff --git a/src/client/app/common/views/components/ui/input.vue b/src/client/app/common/views/components/ui/input.vue index a841ecca1..dd0912f83 100644 --- a/src/client/app/common/views/components/ui/input.vue +++ b/src/client/app/common/views/components/ui/input.vue @@ -322,7 +322,7 @@ root(fill) > .value display block - width 0% + width 0 height 100% background transparent border-radius 6px diff --git a/src/client/app/common/views/components/user-list.vue b/src/client/app/common/views/components/user-list.vue index 53577bad0..6761886b0 100644 --- a/src/client/app/common/views/components/user-list.vue +++ b/src/client/app/common/views/components/user-list.vue @@ -166,7 +166,7 @@ export default Vue.extend({ > .follow-button position absolute top 8px - right 0px + right 0 > .more display block diff --git a/src/client/app/common/views/deck/deck.column.vue b/src/client/app/common/views/deck/deck.column.vue index fcf9c506b..eaa344d36 100644 --- a/src/client/app/common/views/deck/deck.column.vue +++ b/src/client/app/common/views/deck/deck.column.vue @@ -160,7 +160,7 @@ export default Vue.extend({ this.$emit('top'); } - if (this.$store.state.settings.fetchOnScroll !== false) { + if (this.$store.state.settings.fetchOnScroll) { const current = this.$refs.body.scrollTop + this.$refs.body.clientHeight; if (current > this.$refs.body.scrollHeight - 1) this.$emit('bottom'); } diff --git a/src/client/app/common/views/deck/deck.user-column.vue b/src/client/app/common/views/deck/deck.user-column.vue index fb50d880e..8d1b458a8 100644 --- a/src/client/app/common/views/deck/deck.user-column.vue +++ b/src/client/app/common/views/deck/deck.user-column.vue @@ -205,7 +205,7 @@ export default Vue.extend({ top -32px left 0 right 0 - width 0px + width 0 margin 0 auto border-top solid 16px transparent border-left solid 16px transparent diff --git a/src/client/app/common/views/directives/autocomplete.ts b/src/client/app/common/views/directives/autocomplete.ts index 7f8e409a7..40fe06c19 100644 --- a/src/client/app/common/views/directives/autocomplete.ts +++ b/src/client/app/common/views/directives/autocomplete.ts @@ -102,7 +102,7 @@ class Autocomplete { } } - if (isHashtag && opened == false) { + if (isHashtag && !opened) { const hashtag = text.substr(hashtagIndex + 1); if (!hashtag.includes(' ')) { this.open('hashtag', hashtag); @@ -110,7 +110,7 @@ class Autocomplete { } } - if (isEmoji && opened == false) { + if (isEmoji && !opened) { const emoji = text.substr(emojiIndex + 1); if (!emoji.includes(' ')) { this.open('emoji', emoji); diff --git a/src/client/app/common/views/pages/page/page.vue b/src/client/app/common/views/pages/page/page.vue index 29853f95b..29580fab6 100644 --- a/src/client/app/common/views/pages/page/page.vue +++ b/src/client/app/common/views/pages/page/page.vue @@ -47,7 +47,7 @@ class Script { public interpolate(str: string) { if (str == null) return null; - return str.replace(/\{(.+?)\}/g, match => { + return str.replace(/{(.+?)}/g, match => { const v = this.vars[match.slice(1, -1).trim()]; return v == null ? 'NULL' : v.toString(); }); diff --git a/src/client/app/desktop/views/components/drive.vue b/src/client/app/desktop/views/components/drive.vue index 48443669a..4b64d4f22 100644 --- a/src/client/app/desktop/views/components/drive.vue +++ b/src/client/app/desktop/views/components/drive.vue @@ -750,12 +750,17 @@ export default Vue.extend({ bottom 0 animation-delay -1.0s - @keyframes sk-rotate { 100% { transform: rotate(360deg); }} + @keyframes sk-rotate { + 100% { + transform: rotate(360deg); + } + } @keyframes sk-bounce { 0%, 100% { transform: scale(0.0); - } 50% { + } + 50% { transform: scale(1.0); } } diff --git a/src/client/app/desktop/views/components/notes.vue b/src/client/app/desktop/views/components/notes.vue index 87fdc749d..b051ff51c 100644 --- a/src/client/app/desktop/views/components/notes.vue +++ b/src/client/app/desktop/views/components/notes.vue @@ -180,7 +180,7 @@ export default Vue.extend({ this.releaseQueue(); } - if (this.$store.state.settings.fetchOnScroll !== false) { + if (this.$store.state.settings.fetchOnScroll) { const current = window.scrollY + window.innerHeight; if (current > document.body.offsetHeight - 8) this.fetchMore(); } diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue index 1f33ea01f..0307ff305 100644 --- a/src/client/app/desktop/views/components/post-form.vue +++ b/src/client/app/desktop/views/components/post-form.vue @@ -377,7 +377,7 @@ export default Vue.extend({ }, err => { this.$root.dialog({ type: 'error', - title: this.$t('error') + title: this.$t('error'), text: err.message }); }, { diff --git a/src/client/app/desktop/views/components/window.vue b/src/client/app/desktop/views/components/window.vue index 23ccf2886..95d9e2fef 100644 --- a/src/client/app/desktop/views/components/window.vue +++ b/src/client/app/desktop/views/components/window.vue @@ -480,7 +480,7 @@ export default Vue.extend({ &:focus &:not([data-is-modal]) > .body - box-shadow 0 0 0px 1px var(--primaryAlpha05), 0 2px 12px 0 var(--desktopWindowShadow) + box-shadow 0 0 0 1px var(--primaryAlpha05), 0 2px 12px 0 var(--desktopWindowShadow) > .handle $size = 8px diff --git a/src/client/app/desktop/views/pages/welcome.vue b/src/client/app/desktop/views/pages/welcome.vue index d7af82cd8..091377181 100644 --- a/src/client/app/desktop/views/pages/welcome.vue +++ b/src/client/app/desktop/views/pages/welcome.vue @@ -352,7 +352,7 @@ export default Vue.extend({ padding 0 16px line-height 48px background var(--faceHeader) - box-shadow 0 1px 0px rgba(0, 0, 0, 0.1) + box-shadow 0 1px 0 rgba(0, 0, 0, 0.1) & + div max-height calc(100% - 48px) diff --git a/src/client/app/mios.ts b/src/client/app/mios.ts index 3ebee3580..fb1e7e13e 100644 --- a/src/client/app/mios.ts +++ b/src/client/app/mios.ts @@ -505,7 +505,7 @@ class WindowSystem extends EventEmitter { function urlBase64ToUint8Array(base64String: string): Uint8Array { const padding = '='.repeat((4 - base64String.length % 4) % 4); const base64 = (base64String + padding) - .replace(/\-/g, '+') + .replace(/-/g, '+') .replace(/_/g, '/'); const rawData = window.atob(base64); diff --git a/src/client/app/mobile/views/components/drive.vue b/src/client/app/mobile/views/components/drive.vue index b79c0b380..2613cfff9 100644 --- a/src/client/app/mobile/views/components/drive.vue +++ b/src/client/app/mobile/views/components/drive.vue @@ -83,7 +83,7 @@ export default Vue.extend({ hierarchyFolders: [], selectedFiles: [], info: null, - connection: null + connection: null, fetching: true, fetchingMoreFiles: false, @@ -385,7 +385,7 @@ export default Vue.extend({ createFolder() { this.$root.dialog({ - title: this.$t('folder-name') + title: this.$t('folder-name'), input: { default: this.folder.name } @@ -415,7 +415,7 @@ export default Vue.extend({ return; } this.$root.dialog({ - title: this.$t('folder-name') + title: this.$t('folder-name'), input: { default: this.folder.name } @@ -597,12 +597,17 @@ export default Vue.extend({ bottom 0 animation-delay -1.0s - @keyframes sk-rotate { 100% { transform: rotate(360deg); }} + @keyframes sk-rotate { + 100% { + transform: rotate(360deg); + } + } @keyframes sk-bounce { 0%, 100% { transform: scale(0.0); - } 50% { + } + 50% { transform: scale(1.0); } } diff --git a/src/client/app/mobile/views/components/notes.vue b/src/client/app/mobile/views/components/notes.vue index 5ad80c286..047c4c271 100644 --- a/src/client/app/mobile/views/components/notes.vue +++ b/src/client/app/mobile/views/components/notes.vue @@ -174,7 +174,7 @@ export default Vue.extend({ this.releaseQueue(); } - if (this.$store.state.settings.fetchOnScroll !== false) { + if (this.$store.state.settings.fetchOnScroll) { // 親要素が display none だったら弾く // https://github.com/syuilo/misskey/issues/1569 // http://d.hatena.ne.jp/favril/20091105/1257403319 diff --git a/src/client/app/mobile/views/components/notifications.vue b/src/client/app/mobile/views/components/notifications.vue index b129ad54a..a0edab65e 100644 --- a/src/client/app/mobile/views/components/notifications.vue +++ b/src/client/app/mobile/views/components/notifications.vue @@ -115,7 +115,7 @@ export default Vue.extend({ }, onScroll() { - if (this.$store.state.settings.fetchOnScroll !== false) { + if (this.$store.state.settings.fetchOnScroll) { // 親要素が display none だったら弾く // https://github.com/syuilo/misskey/issues/1569 // http://d.hatena.ne.jp/favril/20091105/1257403319 diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue index 82cbdcc54..326ff57c1 100644 --- a/src/client/app/mobile/views/components/post-form.vue +++ b/src/client/app/mobile/views/components/post-form.vue @@ -295,7 +295,7 @@ export default Vue.extend({ }, err => { this.$root.dialog({ type: 'error', - title: this.$t('error') + title: this.$t('error'), text: err.message }); }, { @@ -341,7 +341,7 @@ export default Vue.extend({ post() { this.posting = true; - const viaMobile = this.$store.state.settings.disableViaMobile !== true; + const viaMobile = !this.$store.state.settings.disableViaMobile; this.$root.api('notes/create', { text: this.text == '' ? undefined : this.text, fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined, diff --git a/src/client/app/mobile/views/components/ui.header.vue b/src/client/app/mobile/views/components/ui.header.vue index 068679567..b636041d6 100644 --- a/src/client/app/mobile/views/components/ui.header.vue +++ b/src/client/app/mobile/views/components/ui.header.vue @@ -49,7 +49,7 @@ export default Vue.extend({ padding 0 8px &.shadow - box-shadow 0 0px 8px rgba(0, 0, 0, 0.25) + box-shadow 0 0 8px rgba(0, 0, 0, 0.25) &, * user-select none diff --git a/src/client/app/reset.styl b/src/client/app/reset.styl index 13a4eaf8d..8128f1ed2 100644 --- a/src/client/app/reset.styl +++ b/src/client/app/reset.styl @@ -1,5 +1,5 @@ input - min-width 0px + min-width 0 input:not([type]) input[type='text'] diff --git a/src/mfm/language.ts b/src/mfm/language.ts index 207400d6d..003ae348a 100644 --- a/src/mfm/language.ts +++ b/src/mfm/language.ts @@ -129,7 +129,7 @@ export const mfmLanguage = P.createLanguage({ mention: () => { return P((input, i) => { const text = input.substr(i); - const match = text.match(/^@\w([\w-]*\w)?(?:@[\w\.\-]+\w)?/); + const match = text.match(/^@\w([\w-]*\w)?(?:@[\w.\-]+\w)?/); if (!match) return P.makeFailure(i, 'not a mention'); if (input[i - 1] != null && input[i - 1].match(/[a-z0-9]/i)) return P.makeFailure(i, 'not a mention'); return P.makeSuccess(i + match[0].length, match[0]); @@ -141,7 +141,7 @@ export const mfmLanguage = P.createLanguage({ }, hashtag: () => P((input, i) => { const text = input.substr(i); - const match = text.match(/^#([^\s\.,!\?'"#:\/\[\]【】]+)/i); + const match = text.match(/^#([^\s.,!?'"#:\/\[\]【】]+)/i); if (!match) return P.makeFailure(i, 'not a hashtag'); let hashtag = match[1]; hashtag = removeOrphanedBrackets(hashtag); diff --git a/src/mfm/prelude.ts b/src/mfm/prelude.ts index 758438918..e18625bc7 100644 --- a/src/mfm/prelude.ts +++ b/src/mfm/prelude.ts @@ -36,4 +36,4 @@ export function createTree(type: string, children: MfmForest, props: any): MfmTr return T.createTree({ type, props }, children); } -export const urlRegex = /^https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.,=\+\-]+/; +export const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/; diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts index 6beb32044..78b6acf35 100644 --- a/src/misc/aiscript/evaluator.ts +++ b/src/misc/aiscript/evaluator.ts @@ -64,7 +64,7 @@ export class ASEvaluator { @autobind private interpolate(str: string, scope: Scope) { - return str.replace(/\{(.+?)\}/g, match => { + return str.replace(/{(.+?)}/g, match => { const v = scope.getState(match.slice(1, -1).trim()); return v == null ? 'NULL' : v.toString(); }); diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 68a742d35..74f2995c5 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -217,7 +217,7 @@ export class UserRepository extends Repository { } public isValidBirthday(birthday: string): boolean { - return typeof birthday == 'string' && /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday); + return typeof birthday == 'string' && /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.test(birthday); } //#endregion } diff --git a/src/server/api/endpoints/drive/files.ts b/src/server/api/endpoints/drive/files.ts index 493e14464..d10c2a3ef 100644 --- a/src/server/api/endpoints/drive/files.ts +++ b/src/server/api/endpoints/drive/files.ts @@ -37,7 +37,7 @@ export const meta = { }, type: { - validator: $.optional.str.match(/^[a-zA-Z\/\-\*]+$/) + validator: $.optional.str.match(/^[a-zA-Z\/\-*]+$/) } }, diff --git a/src/server/api/endpoints/drive/stream.ts b/src/server/api/endpoints/drive/stream.ts index db17979a4..f75c4273c 100644 --- a/src/server/api/endpoints/drive/stream.ts +++ b/src/server/api/endpoints/drive/stream.ts @@ -27,7 +27,7 @@ export const meta = { }, type: { - validator: $.optional.str.match(/^[a-zA-Z\/\-\*]+$/) + validator: $.optional.str.match(/^[a-zA-Z\/\-*]+$/) } }, diff --git a/src/server/api/index.ts b/src/server/api/index.ts index 8c2b97775..49500b2b4 100644 --- a/src/server/api/index.ts +++ b/src/server/api/index.ts @@ -52,7 +52,7 @@ for (const endpoint of endpoints) { } else { if (endpoint.name.includes('-')) { // 後方互換性のため - router.post(`/${endpoint.name.replace(/\-/g, '_')}`, handler.bind(null, endpoint)); + router.post(`/${endpoint.name.replace(/-/g, '_')}`, handler.bind(null, endpoint)); } router.post(`/${endpoint.name}`, handler.bind(null, endpoint)); } diff --git a/src/server/api/openapi/schemas.ts b/src/server/api/openapi/schemas.ts index 229d10af2..628bba511 100644 --- a/src/server/api/openapi/schemas.ts +++ b/src/server/api/openapi/schemas.ts @@ -18,7 +18,7 @@ export function convertSchemaToOpenApiSchema(schema: Schema) { const res: any = schema; if (schema.type === 'object' && schema.properties) { - res.required = Object.entries(schema.properties).filter(([k, v]) => v.optional !== true).map(([k]) => k); + res.required = Object.entries(schema.properties).filter(([k, v]) => !v.optional).map(([k]) => k); for (const k of Object.keys(schema.properties)) { res.properties[k] = convertSchemaToOpenApiSchema(schema.properties[k]); diff --git a/tslint.json b/tslint.json index 9715b09e8..733c291f3 100644 --- a/tslint.json +++ b/tslint.json @@ -34,7 +34,7 @@ "radix": false, "ban-types": [ true, - "Object" + ["Object", "Use {} instead."] ], "ban": [ true, diff --git a/webpack.config.ts b/webpack.config.ts index 54ad648bd..5ec0a60d1 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -95,7 +95,7 @@ module.exports = { loader: 'css-loader' }, postcss] }, { - test: /\.(eot|woff|woff2|svg|ttf)([\?]?.*)$/, + test: /\.(eot|woff|woff2|svg|ttf)([?]?.*)$/, loader: 'url-loader' }, { test: /\.json5$/, From 88e6929e9f737f91ea46c887c0ba7802e6c4ba9f Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 5 May 2019 09:28:24 +0900 Subject: [PATCH 03/12] =?UTF-8?q?=E5=A4=96=E9=83=A8=E3=82=B5=E3=83=BC?= =?UTF-8?q?=E3=83=93=E3=82=B9=E9=80=A3=E6=90=BA=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=83=AA=E3=83=B3=E3=82=AF=E3=81=AB=E3=82=A2=E3=82=A4?= =?UTF-8?q?=E3=82=B3=E3=83=B3=E8=BF=BD=E5=8A=A0=20(#4858)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/views/components/signin.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/app/common/views/components/signin.vue b/src/client/app/common/views/components/signin.vue index e05085cdb..671158a11 100644 --- a/src/client/app/common/views/components/signin.vue +++ b/src/client/app/common/views/components/signin.vue @@ -15,9 +15,9 @@ {{ signing ? $t('signing-in') : $t('@.signin') }} -

{{ $t('signin-with-twitter') }}

-

{{ $t('signin-with-github') }}

-

{{ $t('signin-with-discord') /* TODO: Make these layouts better */ }}

+

{{ $t('signin-with-twitter') }}

+

{{ $t('signin-with-github') }}

+

{{ $t('signin-with-discord') /* TODO: Make these layouts better */ }}

From 7d64f8abe4c4b56d30eb3a0ac9ad6267fc469332 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Sun, 5 May 2019 09:28:55 +0900 Subject: [PATCH 04/12] =?UTF-8?q?=E5=A4=96=E9=83=A8=E3=82=B5=E3=83=BC?= =?UTF-8?q?=E3=83=93=E3=82=B9=E9=80=A3=E6=90=BA=E5=BE=8C=E3=81=AEPackedUse?= =?UTF-8?q?r=E3=81=8C=E3=81=9D=E3=81=AE=E6=83=85=E5=A0=B1=E3=82=92?= =?UTF-8?q?=E6=8C=81=E3=81=A4=E3=82=88=E3=81=86=E3=81=AB=20(#4850)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/repositories/user.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 74f2995c5..0fafd3046 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -128,6 +128,19 @@ export class UserRepository extends Repository { detail: true }), twoFactorEnabled: profile!.twoFactorEnabled, + twitter: profile!.twitter ? { + id: profile!.twitterUserId, + screenName: profile!.twitterScreenName + } : null, + github: profile!.github ? { + id: profile!.githubId, + login: profile!.githubLogin + } : null, + discord: profile!.discord ? { + id: profile!.discordId, + username: profile!.discordUsername, + discriminator: profile!.discordDiscriminator + } : null, } : {}), ...(opts.detail && meId === user.id ? { From ff4f5fec1d7eee00fb2052f8f3f98a721791627f Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sun, 5 May 2019 09:29:15 +0900 Subject: [PATCH 05/12] meidg (#4835) --- src/misc/gen-id.ts | 2 ++ src/misc/id/meidg.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/misc/id/meidg.ts diff --git a/src/misc/gen-id.ts b/src/misc/gen-id.ts index 99cb70b3f..7779e2db1 100644 --- a/src/misc/gen-id.ts +++ b/src/misc/gen-id.ts @@ -1,6 +1,7 @@ import { ulid } from 'ulid'; import { genAid } from './id/aid'; import { genMeid } from './id/meid'; +import { genMeidg } from './id/meidg'; import { genObjectId } from './id/object-id'; import config from '../config'; @@ -12,6 +13,7 @@ export function genId(date?: Date): string { switch (metohd) { case 'aid': return genAid(date); case 'meid': return genMeid(date); + case 'meidg': return genMeidg(date); case 'ulid': return ulid(date.getTime()); case 'objectid': return genObjectId(date); default: throw new Error('unknown id generation method'); diff --git a/src/misc/id/meidg.ts b/src/misc/id/meidg.ts new file mode 100644 index 000000000..d4aaaea1b --- /dev/null +++ b/src/misc/id/meidg.ts @@ -0,0 +1,28 @@ +const CHARS = '0123456789abcdef'; + +// 4bit Fixed hex value 'g' +// 44bit UNIX Time ms in Hex +// 48bit Random value in Hex + +function getTime(time: number) { + if (time < 0) time = 0; + if (time === 0) { + return CHARS[0]; + } + + return time.toString(16).padStart(11, CHARS[0]); +} + +function getRandom() { + let str = ''; + + for (let i = 0; i < 12; i++) { + str += CHARS[Math.floor(Math.random() * CHARS.length)]; + } + + return str; +} + +export function genMeidg(date: Date): string { + return 'g' + getTime(date.getTime()) + getRandom(); +} From 2be13736c839d1b191f630fc6bae125d9f7b3047 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 May 2019 09:42:38 +0900 Subject: [PATCH 06/12] Update user-profile.ts #4809 --- src/models/entities/user-profile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts index 16e5d5b9e..7d990b961 100644 --- a/src/models/entities/user-profile.ts +++ b/src/models/entities/user-profile.ts @@ -26,7 +26,7 @@ export class UserProfile { public birthday: string | null; @Column('varchar', { - length: 1024, nullable: true, + length: 2048, nullable: true, comment: 'The description (bio) of the User.' }) public description: string | null; From 64aac9d6ad194daaf3c130089ad73ec5fdaa7607 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 May 2019 15:12:25 +0900 Subject: [PATCH 07/12] Fix #4862 --- .../common/views/components/page-editor/page-editor.blocks.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/common/views/components/page-editor/page-editor.blocks.vue b/src/client/app/common/views/components/page-editor/page-editor.blocks.vue index 379c960ee..c5f3419e7 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.blocks.vue +++ b/src/client/app/common/views/components/page-editor/page-editor.blocks.vue @@ -14,7 +14,7 @@ import XImage from './els/page-editor.el.image.vue'; import XButton from './els/page-editor.el.button.vue'; import XTextInput from './els/page-editor.el.text-input.vue'; import XTextareaInput from './els/page-editor.el.textarea-input.vue'; -import XNumberInput from './els/page-editor.el.text-input.vue'; +import XNumberInput from './els/page-editor.el.number-input.vue'; import XSwitch from './els/page-editor.el.switch.vue'; import XIf from './els/page-editor.el.if.vue'; import XPost from './els/page-editor.el.post.vue'; From 73641fd78dad557a4c19c4fc48de3a57ba1947a2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 May 2019 15:17:29 +0900 Subject: [PATCH 08/12] Fix #4852 --- .../app/common/views/components/page-editor/page-editor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/common/views/components/page-editor/page-editor.vue b/src/client/app/common/views/components/page-editor/page-editor.vue index baccda8a4..a3c21322a 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.vue +++ b/src/client/app/common/views/components/page-editor/page-editor.vue @@ -337,7 +337,7 @@ export default Vue.extend({ getScriptBlockList(type: string = null) { const list = []; - const blocks = blockDefs.filter(block => type === null || block.out === null || block.out === type); + const blocks = blockDefs.filter(block => type === null || block.out === null || block.out === type || typeof block.out === 'number'); for (const block of blocks) { const category = list.find(x => x.category === block.category); From 7aa66f438f4c7854fa9bacb4c15584920e41c278 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 May 2019 20:12:35 +0900 Subject: [PATCH 09/12] Resolve #4853 --- locales/ja-JP.yml | 3 +++ src/misc/aiscript/evaluator.ts | 21 +++++++++++++++++++++ src/misc/aiscript/index.ts | 1 + 3 files changed, 25 insertions(+) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 60378df1b..52e0f7f48 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2059,6 +2059,9 @@ pages: _seedRandomPick: arg1: "シード" arg2: "リスト" + dailyRPWPM: "確率付きリストからランダムに選択 (ユーザーごとに日替わり)" + _ddailyRPWPM: + arg1: "テキストのリスト" number: "数値" stringToNumber: "テキストを数値に" _stringToNumber: diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts index 78b6acf35..5e511576c 100644 --- a/src/misc/aiscript/evaluator.ts +++ b/src/misc/aiscript/evaluator.ts @@ -178,6 +178,27 @@ export class ASEvaluator { seedRandom: (seed: any, probability: number) => Math.floor(seedrandom(seed)() * 100) < probability, seedRannum: (seed: any, min: number, max: number) => min + Math.floor(seedrandom(seed)() * (max - min + 1)), seedRandomPick: (seed: any, list: any[]) => list[Math.floor(seedrandom(seed)() * list.length)], + dailyRPWPM: (list: string[]) => { + const xs = []; + let totalFactor = 0; + for (const x of list) { + const parts = x.split(' '); + const factor = parseInt(parts.pop()!, 10); + const text = parts.join(' '); + totalFactor += factor; + xs.push({ factor, text }); + } + const r = seedrandom(`${day}:${block.id}`)() * totalFactor; + let stackedFactor = 0; + for (const x of xs) { + if (r >= stackedFactor && r <= x.factor) { + return x.text; + } else { + stackedFactor += x.factor; + } + } + return xs[0].text; + }, }; const fnName = block.type; diff --git a/src/misc/aiscript/index.ts b/src/misc/aiscript/index.ts index 1ce09b7bd..61a6b7b13 100644 --- a/src/misc/aiscript/index.ts +++ b/src/misc/aiscript/index.ts @@ -81,6 +81,7 @@ export const funcDefs: Record = { From 17b373ac0737f0352b80753861f3b2e03200f8fd Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 May 2019 20:16:05 +0900 Subject: [PATCH 10/12] :v: --- locales/ja-JP.yml | 4 ++-- src/misc/aiscript/evaluator.ts | 2 +- src/misc/aiscript/index.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 52e0f7f48..e337f9383 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2059,8 +2059,8 @@ pages: _seedRandomPick: arg1: "シード" arg2: "リスト" - dailyRPWPM: "確率付きリストからランダムに選択 (ユーザーごとに日替わり)" - _ddailyRPWPM: + DRPWPM: "確率付きリストからランダムに選択 (ユーザーごとに日替わり)" + _DRPWPM: arg1: "テキストのリスト" number: "数値" stringToNumber: "テキストを数値に" diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts index 5e511576c..e28bf6414 100644 --- a/src/misc/aiscript/evaluator.ts +++ b/src/misc/aiscript/evaluator.ts @@ -178,7 +178,7 @@ export class ASEvaluator { seedRandom: (seed: any, probability: number) => Math.floor(seedrandom(seed)() * 100) < probability, seedRannum: (seed: any, min: number, max: number) => min + Math.floor(seedrandom(seed)() * (max - min + 1)), seedRandomPick: (seed: any, list: any[]) => list[Math.floor(seedrandom(seed)() * list.length)], - dailyRPWPM: (list: string[]) => { + DRPWPM: (list: string[]) => { const xs = []; let totalFactor = 0; for (const x of list) { diff --git a/src/misc/aiscript/index.ts b/src/misc/aiscript/index.ts index 61a6b7b13..46d075168 100644 --- a/src/misc/aiscript/index.ts +++ b/src/misc/aiscript/index.ts @@ -81,7 +81,7 @@ export const funcDefs: Record = { From ca2949fbb4521bffb6a4d31ea673016ffd55d65a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 May 2019 20:31:15 +0900 Subject: [PATCH 11/12] =?UTF-8?q?MisskeyPages=E3=81=AB=E3=83=AA=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=81=8B=E3=82=89=E9=81=B8=E6=8A=9E=E9=96=A2=E6=95=B0?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 5 +++++ src/misc/aiscript/evaluator.ts | 1 + src/misc/aiscript/index.ts | 2 ++ 3 files changed, 8 insertions(+) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e337f9383..c9f7436a9 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1941,6 +1941,7 @@ pages: fn: "関数" text: "テキスト操作" convert: "変換" + list: "リスト" blocks: text: "テキスト" multiLineText: "テキスト(複数行)" @@ -2062,6 +2063,10 @@ pages: DRPWPM: "確率付きリストからランダムに選択 (ユーザーごとに日替わり)" _DRPWPM: arg1: "テキストのリスト" + pick: "リストから選択" + _pick: + arg1: "リスト" + arg2: "位置" number: "数値" stringToNumber: "テキストを数値に" _stringToNumber: diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts index e28bf6414..2100b565d 100644 --- a/src/misc/aiscript/evaluator.ts +++ b/src/misc/aiscript/evaluator.ts @@ -169,6 +169,7 @@ export class ASEvaluator { stringToNumber: (a: string) => parseInt(a), numberToString: (a: number) => a.toString(), splitStrByLine: (a: string) => a.split('\n'), + pick: (list: any[], i: number) => list[i - 1], random: (probability: number) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability, rannum: (min: number, max: number) => min + Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * (max - min + 1)), randomPick: (list: any[]) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)], diff --git a/src/misc/aiscript/index.ts b/src/misc/aiscript/index.ts index 46d075168..4f66d688e 100644 --- a/src/misc/aiscript/index.ts +++ b/src/misc/aiscript/index.ts @@ -23,6 +23,7 @@ import { faSortNumericUp, faExchangeAlt, faRecycle, + faIndent, } from '@fortawesome/free-solid-svg-icons'; import { faFlag } from '@fortawesome/free-regular-svg-icons'; @@ -72,6 +73,7 @@ export const funcDefs: Record Date: Sun, 5 May 2019 20:33:29 +0900 Subject: [PATCH 12/12] 11.11.0 --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10bf40f06..6ca892ad5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,18 @@ mongodb: 8. master ブランチに戻す 9. enjoy +11.11.0 (2019/05/05) +-------------------- +### Improvements +* MisskeyPagesにリストから選択関数を追加 +* MisskeyPagesに確率を指定できるテキストランダム選択関数を追加 +* 外部サービス連携ログインリンクにアイコン追加 + +### Fixes +* MisskeyPagesでifを入れ子にできなくなっていた問題を修正 +* MisskeyPagesで数値入力を作成するとテキスト入力になる問題を修正 +* 外部サービス連携に関する問題を修正 + 11.10.1 (2019/05/04) -------------------- ### Fixes diff --git a/package.json b/package.json index a549ac4d1..9636f44b1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "misskey", "author": "syuilo ", - "version": "11.10.1", + "version": "11.11.0", "codename": "daybreak", "repository": { "type": "git",