From 6d4526576307d2ff62b3e512f2b9ce6cc9ffa3ab Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 29 Apr 2019 17:38:31 +0900 Subject: [PATCH 01/11] Use bigint --- src/models/entities/instance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/entities/instance.ts b/src/models/entities/instance.ts index 977054263..52c5215f1 100644 --- a/src/models/entities/instance.ts +++ b/src/models/entities/instance.ts @@ -71,7 +71,7 @@ export class Instance { /** * ドライブ使用量 */ - @Column('integer', { + @Column('bigint', { default: 0, }) public driveUsage: number; From a60d83b101d2ecbbe3499ab65b06e434ef23631d Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 29 Apr 2019 18:15:12 +0900 Subject: [PATCH 02/11] Fix ogp --- src/server/web/views/base.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/web/views/base.pug b/src/server/web/views/base.pug index e61d29685..733a306d5 100644 --- a/src/server/web/views/base.pug +++ b/src/server/web/views/base.pug @@ -11,7 +11,7 @@ html meta(name='application-name' content='Misskey') meta(name='referrer' content='origin') meta(name='theme-color' content='#105779') - meta(property='og:site_name' content= title || 'Misskey') + meta(property='og:site_name' content= instanceName || 'Misskey') link(rel='icon' href= icon || '/favicon.ico') link(rel='manifest' href='/manifest.json') From 2e8e5c2751aba86a03c564dc7aa2dc7e595caac5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 06:40:02 +0900 Subject: [PATCH 03/11] Improve MisskeyPages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ifブロック を追加 * ボタンやスイッチなどのテキストに変数使えるようにした --- locales/ja-JP.yml | 4 + .../page-editor.el.button.vue} | 4 +- .../page-editor/els/page-editor.el.if.vue | 113 ++++++++++++++++++ .../page-editor.el.image.vue} | 6 +- .../page-editor.el.input.vue} | 4 +- .../page-editor.el.section.vue} | 29 ++--- .../page-editor.el.switch.vue} | 4 +- .../page-editor.el.text.vue} | 4 +- .../page-editor/page-editor.block.vue | 22 ++-- .../components/page-editor/page-editor.vue | 62 ++++++---- .../common/views/pages/page/page.block.vue | 3 +- .../common/views/pages/page/page.button.vue | 2 +- .../app/common/views/pages/page/page.if.vue | 30 +++++ .../common/views/pages/page/page.input.vue | 2 +- .../common/views/pages/page/page.switch.vue | 2 +- .../app/common/views/pages/page/page.vue | 1 + 16 files changed, 227 insertions(+), 65 deletions(-) rename src/client/app/common/views/components/page-editor/{page-editor.button.vue => els/page-editor.el.button.vue} (93%) create mode 100644 src/client/app/common/views/components/page-editor/els/page-editor.el.if.vue rename src/client/app/common/views/components/page-editor/{page-editor.image.vue => els/page-editor.el.image.vue} (89%) rename src/client/app/common/views/components/page-editor/{page-editor.input.vue => els/page-editor.el.input.vue} (94%) rename src/client/app/common/views/components/page-editor/{page-editor.section.vue => els/page-editor.el.section.vue} (80%) rename src/client/app/common/views/components/page-editor/{page-editor.switch.vue => els/page-editor.el.switch.vue} (91%) rename src/client/app/common/views/components/page-editor/{page-editor.text.vue => els/page-editor.el.text.vue} (90%) create mode 100644 src/client/app/common/views/pages/page/page.if.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e2bfb2e89..343d9cfc3 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1842,6 +1842,7 @@ dev/views/new-app.vue: pages: new-page: "ページの作成" edit-page: "ページの編集" + read-page: "ソースを表示中" page-created: "ページを作成しました" page-updated: "ページを更新しました" are-you-sure-delete: "このページを削除しますか?" @@ -1871,6 +1872,9 @@ pages: section: "セクション" image: "画像" button: "ボタン" + if: "もし" + _if: + variable: "変数" input: "ユーザー入力" _input: name: "変数名" diff --git a/src/client/app/common/views/components/page-editor/page-editor.button.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue similarity index 93% rename from src/client/app/common/views/components/page-editor/page-editor.button.vue rename to src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue index d5fc24381..3e2d3fe19 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.button.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue @@ -16,9 +16,9 @@ + + diff --git a/src/client/app/common/views/components/page-editor/page-editor.image.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.image.vue similarity index 89% rename from src/client/app/common/views/components/page-editor/page-editor.image.vue rename to src/client/app/common/views/components/page-editor/els/page-editor.el.image.vue index 0bc1816e8..5ada8c77b 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.image.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.image.vue @@ -15,11 +15,11 @@ 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 8b2582851..f39985952 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 @@ -2,16 +2,16 @@
-
{{ pageId ? $t('edit-page') : $t('new-page') }}
+
{{ readonly ? $t('read-page') : pageId ? $t('edit-page') : $t('new-page') }}
- + - +
- {{ $t('view-page') }} + {{ $t('view-page') }} {{ $t('title') }} @@ -23,7 +23,7 @@ - + {{ $t('url') }} @@ -45,10 +45,10 @@
- +
- +
@@ -70,7 +70,7 @@
- + {{ $t('more-details') }} @@ -106,11 +106,17 @@ export default Vue.extend({ page: { type: String, required: false - } + }, + readonly: { + type: Boolean, + required: false, + default: false + }, }, data() { return { + author: this.$store.state.i, pageId: null, currentName: null, title: '', @@ -157,6 +163,7 @@ export default Vue.extend({ this.$root.api('pages/show', { pageId: this.page, }).then(page => { + this.author = page.user; this.pageId = page.id; this.title = page.title; this.name = page.name; @@ -180,7 +187,9 @@ export default Vue.extend({ provide() { return { - getScriptBlockList: this.getScriptBlockList + readonly: this.readonly, + getScriptBlockList: this.getScriptBlockList, + getPageBlockList: this.getPageBlockList } }, @@ -250,19 +259,7 @@ export default Vue.extend({ type: null, title: this.$t('choose-block'), select: { - items: [{ - value: 'section', text: this.$t('blocks.section') - }, { - value: 'text', text: this.$t('blocks.text') - }, { - value: 'image', text: this.$t('blocks.image') - }, { - value: 'button', text: this.$t('blocks.button') - }, { - value: 'input', text: this.$t('blocks.input') - }, { - value: 'switch', text: this.$t('blocks.switch') - }] + items: this.getPageBlockList() }, showCancelButton: true }); @@ -324,6 +321,24 @@ export default Vue.extend({ this.variables = newValue; }, + getPageBlockList() { + return [{ + value: 'section', text: this.$t('blocks.section') + }, { + value: 'text', text: this.$t('blocks.text') + }, { + value: 'image', text: this.$t('blocks.image') + }, { + value: 'button', text: this.$t('blocks.button') + }, { + value: 'input', text: this.$t('blocks.input') + }, { + value: 'switch', text: this.$t('blocks.switch') + }, { + value: 'if', text: this.$t('blocks.if') + }]; + }, + getScriptBlockList(type: string = null) { const list = []; @@ -436,6 +451,7 @@ export default Vue.extend({ > .view display inline-block margin 16px 0 0 0 + font-size 14px > .content margin-bottom 16px diff --git a/src/client/app/common/views/pages/page/page.block.vue b/src/client/app/common/views/pages/page/page.block.vue index 48a89f9de..e3a758ed4 100644 --- a/src/client/app/common/views/pages/page/page.block.vue +++ b/src/client/app/common/views/pages/page/page.block.vue @@ -10,10 +10,11 @@ import XImage from './page.image.vue'; import XButton from './page.button.vue'; import XInput from './page.input.vue'; import XSwitch from './page.switch.vue'; +import XIf from './page.if.vue'; export default Vue.extend({ components: { - XText, XSection, XImage, XButton, XInput, XSwitch + XText, XSection, XImage, XButton, XInput, XSwitch, XIf }, props: { diff --git a/src/client/app/common/views/pages/page/page.button.vue b/src/client/app/common/views/pages/page/page.button.vue index 5063d2712..b77d856d5 100644 --- a/src/client/app/common/views/pages/page/page.button.vue +++ b/src/client/app/common/views/pages/page/page.button.vue @@ -1,6 +1,6 @@ diff --git a/src/client/app/common/views/pages/page/page.if.vue b/src/client/app/common/views/pages/page/page.if.vue new file mode 100644 index 000000000..9dbeaf64f --- /dev/null +++ b/src/client/app/common/views/pages/page/page.if.vue @@ -0,0 +1,30 @@ + + + diff --git a/src/client/app/common/views/pages/page/page.input.vue b/src/client/app/common/views/pages/page/page.input.vue index cda555033..9f4cfd91f 100644 --- a/src/client/app/common/views/pages/page/page.input.vue +++ b/src/client/app/common/views/pages/page/page.input.vue @@ -1,6 +1,6 @@ diff --git a/src/client/app/common/views/pages/page/page.switch.vue b/src/client/app/common/views/pages/page/page.switch.vue index 962ab84bb..d36ecbfba 100644 --- a/src/client/app/common/views/pages/page/page.switch.vue +++ b/src/client/app/common/views/pages/page/page.switch.vue @@ -1,6 +1,6 @@ diff --git a/src/client/app/common/views/pages/page/page.vue b/src/client/app/common/views/pages/page/page.vue index e7e8f76d5..7cbd3ed81 100644 --- a/src/client/app/common/views/pages/page/page.vue +++ b/src/client/app/common/views/pages/page/page.vue @@ -38,6 +38,7 @@ class Script { } public interpolate(str: string) { + if (str == null) return null; return str.replace(/\{(.+?)\}/g, match => { const v = this.vars.find(x => x.name === match.slice(1, -1).trim()).value; return v == null ? 'NULL' : v.toString(); From a3cc0ad18bb80e3615a4a0215927934529e16e90 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 07:41:57 +0900 Subject: [PATCH 04/11] :art: --- src/client/app/common/views/pages/page/page.switch.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/app/common/views/pages/page/page.switch.vue b/src/client/app/common/views/pages/page/page.switch.vue index d36ecbfba..a401e5dfb 100644 --- a/src/client/app/common/views/pages/page/page.switch.vue +++ b/src/client/app/common/views/pages/page/page.switch.vue @@ -36,4 +36,8 @@ export default Vue.extend({ .hkcxmtwj display inline-block margin 16px auto + + & + .hkcxmtwj + margin-left 16px + From da8275465921455528e3cd7ffb6c46a23f55789e Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 07:43:56 +0900 Subject: [PATCH 05/11] :art: --- src/client/app/mobile/views/pages/page.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/app/mobile/views/pages/page.vue b/src/client/app/mobile/views/pages/page.vue index 27ade4a39..f494abffd 100644 --- a/src/client/app/mobile/views/pages/page.vue +++ b/src/client/app/mobile/views/pages/page.vue @@ -33,4 +33,7 @@ main padding 16px max-width 1000px + @media (min-width 600px) + padding 32px + From c9763dabe1c7e372777af69fa1df627b469a609a Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 07:49:46 +0900 Subject: [PATCH 06/11] =?UTF-8?q?=E5=A4=89=E6=8F=9B=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 | 7 +++++++ src/client/app/common/scripts/aiscript.ts | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 343d9cfc3..463c4cbf7 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1907,6 +1907,7 @@ pages: value: "値" fn: "関数" text: "テキスト操作" + convert: "変換" blocks: text: "テキスト" multiLineText: "テキスト(複数行)" @@ -2005,6 +2006,12 @@ pages: _dailyRandomPick: arg1: "リスト" number: "数" + stringToNumber: "テキストを数値に" + _stringToNumber: + arg1: "テキスト" + numberToString: "数値をテキストに" + _numberToString: + arg1: "数値" ref: "変数" in: "入力" _in: diff --git a/src/client/app/common/scripts/aiscript.ts b/src/client/app/common/scripts/aiscript.ts index fe9a29500..98c1da921 100644 --- a/src/client/app/common/scripts/aiscript.ts +++ b/src/client/app/common/scripts/aiscript.ts @@ -26,6 +26,7 @@ import { faNotEqual, faDice, faSortNumericUp, + faExchangeAlt, } from '@fortawesome/free-solid-svg-icons'; import { faFlag } from '@fortawesome/free-regular-svg-icons'; @@ -69,6 +70,8 @@ const funcDefs = { strPick: { in: ['string', 'number'], out: 'string', category: 'text', icon: faQuoteRight, }, strReplace: { in: ['string', 'string', 'string'], out: 'string', category: 'text', icon: faQuoteRight, }, strReverse: { in: ['string'], out: 'string', category: 'text', icon: faQuoteRight, }, + stringToNumber: { in: ['string'], out: 'number', category: 'convert', icon: faExchangeAlt, }, + numberToString: { in: ['number'], out: 'string', category: 'convert', icon: faExchangeAlt, }, rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, }, random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, }, randomPick: { in: [0], out: 0, category: 'random', icon: faDice, }, @@ -421,6 +424,8 @@ export class AiScript { strPick: (a, b) => a[b - 1], strReplace: (a, b, c) => a.split(b).join(c), strReverse: (a) => a.split('').reverse().join(''), + stringToNumber: (a) => parseInt(a), + numberToString: (a) => a.toString(), random: (probability) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability, rannum: (min, max) => min + Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * (max - min + 1)), randomPick: (list) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)], From 6c647ea91c44098fa530b2653ffb4413d38d4f27 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 07:55:40 +0900 Subject: [PATCH 07/11] Improve usability --- locales/ja-JP.yml | 2 +- src/client/app/common/scripts/aiscript.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 463c4cbf7..c732f841e 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2013,7 +2013,7 @@ pages: _numberToString: arg1: "数値" ref: "変数" - in: "入力" + in: "引数" _in: arg1: "スロット番号" fn: "関数" diff --git a/src/client/app/common/scripts/aiscript.ts b/src/client/app/common/scripts/aiscript.ts index 98c1da921..50c73421e 100644 --- a/src/client/app/common/scripts/aiscript.ts +++ b/src/client/app/common/scripts/aiscript.ts @@ -73,10 +73,10 @@ const funcDefs = { stringToNumber: { in: ['string'], out: 'number', category: 'convert', icon: faExchangeAlt, }, numberToString: { in: ['number'], out: 'string', category: 'convert', icon: faExchangeAlt, }, rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, }, - random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, }, - randomPick: { in: [0], out: 0, category: 'random', icon: faDice, }, dailyRannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, }, + random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, }, dailyRandom: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, }, + randomPick: { in: [0], out: 0, category: 'random', icon: faDice, }, dailyRandomPick: { in: [0], out: 0, category: 'random', icon: faDice, }, }; From 59782973be05f8818ad22fa27f5d3b757183f33d Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 10:08:55 +0900 Subject: [PATCH 08/11] :art: --- .../views/components/page-editor/els/page-editor.el.text.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.text.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.text.vue index b6b56a29f..1d07c9157 100644 --- a/src/client/app/common/views/components/page-editor/els/page-editor.el.text.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.text.vue @@ -54,4 +54,5 @@ export default Vue.extend({ padding 16px background transparent color var(--text) + font-size 14px From 759719d1249f8f8a5644dff3abf26278c77355c7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 12:15:41 +0900 Subject: [PATCH 09/11] Improve MisskeyPages --- locales/ja-JP.yml | 35 ++++++++-- src/client/app/common/scripts/aiscript.ts | 4 +- .../app/common/scripts/collect-page-vars.ts | 16 ++++- .../page-editor/els/page-editor.el.if.vue | 2 +- .../page-editor/els/page-editor.el.input.vue | 61 ----------------- .../els/page-editor.el.number-input.vue | 42 ++++++++++++ .../page-editor/els/page-editor.el.post.vue | 44 ++++++++++++ .../els/page-editor.el.section.vue | 2 +- .../els/page-editor.el.text-input.vue | 42 ++++++++++++ .../els/page-editor.el.textarea-input.vue | 42 ++++++++++++ .../els/page-editor.el.textarea.vue | 58 ++++++++++++++++ .../page-editor/page-editor.block.vue | 8 ++- .../components/page-editor/page-editor.vue | 33 +++++---- .../common/views/pages/page/page.block.vue | 8 ++- .../{page.input.vue => page.number-input.vue} | 6 +- .../app/common/views/pages/page/page.post.vue | 68 +++++++++++++++++++ .../views/pages/page/page.text-input.vue | 41 +++++++++++ .../views/pages/page/page.textarea-input.vue | 36 ++++++++++ .../common/views/pages/page/page.textarea.vue | 33 +++++++++ .../app/common/views/pages/page/page.vue | 5 +- src/models/repositories/page.ts | 27 ++++++++ 21 files changed, 520 insertions(+), 93 deletions(-) delete mode 100644 src/client/app/common/views/components/page-editor/els/page-editor.el.input.vue create mode 100644 src/client/app/common/views/components/page-editor/els/page-editor.el.number-input.vue create mode 100644 src/client/app/common/views/components/page-editor/els/page-editor.el.post.vue create mode 100644 src/client/app/common/views/components/page-editor/els/page-editor.el.text-input.vue create mode 100644 src/client/app/common/views/components/page-editor/els/page-editor.el.textarea-input.vue create mode 100644 src/client/app/common/views/components/page-editor/els/page-editor.el.textarea.vue rename src/client/app/common/views/pages/page/{page.input.vue => page.number-input.vue} (63%) create mode 100644 src/client/app/common/views/pages/page/page.post.vue create mode 100644 src/client/app/common/views/pages/page/page.text-input.vue create mode 100644 src/client/app/common/views/pages/page/page.textarea-input.vue create mode 100644 src/client/app/common/views/pages/page/page.textarea.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c732f841e..cd29135bd 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1867,28 +1867,50 @@ pages: select-type: "種類を選択" enter-variable-name: "変数名を決めてください" the-variable-name-is-already-used: "その変数名は既に使われています" + content-blocks: "コンテンツ" + input-blocks: "入力" + special-blocks: "特殊" + post-from-post-form: "この内容を投稿" + posted-from-post-form: "投稿しました" blocks: text: "テキスト" + textarea: "テキストエリア" section: "セクション" image: "画像" button: "ボタン" + if: "もし" _if: variable: "変数" - input: "ユーザー入力" - _input: + + post: "投稿フォーム" + _post: + text: "内容" + + textInput: "テキスト入力" + _textInput: name: "変数名" text: "タイトル" default: "デフォルト値" - inputType: "入力の種類" - _inputType: - string: "テキスト" - number: "数値" + + textareaInput: "複数行テキスト入力" + _textareaInput: + name: "変数名" + text: "タイトル" + default: "デフォルト値" + + numberInput: "数値入力" + _numberInput: + name: "変数名" + text: "タイトル" + default: "デフォルト値" + switch: "スイッチ" _switch: name: "変数名" text: "タイトル" default: "デフォルト値" + _button: text: "タイトル" action: "ボタンを押したときの動作" @@ -1897,6 +1919,7 @@ pages: _dialog: content: "内容" resetRandom: "乱数をリセット" + script: categories: flow: "制御" diff --git a/src/client/app/common/scripts/aiscript.ts b/src/client/app/common/scripts/aiscript.ts index 50c73421e..99caec8c1 100644 --- a/src/client/app/common/scripts/aiscript.ts +++ b/src/client/app/common/scripts/aiscript.ts @@ -97,6 +97,7 @@ type PageVar = { name: string; value: any; type: Type; }; const envVarsDef = { AI: 'string', + URL: 'string', VERSION: 'string', LOGIN: 'boolean', NAME: 'string', @@ -120,7 +121,7 @@ export class AiScript { public static blockDefs = blockDefs; public static funcDefs = funcDefs; private opts: { - randomSeed?: string; user?: any; visitor?: any; + randomSeed?: string; user?: any; visitor?: any; page?: any; url?: string; }; constructor(variables: Variable[] = [], pageVars: PageVar[] = [], opts: AiScript['opts'] = {}) { @@ -131,6 +132,7 @@ export class AiScript { this.envVars = { AI: 'kawaii', VERSION: version, + URL: opts.page ? `${opts.url}/@${opts.page.user.username}/pages/${opts.page.name}` : '', LOGIN: opts.visitor != null, NAME: opts.visitor ? opts.visitor.name : '', USERNAME: opts.visitor ? opts.visitor.username : '', diff --git a/src/client/app/common/scripts/collect-page-vars.ts b/src/client/app/common/scripts/collect-page-vars.ts index 86687e21f..92727ce6d 100644 --- a/src/client/app/common/scripts/collect-page-vars.ts +++ b/src/client/app/common/scripts/collect-page-vars.ts @@ -2,10 +2,22 @@ export function collectPageVars(content) { const pageVars = []; const collect = (xs: any[]) => { for (const x of xs) { - if (x.type === 'input') { + if (x.type === 'textInput') { pageVars.push({ name: x.name, - type: x.inputType, + type: 'string', + value: x.default + }); + } else if (x.type === 'textareaInput') { + pageVars.push({ + name: x.name, + type: 'string', + value: x.default + }); + } else if (x.type === 'numberInput') { + pageVars.push({ + name: x.name, + type: 'number', value: x.default }); } else if (x.type === 'switch') { diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.if.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.if.vue index 46920fafd..87fc9e6fa 100644 --- a/src/client/app/common/views/components/page-editor/els/page-editor.el.if.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.if.vue @@ -72,7 +72,7 @@ export default Vue.extend({ type: null, title: this.$t('choose-block'), select: { - items: this.getPageBlockList() + groupedItems: this.getPageBlockList() }, showCancelButton: true }); diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.input.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.input.vue deleted file mode 100644 index b2bcb33c3..000000000 --- a/src/client/app/common/views/components/page-editor/els/page-editor.el.input.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - - - diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.number-input.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.number-input.vue new file mode 100644 index 000000000..aff6cf6b6 --- /dev/null +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.number-input.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.post.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.post.vue new file mode 100644 index 000000000..477d2c8ec --- /dev/null +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.post.vue @@ -0,0 +1,44 @@ + + + diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.section.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.section.vue index 6133faf66..747de481a 100644 --- a/src/client/app/common/views/components/page-editor/els/page-editor.el.section.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.section.vue @@ -84,7 +84,7 @@ export default Vue.extend({ type: null, title: this.$t('choose-block'), select: { - items: this.getPageBlockList() + groupedItems: this.getPageBlockList() }, showCancelButton: true }); diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.text-input.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.text-input.vue new file mode 100644 index 000000000..6c4783fd7 --- /dev/null +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.text-input.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.textarea-input.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.textarea-input.vue new file mode 100644 index 000000000..68edf1382 --- /dev/null +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.textarea-input.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.textarea.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.textarea.vue new file mode 100644 index 000000000..4fbe49796 --- /dev/null +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.textarea.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/client/app/common/views/components/page-editor/page-editor.block.vue b/src/client/app/common/views/components/page-editor/page-editor.block.vue index 86ee3f688..7d4505fca 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.block.vue +++ b/src/client/app/common/views/components/page-editor/page-editor.block.vue @@ -6,15 +6,19 @@ import Vue from 'vue'; import XSection from './els/page-editor.el.section.vue'; import XText from './els/page-editor.el.text.vue'; +import XTextarea from './els/page-editor.el.textarea.vue'; import XImage from './els/page-editor.el.image.vue'; import XButton from './els/page-editor.el.button.vue'; -import XInput from './els/page-editor.el.input.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 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'; export default Vue.extend({ components: { - XSection, XText, XImage, XButton, XInput, XSwitch, XIf + XSection, XText, XImage, XButton, XTextarea, XTextInput, XTextareaInput, XNumberInput, XSwitch, XIf, XPost }, props: { 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 f39985952..f8959fb0f 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 @@ -259,7 +259,7 @@ export default Vue.extend({ type: null, title: this.$t('choose-block'), select: { - items: this.getPageBlockList() + groupedItems: this.getPageBlockList() }, showCancelButton: true }); @@ -323,19 +323,28 @@ export default Vue.extend({ getPageBlockList() { return [{ - value: 'section', text: this.$t('blocks.section') + label: this.$t('content-blocks'), + items: [ + { value: 'section', text: this.$t('blocks.section') }, + { value: 'text', text: this.$t('blocks.text') }, + { value: 'image', text: this.$t('blocks.image') }, + { value: 'textarea', text: this.$t('blocks.textarea') }, + ] }, { - value: 'text', text: this.$t('blocks.text') + label: this.$t('input-blocks'), + items: [ + { value: 'button', text: this.$t('blocks.button') }, + { value: 'textInput', text: this.$t('blocks.textInput') }, + { value: 'textareaInput', text: this.$t('blocks.textareaInput') }, + { value: 'numberInput', text: this.$t('blocks.numberInput') }, + { value: 'switch', text: this.$t('blocks.switch') } + ] }, { - value: 'image', text: this.$t('blocks.image') - }, { - value: 'button', text: this.$t('blocks.button') - }, { - value: 'input', text: this.$t('blocks.input') - }, { - value: 'switch', text: this.$t('blocks.switch') - }, { - value: 'if', text: this.$t('blocks.if') + label: this.$t('special-blocks'), + items: [ + { value: 'if', text: this.$t('blocks.if') }, + { value: 'post', text: this.$t('blocks.post') } + ] }]; }, diff --git a/src/client/app/common/views/pages/page/page.block.vue b/src/client/app/common/views/pages/page/page.block.vue index e3a758ed4..f348107cc 100644 --- a/src/client/app/common/views/pages/page/page.block.vue +++ b/src/client/app/common/views/pages/page/page.block.vue @@ -8,13 +8,17 @@ import XText from './page.text.vue'; import XSection from './page.section.vue'; import XImage from './page.image.vue'; import XButton from './page.button.vue'; -import XInput from './page.input.vue'; +import XNumberInput from './page.number-input.vue'; +import XTextInput from './page.text-input.vue'; +import XTextareaInput from './page.textarea-input.vue'; import XSwitch from './page.switch.vue'; import XIf from './page.if.vue'; +import XTextarea from './page.textarea.vue'; +import XPost from './page.post.vue'; export default Vue.extend({ components: { - XText, XSection, XImage, XButton, XInput, XSwitch, XIf + XText, XSection, XImage, XButton, XNumberInput, XTextInput, XTextareaInput, XTextarea, XPost, XSwitch, XIf }, props: { diff --git a/src/client/app/common/views/pages/page/page.input.vue b/src/client/app/common/views/pages/page/page.number-input.vue similarity index 63% rename from src/client/app/common/views/pages/page/page.input.vue rename to src/client/app/common/views/pages/page/page.number-input.vue index 9f4cfd91f..51d538c36 100644 --- a/src/client/app/common/views/pages/page/page.input.vue +++ b/src/client/app/common/views/pages/page/page.number-input.vue @@ -1,6 +1,6 @@ @@ -25,9 +25,7 @@ export default Vue.extend({ watch: { v() { - let v = this.v; - if (this.value.inputType === 'number') v = parseInt(v, 10); - this.script.aiScript.updatePageVar(this.value.name, v); + this.script.aiScript.updatePageVar(this.value.name, this.v); this.script.reEval(); } } diff --git a/src/client/app/common/views/pages/page/page.post.vue b/src/client/app/common/views/pages/page/page.post.vue new file mode 100644 index 000000000..cb695e21e --- /dev/null +++ b/src/client/app/common/views/pages/page/page.post.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/client/app/common/views/pages/page/page.text-input.vue b/src/client/app/common/views/pages/page/page.text-input.vue new file mode 100644 index 000000000..3d659edd5 --- /dev/null +++ b/src/client/app/common/views/pages/page/page.text-input.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/client/app/common/views/pages/page/page.textarea-input.vue b/src/client/app/common/views/pages/page/page.textarea-input.vue new file mode 100644 index 000000000..fd8174c27 --- /dev/null +++ b/src/client/app/common/views/pages/page/page.textarea-input.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/client/app/common/views/pages/page/page.textarea.vue b/src/client/app/common/views/pages/page/page.textarea.vue new file mode 100644 index 000000000..03c8542cb --- /dev/null +++ b/src/client/app/common/views/pages/page/page.textarea.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/src/client/app/common/views/pages/page/page.vue b/src/client/app/common/views/pages/page/page.vue index 7cbd3ed81..88598d352 100644 --- a/src/client/app/common/views/pages/page/page.vue +++ b/src/client/app/common/views/pages/page/page.vue @@ -23,6 +23,7 @@ import { faSave, faStickyNote } from '@fortawesome/free-regular-svg-icons'; import XBlock from './page.block.vue'; import { AiScript } from '../../../scripts/aiscript'; import { collectPageVars } from '../../../scripts/collect-page-vars'; +import { url } from '../../../../config'; class Script { public aiScript: AiScript; @@ -82,7 +83,9 @@ export default Vue.extend({ this.script = new Script(new AiScript(this.page.variables, pageVars, { randomSeed: Math.random(), user: page.user, - visitor: this.$store.state.i + visitor: this.$store.state.i, + page: page, + url: url })); }); }, diff --git a/src/models/repositories/page.ts b/src/models/repositories/page.ts index 4c1b4cc79..cbe385568 100644 --- a/src/models/repositories/page.ts +++ b/src/models/repositories/page.ts @@ -27,6 +27,33 @@ export class PageRepository extends Repository { } }; collectFile(src.content); + + // 後方互換性のため + let migrated = false; + const migrate = (xs: any[]) => { + for (const x of xs) { + if (x.type === 'input') { + if (x.inputType === 'text') { + x.type = 'textInput'; + } + if (x.inputType === 'number') { + x.type = 'numberInput'; + if (x.default) x.default = parseInt(x.default, 10); + } + migrated = true; + } + if (x.children) { + migrate(x.children); + } + } + }; + migrate(src.content); + if (migrated) { + this.update(src.id, { + content: src.content + }); + } + return await awaitAll({ id: src.id, createdAt: src.createdAt.toISOString(), From 57444c6c3f28d1690655a159f72e5b473e2e679d Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 12:17:53 +0900 Subject: [PATCH 10/11] Update page-editor.el.post.vue --- .../views/components/page-editor/els/page-editor.el.post.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.post.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.post.vue index 477d2c8ec..a01fc57f2 100644 --- a/src/client/app/common/views/components/page-editor/els/page-editor.el.post.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.post.vue @@ -2,8 +2,8 @@ -
- +
+ {{ $t('blocks._post.text') }}
From 8ae14f146bf40f6dbc2a979911a2697dab4a4d6c Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 30 Apr 2019 12:20:59 +0900 Subject: [PATCH 11/11] 11.7.0 --- CHANGELOG.md | 14 ++++++++++++++ package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c447084e6..266525277 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,20 @@ mongodb: 8. master ブランチに戻す 9. enjoy +11.7.0 (2019/04/30) +------------------- +### Improvements +* MisskeyPagesに ifブロック を追加 +* MisskeyPagesに テキストエリア を追加 +* MisskeyPagesに 複数行テキスト入力 を追加 +* MisskeyPagesに 投稿フォーム を追加 +* MisskeyPagesに 変換系関数 を追加 +* MisskeyPagesでボタンやスイッチなどのテキストに変数使えるように + +### Fixes +* OGPのサイト名を修正 +* デザインの調整 + 11.6.0 (2019/04/29) ------------------- ### Improvements diff --git a/package.json b/package.json index 4161d89e7..3afb01dc5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "misskey", "author": "syuilo ", - "version": "11.6.0", + "version": "11.7.0", "codename": "daybreak", "repository": { "type": "git",