From c60b83f0dd6febc7842612acf16fe1bc1d523987 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Dec 2017 17:50:02 +0900 Subject: Refactor --- src/api/server.ts | 7 ------- src/api/service/twitter.ts | 34 +++++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/api/server.ts b/src/api/server.ts index 026357b465..463b3f0176 100644 --- a/src/api/server.ts +++ b/src/api/server.ts @@ -49,13 +49,6 @@ endpoints.forEach(endpoint => app.post('/signup', require('./private/signup').default); app.post('/signin', require('./private/signin').default); -app.use((req, res, next) => { - // req.headers['cookie'] は常に string ですが、型定義の都合上 - // string | string[] になっているので string を明示しています - res.locals.user = ((req.headers['cookie'] as string || '').match(/i=(!\w+)/) || [null, null])[1]; - next(); -}); - require('./service/github')(app); require('./service/twitter')(app); diff --git a/src/api/service/twitter.ts b/src/api/service/twitter.ts index f164cdc458..e03cd5accb 100644 --- a/src/api/service/twitter.ts +++ b/src/api/service/twitter.ts @@ -12,15 +12,24 @@ import config from '../../conf'; import signin from '../common/signin'; module.exports = (app: express.Application) => { + function getUserToken(req) { + // req.headers['cookie'] は常に string ですが、型定義の都合上 + // string | string[] になっているので string を明示しています + return ((req.headers['cookie'] as string || '').match(/i=(!\w+)/) || [null, null])[1]; + } + app.get('/disconnect/twitter', async (req, res): Promise => { - if (res.locals.user == null) return res.send('plz signin'); + const userToken = getUserToken(req); + + if (userToken == null) return res.send('plz signin'); + const user = await User.findOneAndUpdate({ - token: res.locals.user + token: userToken }, { - $set: { - twitter: null - } - }); + $set: { + twitter: null + } + }); res.send(`Twitterの連携を解除しました :v:`); @@ -50,9 +59,10 @@ module.exports = (app: express.Application) => { }); app.get('/connect/twitter', async (req, res): Promise => { - if (res.locals.user == null) return res.send('plz signin'); + const userToken = getUserToken(req); + if (userToken == null) return res.send('plz signin'); const ctx = await twAuth.begin(); - redis.set(res.locals.user, JSON.stringify(ctx)); + redis.set(userToken, JSON.stringify(ctx)); res.redirect(ctx.url); }); @@ -77,7 +87,9 @@ module.exports = (app: express.Application) => { }); app.get('/tw/cb', (req, res): any => { - if (res.locals.user == null) { + const userToken = getUserToken(req); + + if (userToken == null) { // req.headers['cookie'] は常に string ですが、型定義の都合上 // string | string[] になっているので string を明示しています const cookies = cookie.parse((req.headers['cookie'] as string || '')); @@ -102,11 +114,11 @@ module.exports = (app: express.Application) => { signin(res, user, true); }); } else { - redis.get(res.locals.user, async (_, ctx) => { + redis.get(userToken, async (_, ctx) => { const result = await twAuth.done(JSON.parse(ctx), req.query.oauth_verifier); const user = await User.findOneAndUpdate({ - token: res.locals.user + token: userToken }, { $set: { twitter: { -- cgit v1.2.3-freya From 6f2fde0304f96089c9d6f05546ec3bbe5224a4b0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Dec 2017 18:08:28 +0900 Subject: 他のウェブサイトから直接MisskeyAPIを利用できるように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/server.ts | 4 +--- src/api/service/twitter.ts | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/api/server.ts b/src/api/server.ts index 463b3f0176..e89d196096 100644 --- a/src/api/server.ts +++ b/src/api/server.ts @@ -26,9 +26,7 @@ app.use(bodyParser.json({ } } })); -app.use(cors({ - origin: true -})); +app.use(cors()); app.get('/', (req, res) => { res.send('YEE HAW'); diff --git a/src/api/service/twitter.ts b/src/api/service/twitter.ts index e03cd5accb..573895e8fe 100644 --- a/src/api/service/twitter.ts +++ b/src/api/service/twitter.ts @@ -12,15 +12,31 @@ import config from '../../conf'; import signin from '../common/signin'; module.exports = (app: express.Application) => { - function getUserToken(req) { + function getUserToken(req: express.Request) { // req.headers['cookie'] は常に string ですが、型定義の都合上 // string | string[] になっているので string を明示しています return ((req.headers['cookie'] as string || '').match(/i=(!\w+)/) || [null, null])[1]; } + function compareOrigin(req: express.Request) { + function normalizeUrl(url: string) { + return url[url.length - 1] === '/' ? url.substr(0, url.length - 1) : url; + } + + // req.headers['cookie'] は常に string ですが、型定義の都合上 + // string | string[] になっているので string を明示しています + const referer = req.headers['referer'] as string; + + return (normalizeUrl(referer) == normalizeUrl(config.url)); + } + app.get('/disconnect/twitter', async (req, res): Promise => { - const userToken = getUserToken(req); + if (!compareOrigin(req)) { + res.status(400).send('invalid origin'); + return; + } + const userToken = getUserToken(req); if (userToken == null) return res.send('plz signin'); const user = await User.findOneAndUpdate({ @@ -59,8 +75,14 @@ module.exports = (app: express.Application) => { }); app.get('/connect/twitter', async (req, res): Promise => { + if (!compareOrigin(req)) { + res.status(400).send('invalid origin'); + return; + } + const userToken = getUserToken(req); if (userToken == null) return res.send('plz signin'); + const ctx = await twAuth.begin(); redis.set(userToken, JSON.stringify(ctx)); res.redirect(ctx.url); @@ -98,6 +120,7 @@ module.exports = (app: express.Application) => { if (sessid == undefined) { res.status(400).send('invalid session'); + return; } redis.get(sessid, async (_, ctx) => { @@ -109,13 +132,21 @@ module.exports = (app: express.Application) => { if (user == null) { res.status(404).send(`@${result.screenName}と連携しているMisskeyアカウントはありませんでした...`); + return; } signin(res, user, true); }); } else { + const verifier = req.query.oauth_verifier; + + if (verifier == null) { + res.status(400).send('invalid session'); + return; + } + redis.get(userToken, async (_, ctx) => { - const result = await twAuth.done(JSON.parse(ctx), req.query.oauth_verifier); + const result = await twAuth.done(JSON.parse(ctx), verifier); const user = await User.findOneAndUpdate({ token: userToken -- cgit v1.2.3-freya From eb0975e8393e6723f7674203c2a18f3c0589109a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Dec 2017 18:12:39 +0900 Subject: oops --- src/api/service/twitter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/service/twitter.ts b/src/api/service/twitter.ts index 573895e8fe..0e75ee0bdb 100644 --- a/src/api/service/twitter.ts +++ b/src/api/service/twitter.ts @@ -23,7 +23,7 @@ module.exports = (app: express.Application) => { return url[url.length - 1] === '/' ? url.substr(0, url.length - 1) : url; } - // req.headers['cookie'] は常に string ですが、型定義の都合上 + // req.headers['referer'] は常に string ですが、型定義の都合上 // string | string[] になっているので string を明示しています const referer = req.headers['referer'] as string; -- cgit v1.2.3-freya From e51bd95a8d5e7bd006ab2f3db67b9c3cc2cab7cf Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 10 Dec 2017 20:39:26 +0900 Subject: channel以外mk-images-viewer化・mk-images-viewer強化 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/web/app/desktop/tags/images-viewer.tag | 49 ++++++++++++++++++++-------- src/web/app/desktop/tags/post-detail-sub.tag | 6 ++-- src/web/app/desktop/tags/post-detail.tag | 7 +--- 3 files changed, 38 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/web/app/desktop/tags/images-viewer.tag b/src/web/app/desktop/tags/images-viewer.tag index 44a61cb747..3edd1300b2 100644 --- a/src/web/app/desktop/tags/images-viewer.tag +++ b/src/web/app/desktop/tags/images-viewer.tag @@ -1,32 +1,46 @@ -
{
+ + + +
+ + +
{
+ - +
\ No newline at end of file diff --git a/src/web/app/desktop/tags/post-detail-sub.tag b/src/web/app/desktop/tags/post-detail-sub.tag index e22386df91..99899929d6 100644 --- a/src/web/app/desktop/tags/post-detail-sub.tag +++ b/src/web/app/desktop/tags/post-detail-sub.tag @@ -9,7 +9,7 @@ @{ post.user.username } @@ -17,9 +17,7 @@
- - { - +
diff --git a/src/web/app/desktop/tags/post-detail.tag b/src/web/app/desktop/tags/post-detail.tag index 37f90a6ffb..23f7a41985 100644 --- a/src/web/app/desktop/tags/post-detail.tag +++ b/src/web/app/desktop/tags/post-detail.tag @@ -37,7 +37,7 @@
- { +
@@ -208,11 +208,6 @@ > mk-url-preview margin-top 8px - > .media - > img - display block - max-width 100% - > footer font-size 1.2em -- cgit v1.2.3-freya From 4da6fafe43b61c191e193b6bef985ae2c30e0f3c Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 10 Dec 2017 20:49:12 +0900 Subject: URL修正 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/web/app/desktop/tags/images-viewer.tag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/app/desktop/tags/images-viewer.tag b/src/web/app/desktop/tags/images-viewer.tag index 3edd1300b2..9fd6b8de92 100644 --- a/src/web/app/desktop/tags/images-viewer.tag +++ b/src/web/app/desktop/tags/images-viewer.tag @@ -39,7 +39,7 @@ -
{
+
{
+ + + +
+ { +
+ - - - - -
{
-
\ No newline at end of file +
-- cgit v1.2.3-freya From 1a015457fa251c1f873c8eb81400047d28500c18 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 10 Dec 2017 22:32:09 +0900 Subject: :art: --- src/web/app/desktop/tags/images-viewer.tag | 104 -------------------------- src/web/app/desktop/tags/images.tag | 100 +++++++++++++++++++++++++ src/web/app/desktop/tags/index.ts | 2 +- src/web/app/desktop/tags/post-detail-sub.tag | 2 +- src/web/app/desktop/tags/post-detail.tag | 2 +- src/web/app/desktop/tags/sub-post-content.tag | 2 +- src/web/app/desktop/tags/timeline.tag | 2 +- src/web/app/mobile/tags/images-viewer.tag | 26 ------- src/web/app/mobile/tags/images.tag | 78 +++++++++++++++++++ src/web/app/mobile/tags/index.ts | 2 +- src/web/app/mobile/tags/post-detail.tag | 2 +- src/web/app/mobile/tags/sub-post-content.tag | 2 +- src/web/app/mobile/tags/timeline.tag | 2 +- 13 files changed, 187 insertions(+), 139 deletions(-) delete mode 100644 src/web/app/desktop/tags/images-viewer.tag create mode 100644 src/web/app/desktop/tags/images.tag delete mode 100644 src/web/app/mobile/tags/images-viewer.tag create mode 100644 src/web/app/mobile/tags/images.tag (limited to 'src') diff --git a/src/web/app/desktop/tags/images-viewer.tag b/src/web/app/desktop/tags/images-viewer.tag deleted file mode 100644 index 1ad382dda8..0000000000 --- a/src/web/app/desktop/tags/images-viewer.tag +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - -
- { -
- - -
diff --git a/src/web/app/desktop/tags/images.tag b/src/web/app/desktop/tags/images.tag new file mode 100644 index 0000000000..ce67d26a9f --- /dev/null +++ b/src/web/app/desktop/tags/images.tag @@ -0,0 +1,100 @@ + + + + + + + + + + + + + diff --git a/src/web/app/desktop/tags/index.ts b/src/web/app/desktop/tags/index.ts index 3ec1d108aa..30a13b584d 100644 --- a/src/web/app/desktop/tags/index.ts +++ b/src/web/app/desktop/tags/index.ts @@ -76,7 +76,7 @@ require('./set-avatar-suggestion.tag'); require('./set-banner-suggestion.tag'); require('./repost-form.tag'); require('./sub-post-content.tag'); -require('./images-viewer.tag'); +require('./images.tag'); require('./image-dialog.tag'); require('./donation.tag'); require('./users-list.tag'); diff --git a/src/web/app/desktop/tags/post-detail-sub.tag b/src/web/app/desktop/tags/post-detail-sub.tag index ab45b55234..cccd85c474 100644 --- a/src/web/app/desktop/tags/post-detail-sub.tag +++ b/src/web/app/desktop/tags/post-detail-sub.tag @@ -17,7 +17,7 @@
- +
diff --git a/src/web/app/desktop/tags/post-detail.tag b/src/web/app/desktop/tags/post-detail.tag index 23f7a41985..47c71a6c12 100644 --- a/src/web/app/desktop/tags/post-detail.tag +++ b/src/web/app/desktop/tags/post-detail.tag @@ -37,7 +37,7 @@
- +
diff --git a/src/web/app/desktop/tags/sub-post-content.tag b/src/web/app/desktop/tags/sub-post-content.tag index 8989ff1c5b..1a81b545b6 100644 --- a/src/web/app/desktop/tags/sub-post-content.tag +++ b/src/web/app/desktop/tags/sub-post-content.tag @@ -8,7 +8,7 @@
({ post.media.length }つのメディア) - +
投票 diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag index 77e4a573b1..ed77a9e608 100644 --- a/src/web/app/desktop/tags/timeline.tag +++ b/src/web/app/desktop/tags/timeline.tag @@ -120,7 +120,7 @@ RP:
- +
%fa:quote-right -flip-h% diff --git a/src/web/app/mobile/tags/images-viewer.tag b/src/web/app/mobile/tags/images-viewer.tag deleted file mode 100644 index 8ef4a50be0..0000000000 --- a/src/web/app/mobile/tags/images-viewer.tag +++ /dev/null @@ -1,26 +0,0 @@ - -
{
- - -
diff --git a/src/web/app/mobile/tags/images.tag b/src/web/app/mobile/tags/images.tag new file mode 100644 index 0000000000..aaa80e4fd1 --- /dev/null +++ b/src/web/app/mobile/tags/images.tag @@ -0,0 +1,78 @@ + + + + + + + + + + + + + diff --git a/src/web/app/mobile/tags/index.ts b/src/web/app/mobile/tags/index.ts index 19952c20cd..fd5952ea13 100644 --- a/src/web/app/mobile/tags/index.ts +++ b/src/web/app/mobile/tags/index.ts @@ -25,7 +25,7 @@ require('./home-timeline.tag'); require('./timeline.tag'); require('./post-preview.tag'); require('./sub-post-content.tag'); -require('./images-viewer.tag'); +require('./images.tag'); require('./drive.tag'); require('./drive-selector.tag'); require('./drive-folder-selector.tag'); diff --git a/src/web/app/mobile/tags/post-detail.tag b/src/web/app/mobile/tags/post-detail.tag index 9f212a2496..1816d1bf93 100644 --- a/src/web/app/mobile/tags/post-detail.tag +++ b/src/web/app/mobile/tags/post-detail.tag @@ -34,7 +34,7 @@
- { +
diff --git a/src/web/app/mobile/tags/sub-post-content.tag b/src/web/app/mobile/tags/sub-post-content.tag index 9436b6c1d7..adeb84dea0 100644 --- a/src/web/app/mobile/tags/sub-post-content.tag +++ b/src/web/app/mobile/tags/sub-post-content.tag @@ -2,7 +2,7 @@
({ post.media.length }個のメディア) - +
%i18n:mobile.tags.mk-sub-post-content.poll% diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag index 19f90a1c11..9e85f97da3 100644 --- a/src/web/app/mobile/tags/timeline.tag +++ b/src/web/app/mobile/tags/timeline.tag @@ -172,7 +172,7 @@ RP:
- +
via { p.app.name } -- cgit v1.2.3-freya From d3e5a546d7c7a86967d1ef3cbb3b5fa6432cfa3c Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 11 Dec 2017 02:54:34 +0900 Subject: :v: --- locales/en.yml | 7 ++++-- locales/ja.yml | 9 ++++--- src/web/app/desktop/tags/settings.tag | 16 +++++++----- src/web/app/mobile/router.ts | 5 ---- src/web/app/mobile/tags/index.ts | 1 - src/web/app/mobile/tags/page/settings.tag | 1 - src/web/app/mobile/tags/page/settings/api.tag | 36 --------------------------- 7 files changed, 21 insertions(+), 54 deletions(-) delete mode 100644 src/web/app/mobile/tags/page/settings/api.tag (limited to 'src') diff --git a/locales/en.yml b/locales/en.yml index 8392e170c4..8e1dee826d 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -199,7 +199,11 @@ ch: desktop: tags: mk-api-info: - regenerate-token: "Please enter the password" + intro: "APIを利用するには、上記のトークンを「i」というキーでパラメータに付加してリクエストします。" + caution: "アカウントを不正利用される可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。" + regeneration-of-token: "万が一このトークンが漏れたりその可能性がある場合はトークンを再生成できます。" + regenerate-token: "Regenerate the token" + enter-password: "Please enter the password" mk-drive-browser-base-contextmenu: create-folder: "Create a folder" @@ -524,7 +528,6 @@ mobile: applications: "Applications" twitter-integration: "Twitter integration" signin-history: "Sign in history" - api: "API" link: "MisskeyLink" settings: "Settings" signout: "Sign out" diff --git a/locales/ja.yml b/locales/ja.yml index f9d41d9092..1497bdb6d1 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -199,7 +199,11 @@ ch: desktop: tags: mk-api-info: - regenerate-token: "パスワードを入力してください" + intro: "APIを利用するには、上記のトークンを「i」というキーでパラメータに付加してリクエストします。" + caution: "アカウントを不正利用される可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。" + regeneration-of-token: "万が一このトークンが漏れたりその可能性がある場合はトークンを再生成できます。" + regenerate-token: "トークンを再生成" + enter-password: "パスワードを入力してください" mk-drive-browser-base-contextmenu: create-folder: "フォルダーを作成" @@ -523,8 +527,7 @@ mobile: profile: "プロフィール" applications: "アプリケーション" twitter-integration: "Twitter連携" - signin-history: "ログイン履歴" - api: "API" + signin-history: "サインイン履歴" link: "Misskeyリンク" settings: "設定" signout: "サインアウト" diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag index f7ecfe3e8a..0a9a16250a 100644 --- a/src/web/app/desktop/tags/settings.tag +++ b/src/web/app/desktop/tags/settings.tag @@ -196,18 +196,22 @@ -

Token:{ I.token }

-

APIを利用するには、上記のトークンを「i」というキーでパラメータに付加してリクエストします。

-

アカウントを乗っ取られてしまう可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。

-

万が一このトークンが漏れたりその可能性がある場合はトークンを再生成できます。(副作用として、ログインしているすべてのデバイスでログアウトが発生します)

+

Token: { I.token }

+

%i18n:desktop.tags.mk-api-info.intro%

+

%fa:exclamation-triangle%%i18n:desktop.tags.mk-api-info.caution%

+

%i18n:desktop.tags.mk-api-info.regeneration-of-token%

+ - - - -

Token:{ I.token }

-

APIを利用するには、上記のトークンを「i」というキーでパラメータに付加してリクエストします。

-

アカウントを乗っ取られてしまう可能性があるため、このトークンは第三者に教えないでください(アプリなどにも入力しないでください)。

-

万が一このトークンが漏れたりその可能性がある場合はデスクトップ版Misskeyから再生成できます。

- - -
-- cgit v1.2.3-freya From 711ddc03afce1adc066cdd0704f407954d269f39 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 11 Dec 2017 02:59:05 +0900 Subject: #984 --- src/file/server.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/file/server.ts b/src/file/server.ts index 990b6ccbeb..3bda5b14fe 100644 --- a/src/file/server.ts +++ b/src/file/server.ts @@ -82,6 +82,7 @@ function thumbnail(data: stream.Readable, type: string, resize: number): ISend { const stream = g .compress('jpeg') .quality(80) + .interlace('line') .noProfile() // Remove EXIF .stream(); -- cgit v1.2.3-freya From f849dcb7b91233eaad9b679feef512bb4ad1dcd5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 11 Dec 2017 03:25:58 +0900 Subject: #983 --- locales/en.yml | 1 - locales/ja.yml | 1 - src/web/app/desktop/tags/post-form.tag | 69 ++++++++++++++---------------- src/web/app/mobile/tags/post-form.tag | 76 ++++++++++++++-------------------- 4 files changed, 60 insertions(+), 87 deletions(-) (limited to 'src') diff --git a/locales/en.yml b/locales/en.yml index 8e1dee826d..9ac9a36cd5 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -591,7 +591,6 @@ mobile: submit: "Post" reply-placeholder: "Reply to this post..." post-placeholder: "What's happening?" - attach-media-from-local: "Attach media from your device" mk-search-posts: empty: "There is no post related to the 「{}」" diff --git a/locales/ja.yml b/locales/ja.yml index 1497bdb6d1..2f95998a86 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -591,7 +591,6 @@ mobile: submit: "投稿" reply-placeholder: "この投稿への返信..." post-placeholder: "いまどうしてる?" - attach-media-from-local: "デバイスからメディアを添付" mk-search-posts: empty: "「{}」に関する投稿は見つかりませんでした。" diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag index 8e5171c83e..0b4c07906a 100644 --- a/src/web/app/desktop/tags/post-form.tag +++ b/src/web/app/desktop/tags/post-form.tag @@ -1,13 +1,12 @@
-
-
    -
  • +
    +
      +
    • -
    • %fa:plus%

    { 4 - files.length }/4

    @@ -118,8 +117,9 @@ > li display block float left - margin 4px + margin 0 padding 0 + border solid 4px transparent cursor move &:hover > .remove @@ -140,29 +140,6 @@ height 16px cursor pointer - > .add - display block - float left - margin 4px - padding 0 - border dashed 2px rgba($theme-color, 0.2) - cursor pointer - - &:hover - border-color rgba($theme-color, 0.3) - - > i - color rgba($theme-color, 0.4) - - > i - display block - width 60px - height 60px - line-height 60px - text-align center - font-size 1.2em - color rgba($theme-color, 0.2) - > mk-poll-editor background lighten($theme-color, 98%) border solid 1px rgba($theme-color, 0.1) @@ -306,6 +283,7 @@ diff --git a/src/web/app/desktop/tags/images.tag b/src/web/app/desktop/tags/images.tag index ce67d26a9f..5e4be481dc 100644 --- a/src/web/app/desktop/tags/images.tag +++ b/src/web/app/desktop/tags/images.tag @@ -53,7 +53,13 @@ - + + + +
    { + + +
    diff --git a/src/web/app/desktop/tags/index.ts b/src/web/app/desktop/tags/index.ts index 30a13b584d..4edda83534 100644 --- a/src/web/app/desktop/tags/index.ts +++ b/src/web/app/desktop/tags/index.ts @@ -77,7 +77,6 @@ require('./set-banner-suggestion.tag'); require('./repost-form.tag'); require('./sub-post-content.tag'); require('./images.tag'); -require('./image-dialog.tag'); require('./donation.tag'); require('./users-list.tag'); require('./user-following.tag'); -- cgit v1.2.3-freya From aff688d9bf7f55a6f91a9b50f2dd6809f13683a1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 14 Dec 2017 13:31:17 +0900 Subject: :v: --- docs/api/endpoints/posts/create.yaml | 53 ++++++++++++++++++++++++++++++++++++ src/api/endpoints/posts/create.ts | 4 ++- test/api.js | 34 +++++++++++++---------- 3 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 docs/api/endpoints/posts/create.yaml (limited to 'src') diff --git a/docs/api/endpoints/posts/create.yaml b/docs/api/endpoints/posts/create.yaml new file mode 100644 index 0000000000..db91775cb6 --- /dev/null +++ b/docs/api/endpoints/posts/create.yaml @@ -0,0 +1,53 @@ +endpoint: "posts/create" + +desc: + ja: "投稿します。" + en: "Compose new post." + +params: + - name: "text" + type: "string" + required: true + desc: + ja: "投稿の本文" + en: "Text of a post" + - name: "media_ids" + type: "id(DriveFile)[]" + required: false + desc: + ja: "添付するメディア" + en: "Media you want to attach" + - name: "reply_id" + type: "id(Post)" + required: false + desc: + ja: "返信する投稿" + en: "A post you want to reply" + - name: "repost_id" + type: "id(Post)" + required: false + desc: + ja: "引用する投稿" + en: "A post you want to quote" + - name: "poll" + type: "object(poll)" + required: false + desc: + ja: "投票" + en: "A poll" + +paramDefs: + poll: + - name: "choices" + type: "string[]" + required: true + desc: + ja: "投票の選択肢" + en: "Choices of a poll" + +res: + - name: "created_post" + type: "entity(Post)" + desc: + ja: "作成した投稿" + en: "A post that created" diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index ae4959dae4..7270efaf71 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -222,7 +222,9 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { const postObj = await serialize(post); // Reponse - res(postObj); + res({ + created_post: postObj + }); //#region Post processes diff --git a/test/api.js b/test/api.js index 49f1faa53a..500b9adb72 100644 --- a/test/api.js +++ b/test/api.js @@ -224,7 +224,8 @@ describe('API', () => { const res = await request('/posts/create', post, me); res.should.have.status(200); res.body.should.be.a('object'); - res.body.should.have.property('text').eql(post.text); + res.body.should.have.property('created_post'); + res.body.created_post.should.have.property('text').eql(post.text); })); it('ファイルを添付できる', async(async () => { @@ -237,7 +238,8 @@ describe('API', () => { }, me); res.should.have.status(200); res.body.should.be.a('object'); - res.body.should.have.property('media_ids').eql([file._id.toString()]); + res.body.should.have.property('created_post'); + res.body.created_post.should.have.property('media_ids').eql([file._id.toString()]); })); it('他人のファイルは添付できない', async(async () => { @@ -283,10 +285,11 @@ describe('API', () => { const res = await request('/posts/create', post, me); res.should.have.status(200); res.body.should.be.a('object'); - res.body.should.have.property('text').eql(post.text); - res.body.should.have.property('reply_id').eql(post.reply_id); - res.body.should.have.property('reply'); - res.body.reply.should.have.property('text').eql(himaPost.text); + res.body.should.have.property('created_post'); + res.body.created_post.should.have.property('text').eql(post.text); + res.body.created_post.should.have.property('reply_id').eql(post.reply_id); + res.body.created_post.should.have.property('reply'); + res.body.created_post.reply.should.have.property('text').eql(himaPost.text); })); it('repostできる', async(async () => { @@ -303,9 +306,10 @@ describe('API', () => { const res = await request('/posts/create', post, me); res.should.have.status(200); res.body.should.be.a('object'); - res.body.should.have.property('repost_id').eql(post.repost_id); - res.body.should.have.property('repost'); - res.body.repost.should.have.property('text').eql(himaPost.text); + res.body.should.have.property('created_post'); + res.body.created_post.should.have.property('repost_id').eql(post.repost_id); + res.body.created_post.should.have.property('repost'); + res.body.created_post.repost.should.have.property('text').eql(himaPost.text); })); it('引用repostできる', async(async () => { @@ -323,10 +327,11 @@ describe('API', () => { const res = await request('/posts/create', post, me); res.should.have.status(200); res.body.should.be.a('object'); - res.body.should.have.property('text').eql(post.text); - res.body.should.have.property('repost_id').eql(post.repost_id); - res.body.should.have.property('repost'); - res.body.repost.should.have.property('text').eql(himaPost.text); + res.body.should.have.property('created_post'); + res.body.created_post.should.have.property('text').eql(post.text); + res.body.created_post.should.have.property('repost_id').eql(post.repost_id); + res.body.created_post.should.have.property('repost'); + res.body.created_post.repost.should.have.property('text').eql(himaPost.text); })); it('文字数ぎりぎりで怒られない', async(async () => { @@ -395,7 +400,8 @@ describe('API', () => { }, me); res.should.have.status(200); res.body.should.be.a('object'); - res.body.should.have.property('poll'); + res.body.should.have.property('created_post'); + res.body.created_post.should.have.property('poll'); })); it('投票の選択肢が無くて怒られる', async(async () => { -- cgit v1.2.3-freya From 5166fc92b64af25946b9c5a55ee05cebca0d24fa Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 14 Dec 2017 16:24:41 +0900 Subject: :pizza: --- docs/api/endpoints/posts/create.yaml | 53 ---------- gulpfile.ts | 20 +++- package.json | 4 + src/docs/api/entities/post.pug | 149 --------------------------- src/docs/api/entities/user.pug | 122 ---------------------- src/docs/api/getting-started.md | 73 ------------- src/docs/api/library.md | 8 -- src/docs/index.md | 4 - src/docs/link-to-twitter.md | 9 -- src/docs/tou.md | 4 - src/web/app/app.styl | 38 +------ src/web/docs/api/endpoints/gulpfile.ts | 75 ++++++++++++++ src/web/docs/api/endpoints/posts/create.yaml | 54 ++++++++++ src/web/docs/api/endpoints/style.styl | 16 +++ src/web/docs/api/endpoints/view.pug | 60 +++++++++++ src/web/docs/api/entities/post.pug | 149 +++++++++++++++++++++++++++ src/web/docs/api/entities/user.pug | 122 ++++++++++++++++++++++ src/web/docs/api/getting-started.md | 73 +++++++++++++ src/web/docs/api/library.md | 8 ++ src/web/docs/index.md | 4 + src/web/docs/link-to-twitter.md | 9 ++ src/web/docs/style.styl | 69 +++++++++++++ src/web/docs/tou.md | 4 + src/web/server.ts | 6 ++ src/web/style.styl | 38 +++++++ 25 files changed, 711 insertions(+), 460 deletions(-) delete mode 100644 docs/api/endpoints/posts/create.yaml delete mode 100644 src/docs/api/entities/post.pug delete mode 100644 src/docs/api/entities/user.pug delete mode 100644 src/docs/api/getting-started.md delete mode 100644 src/docs/api/library.md delete mode 100644 src/docs/index.md delete mode 100644 src/docs/link-to-twitter.md delete mode 100644 src/docs/tou.md create mode 100644 src/web/docs/api/endpoints/gulpfile.ts create mode 100644 src/web/docs/api/endpoints/posts/create.yaml create mode 100644 src/web/docs/api/endpoints/style.styl create mode 100644 src/web/docs/api/endpoints/view.pug create mode 100644 src/web/docs/api/entities/post.pug create mode 100644 src/web/docs/api/entities/user.pug create mode 100644 src/web/docs/api/getting-started.md create mode 100644 src/web/docs/api/library.md create mode 100644 src/web/docs/index.md create mode 100644 src/web/docs/link-to-twitter.md create mode 100644 src/web/docs/style.styl create mode 100644 src/web/docs/tou.md create mode 100644 src/web/style.styl (limited to 'src') diff --git a/docs/api/endpoints/posts/create.yaml b/docs/api/endpoints/posts/create.yaml deleted file mode 100644 index db91775cb6..0000000000 --- a/docs/api/endpoints/posts/create.yaml +++ /dev/null @@ -1,53 +0,0 @@ -endpoint: "posts/create" - -desc: - ja: "投稿します。" - en: "Compose new post." - -params: - - name: "text" - type: "string" - required: true - desc: - ja: "投稿の本文" - en: "Text of a post" - - name: "media_ids" - type: "id(DriveFile)[]" - required: false - desc: - ja: "添付するメディア" - en: "Media you want to attach" - - name: "reply_id" - type: "id(Post)" - required: false - desc: - ja: "返信する投稿" - en: "A post you want to reply" - - name: "repost_id" - type: "id(Post)" - required: false - desc: - ja: "引用する投稿" - en: "A post you want to quote" - - name: "poll" - type: "object(poll)" - required: false - desc: - ja: "投票" - en: "A poll" - -paramDefs: - poll: - - name: "choices" - type: "string[]" - required: true - desc: - ja: "投票の選択肢" - en: "Choices of a poll" - -res: - - name: "created_post" - type: "entity(Post)" - desc: - ja: "作成した投稿" - en: "A post that created" diff --git a/gulpfile.ts b/gulpfile.ts index ee11a02dcb..0bc18dd7c4 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -13,6 +13,7 @@ import * as es from 'event-stream'; import cssnano = require('gulp-cssnano'); import * as uglifyComposer from 'gulp-uglify/composer'; import pug = require('gulp-pug'); +import stylus = require('gulp-stylus'); import * as rimraf from 'rimraf'; import chalk from 'chalk'; import imagemin = require('gulp-imagemin'); @@ -47,15 +48,32 @@ if (isDebug) { const constants = require('./src/const.json'); +require('./src/web/docs/api/endpoints/gulpfile.ts'); + gulp.task('build', [ 'build:js', 'build:ts', 'build:copy', - 'build:client' + 'build:client', + 'build:doc' ]); gulp.task('rebuild', ['clean', 'build']); +gulp.task('build:doc', [ + 'doc:endpoints', + 'doc:styles' +]); + +gulp.task('doc:styles', () => + gulp.src('./src/web/docs/**/*.styl') + .pipe(stylus()) + .pipe(isProduction + ? (cssnano as any)() + : gutil.noop()) + .pipe(gulp.dest('./built/web/assets/docs/')) +); + gulp.task('build:js', () => gulp.src(['./src/**/*.js', '!./src/web/**/*.js']) .pipe(gulp.dest('./built/')) diff --git a/package.json b/package.json index c20fd0c52a..69090349e1 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@types/is-root": "1.0.0", "@types/is-url": "1.2.28", "@types/js-yaml": "3.10.1", + "@types/mkdirp": "^0.5.2", "@types/mocha": "2.2.44", "@types/mongodb": "2.2.17", "@types/monk": "1.0.6", @@ -62,6 +63,7 @@ "@types/node": "8.5.1", "@types/page": "1.5.32", "@types/proxy-addr": "2.0.0", + "@types/pug": "^2.0.4", "@types/qrcode": "0.8.0", "@types/ratelimiter": "2.1.28", "@types/redis": "2.8.3", @@ -112,6 +114,7 @@ "gulp-pug": "3.3.0", "gulp-rename": "1.2.2", "gulp-replace": "0.6.1", + "gulp-stylus": "^2.6.0", "gulp-tslint": "8.1.2", "gulp-typescript": "3.2.3", "gulp-uglify": "3.0.0", @@ -122,6 +125,7 @@ "is-url": "1.2.2", "js-yaml": "3.10.0", "mecab-async": "0.1.2", + "mkdirp": "^0.5.1", "mocha": "4.0.1", "moji": "0.5.1", "mongodb": "2.2.33", diff --git a/src/docs/api/entities/post.pug b/src/docs/api/entities/post.pug deleted file mode 100644 index 954f172717..0000000000 --- a/src/docs/api/entities/post.pug +++ /dev/null @@ -1,149 +0,0 @@ -extend ../../BASE - -block title - | Entity: Post - -block content - h1 Post - p 投稿を表します。 - - section - h2 Properties - table.entity - thead: tr - td Name - td Type - td Description - tbody - tr.nullable.optional - td app - td: a(href='./app', target='_blank') App - td 投稿したアプリ - tr.nullable - td app_id - td ID - td 投稿したアプリのID - tr - td created_at - td Date - td 投稿日時 - tr - td id - td ID - td 投稿ID - tr.optional - td is_liked - td Boolean - td いいね したかどうか - tr - td likes_count - td Number - td いいね数 - tr.nullable.optional - td media_ids - td ID[] - td 添付されたメディアのIDの配列 - tr.nullable.optional - td media - td: a(href='./drive-file', target='_blank') DriveFile[] - td 添付されたメディアの配列 - tr - td replies_count - td Number - td 返信数 - tr.optional - td reply - td: a(href='./post', target='_blank') Post - td 返信先の投稿 - tr.nullable - td reply_id - td ID - td 返信先の投稿のID - tr.optional - td repost - td: a(href='./post', target='_blank') Post - td Repostした投稿 - tr - td repost_count - td Number - td Repostされた数 - tr.nullable - td repost_id - td ID - td Repostした投稿のID - tr.nullable - td text - td String - td 本文 - tr.optional - td user - td: a(href='./user', target='_blank') User - td 投稿者 - tr - td user_id - td ID - td 投稿者のID - - section - h2 Example - pre: code. - { - "created_at": "2016-12-10T00:28:50.114Z", - "media_ids": null, - "reply_id": "584a16b15860fc52320137e3", - "repost_id": null, - "text": "小日向美穂だぞ!", - "user_id": "5848bf7764e572683f4402f8", - "app_id": null, - "likes_count": 1, - "replies_count": 1, - "id": "584b4c42d8e5186f8f755d0c", - "user": { - "birthday": null, - "created_at": "2016-12-08T02:03:35.332Z", - "bio": "女が嫌いです、女性は好きです", - "followers_count": 11, - "following_count": 11, - "links": null, - "location": "", - "name": "女が嫌い", - "posts_count": 26, - "likes_count": 2, - "liked_count": 20, - "username": "onnnagakirai", - "id": "5848bf7764e572683f4402f8", - "avatar_url": "https://file.himasaku.net/5848c0ec64e572683f4402fc", - "banner_url": "https://file.himasaku.net/5848c12864e572683f4402fd", - "is_following": true, - "is_followed": true - }, - "reply": { - "created_at": "2016-12-09T02:28:01.563Z", - "media_ids": null, - "reply_id": "5849d35e547e4249be329884", - "repost_id": null, - "text": "アイコン小日向美穂?", - "user_id": "57d01a501fdf2d07be417afe", - "app_id": null, - "replies_count": 1, - "id": "584a16b15860fc52320137e3", - "user": { - "birthday": null, - "created_at": "2016-09-07T13:46:56.605Z", - "bio": "どうすれば君だけのために生きていけるの", - "followers_count": 51, - "following_count": 97, - "links": null, - "location": "川崎", - "name": "きな子", - "posts_count": 4813, - "username": "syuilo", - "likes_count": 3141, - "liked_count": 750, - "id": "57d01a501fdf2d07be417afe", - "avatar_url": "https://file.himasaku.net/583ddc6e64df272771f74c1a", - "banner_url": "https://file.himasaku.net/584bfc82d8e5186f8f755ec5" - } - }, - "is_liked": true - } diff --git a/src/docs/api/entities/user.pug b/src/docs/api/entities/user.pug deleted file mode 100644 index a37886bb19..0000000000 --- a/src/docs/api/entities/user.pug +++ /dev/null @@ -1,122 +0,0 @@ -extend ../../BASE - -block title - | Entity: User - -block content - h1 User - p ユーザーを表します。 - - section - h2 Properties - table.entity - thead: tr - td Name - td Type - td Description - tbody - tr.nullable.optional - td avatar_id - td ID - td アバターに設定しているドライブのファイルのID - tr.nullable - td avatar_url - td String - td アバターURL - tr.nullable.optional - td banner_id - td ID - td バナーに設定しているドライブのファイルのID - tr.nullable - td banner_url - td String - td バナーURL - tr.nullable - td bio - td String - td プロフィール - tr.nullable - td birthday - td String - td 誕生日(YYYY-MM-DD) - tr - td created_at - td Date - td アカウント作成日時 - tr.optional - td drive_capacity - td Number - td ドライブの最大容量(byte単位) - tr - td followers_count - td Number - td フォロワー数 - tr - td following_count - td Number - td フォロー数 - tr - td id - td ID - td ユーザーID - tr.optional - td is_bot - td Boolean - td botかどうか - tr.optional - td is_followed - td Boolean - td フォローされているか - tr.optional - td is_following - td Boolean - td フォローしているか - tr - td liked_count - td Number - td 投稿にいいねされた数 - tr - td likes_count - td Number - td 投稿にいいねした数 - tr.nullable - td location - td String - td 住処 - tr - td name - td String - td ニックネーム - tr - td posts_count - td Number - td 投稿数 - tr - td username - td String - td ユーザー名 - - section - h2 Example - pre: code. - { - "avatar_id": "583ddc6e64df272771f74c1a", - "avatar_url": "https://file.himasaku.net/583ddc6e64df272771f74c1a", - "banner_id": "584bfc82d8e5186f8f755ec5", - "banner_url": "https://file.himasaku.net/584bfc82d8e5186f8f755ec5", - "bio": "どうすれば君だけのために生きていけるの", - "birthday": "1997-12-06", - "created_at": "2016-09-07T13:46:56.605Z", - "drive_capacity": 1073741824, - "email": null, - "followers_count": 51, - "following_count": 97, - "id": "57d01a501fdf2d07be417afe", - "liked_count": 750, - "likes_count": 3130, - "links": null, - "location": "川崎", - "name": "きな子", - "posts_count": 4811, - "username": "syuilo" - } diff --git a/src/docs/api/getting-started.md b/src/docs/api/getting-started.md deleted file mode 100644 index e13659914e..0000000000 --- a/src/docs/api/getting-started.md +++ /dev/null @@ -1,73 +0,0 @@ -Getting Started -================================================================ -MisskeyはREST APIやStreaming APIを提供しており、プログラムからMisskeyの全ての機能を利用することができます。 -それらのAPIを利用するには、まずAPIを利用したいアカウントのアクセストークンを取得する必要があります: - -自分のアクセストークンを取得したい場合 ----------------------------------------------------------------- -自分自身のアクセストークンは、設定 > API で確認できます。 -

    - アカウントを乗っ取られてしまう可能性があるため、トークンは第三者に教えないでください(アプリなどにも入力しないでください)。
    - 万が一トークンが漏れたりその可能性がある場合は トークンを再生成できます。(副作用として、ログインしているすべてのデバイスでログアウトが発生します) -

    - -他人のアクセストークンを取得する ----------------------------------------------------------------- -不特定多数のユーザーからAPIを利用したい場合、アプリケーションを作成します。 -アプリケーションを作成すると、ユーザーが連携を許可した時に、そのユーザーのアクセストークンを取得することができます。 - -アプリケーションを作成してアクセストークンを取得するまでの流れを説明します。 - -### アプリケーションを作成する -まずはあなたのアプリケーションを作成しましょう。 - | デベロッパーセンターにアクセスし、アプリ > アプリ作成 に進みます。 - br - | 次に、フォームに必要事項を記入します: - dl - dt アプリケーション名 - dd あなたのアプリケーションの名前。 - dt Named ID - dd アプリを識別する/a-z-/で構成されたID。 - dt アプリの概要 - dd アプリの簡単な説明を入力してください。 - dt コールバックURL - dd あなたのアプリケーションがWebアプリケーションである場合、ユーザーが後述するフォームで認証を終えた際にリダイレクトするURLを設定できます。 - dt 権限 - dd アプリケーションが要求する権限。ここで要求した機能だけがAPIからアクセスできます。 - p.tip - | 権限はアプリ作成後も変更できますが、新たな権限を付与する場合、その時点で関連付けられているユーザーはすべて無効になります。 - p - | アプリケーションを作成すると、作ったアプリの管理ページに進みます。 - br - | アプリのシークレットキー(App Secret)が表示されていますので、メモしておいてください。 - p.tip - | アプリに成りすまされる可能性があるため、極力このシークレットキーは公開しないようにしてください。 - - section - h3 ユーザーに認証させる - p あなたのアプリを使ってもらうには、ユーザーにアカウントへアクセスすることを許可してもらい、Misskeyにそのユーザーのアクセストークンを発行してもらう必要があります。 - p 認証セッションを開始するには、#{api_url}/auth/session/generateへパラメータにapp_secretとしてApp Secretを含めたリクエストを送信します。 - p - | そうすると、レスポンスとして認証セッションのトークンや認証フォームのURLが取得できます。 - br - | この認証フォームのURLをブラウザで表示し、ユーザーにフォームを表示してください。 - section - h4 あなたのアプリがコールバックURLを設定している場合 - p ユーザーがアプリの連携を許可すると設定しているコールバックURLにtokenという名前でセッションのトークンが含まれたクエリを付けてリダイレクトします。 - section - h4 あなたのアプリがコールバックURLを設定していない場合 - p ユーザーがアプリの連携を許可したことを(何らかの方法で(たとえばボタンを押させるなど))確認出来るようにしてください。 - p - | 次に、#{api_url}/auth/session/userkeyapp_secretとしてApp Secretを、tokenとしてセッションのトークンをパラメータとして付与したリクエストを送信してください。 - br - | 上手くいけば、認証したユーザーのアクセストークンがレスポンスとして取得できます。おめでとうございます! - p - | 以降アクセストークンは、ユーザーのアクセストークン+アプリのシークレットキーをsha256したものとして扱います。 - - p アクセストークンを取得できたら、あとは簡単です。REST APIなら、リクエストにアクセストークンをiとしてパラメータに含めるだけです。 - - section - h2 リクエスト形式 - p application/jsonを受け付けます。 - p.tip - | 現在application/x-www-form-urlencodedも受け付けていますが、将来的にこのサポートはされなくなる予定です。 diff --git a/src/docs/api/library.md b/src/docs/api/library.md deleted file mode 100644 index 71ddbe345d..0000000000 --- a/src/docs/api/library.md +++ /dev/null @@ -1,8 +0,0 @@ -ライブラリ -================================================================ - -Misskey APIを便利に利用するためのライブラリ一覧です。 - -.NET ----------------------------------------------------------------- -* **[Misq (公式)](https://github.com/syuilo/Misq)** diff --git a/src/docs/index.md b/src/docs/index.md deleted file mode 100644 index 0846cf27e8..0000000000 --- a/src/docs/index.md +++ /dev/null @@ -1,4 +0,0 @@ -Misskeyについて -================================================================ - -誰か書いて diff --git a/src/docs/link-to-twitter.md b/src/docs/link-to-twitter.md deleted file mode 100644 index 77fb744576..0000000000 --- a/src/docs/link-to-twitter.md +++ /dev/null @@ -1,9 +0,0 @@ -Twitterと連携する -================================================================ - -設定 -> Twitter から、お使いのMisskeyアカウントとお使いのTwitterアカウントを関連付けることができます。 -アカウントの関連付けを行うと、プロフィールにTwitterアカウントへのリンクが表示されたりなどします。 - -MisskeyがあなたのTwitterアカウントでツイートしたり誰かをフォローしたりといったことは、 -一切行いませんのでご安心ください。(Misskeyはそのような権限を取得しないので、行おうと思っても行えません) -Twitterのアプリケーション認証フォームでこの権限の詳細を確認することができます。また、いつでも連携を取り消すことができます。 diff --git a/src/docs/tou.md b/src/docs/tou.md deleted file mode 100644 index fbf87867b4..0000000000 --- a/src/docs/tou.md +++ /dev/null @@ -1,4 +0,0 @@ -利用規約 -================================================================ - -公序良俗に反する行為はおやめください。 diff --git a/src/web/app/app.styl b/src/web/app/app.styl index de66df74d4..22043b8833 100644 --- a/src/web/app/app.styl +++ b/src/web/app/app.styl @@ -1,29 +1,4 @@ -json('../../const.json') - -@charset 'utf-8' - -$theme-color = themeColor -$theme-color-foreground = themeColorForeground - -/* - ::selection - background $theme-color - color #fff -*/ - -* - position relative - box-sizing border-box - background-clip padding-box !important - tap-highlight-color rgba($theme-color, 0.7) - -webkit-tap-highlight-color rgba($theme-color, 0.7) - -html, body - margin 0 - padding 0 - scroll-behavior smooth - text-size-adjust 100% - font-family sans-serif +@import "../style" html &.progress @@ -96,17 +71,6 @@ body 100% transform rotate(360deg) -a - text-decoration none - color $theme-color - cursor pointer - - &:hover - text-decoration underline - - * - cursor pointer - code font-family Consolas, 'Courier New', Courier, Monaco, monospace diff --git a/src/web/docs/api/endpoints/gulpfile.ts b/src/web/docs/api/endpoints/gulpfile.ts new file mode 100644 index 0000000000..a2c3944709 --- /dev/null +++ b/src/web/docs/api/endpoints/gulpfile.ts @@ -0,0 +1,75 @@ +/** + * Gulp tasks + */ + +import * as fs from 'fs'; +import * as path from 'path'; +import * as glob from 'glob'; +import * as gulp from 'gulp'; +import * as pug from 'pug'; +import * as yaml from 'js-yaml'; +import * as mkdirp from 'mkdirp'; + +import config from './../../../../conf'; + +const parseParam = param => { + const id = param.type.match(/^id\((.+?)\)/); + const object = param.type.match(/^object\((.+?)\)/); + const isArray = /\[\]$/.test(param.type); + if (id) { + param.kind = 'id'; + param.type = 'string'; + param.entity = id[1]; + if (isArray) { + param.type += '[]'; + } + } + if (object) { + param.kind = 'object'; + param.type = 'object'; + param.def = object[1]; + if (isArray) { + param.type += '[]'; + } + } + + return param; +}; + +gulp.task('doc:endpoints', () => { + glob('./src/web/docs/api/endpoints/**/*.yaml', (globErr, files) => { + if (globErr) { + console.error(globErr); + return; + } + //console.log(files); + files.forEach(file => { + const ep = yaml.safeLoad(fs.readFileSync(file, 'utf-8')); + const vars = { + endpoint: ep.endpoint, + url: `${config.api_url}/${ep.endpoint}`, + desc: ep.desc, + params: ep.params.map(p => parseParam(p)), + paramDefs: Object.keys(ep.paramDefs).map(key => ({ + name: key, + params: ep.paramDefs[key].map(p => parseParam(p)) + })), + res: ep.res.map(p => parseParam(p)) + }; + pug.renderFile('./src/web/docs/api/endpoints/view.pug', vars, (renderErr, html) => { + if (renderErr) { + console.error(renderErr); + return; + } + const htmlPath = `./built/web/docs/api/endpoints/${ep.endpoint}.html`; + mkdirp(path.dirname(htmlPath), (mkdirErr) => { + if (mkdirErr) { + console.error(mkdirErr); + return; + } + fs.writeFileSync(htmlPath, html, 'utf-8'); + }); + }); + }); + }); +}); diff --git a/src/web/docs/api/endpoints/posts/create.yaml b/src/web/docs/api/endpoints/posts/create.yaml new file mode 100644 index 0000000000..b6613038a7 --- /dev/null +++ b/src/web/docs/api/endpoints/posts/create.yaml @@ -0,0 +1,54 @@ +endpoint: "posts/create" + +desc: + ja: "投稿します。" + en: "Compose new post." + +params: + - name: "text" + type: "string" + optional: false + desc: + ja: "投稿の本文" + en: "Text of a post" + - name: "media_ids" + type: "id(DriveFile)[]" + optional: true + desc: + ja: "添付するメディア" + en: "Media you want to attach" + - name: "reply_id" + type: "id(Post)" + optional: true + desc: + ja: "返信する投稿" + en: "A post you want to reply" + - name: "repost_id" + type: "id(Post)" + optional: true + desc: + ja: "引用する投稿" + en: "A post you want to quote" + - name: "poll" + type: "object(poll)" + optional: true + desc: + ja: "投票" + en: "A poll" + +paramDefs: + poll: + - name: "choices" + type: "string[]" + optional: false + desc: + ja: "投票の選択肢" + en: "Choices of a poll" + +res: + - name: "created_post" + type: "entity(Post)" + optional: false + desc: + ja: "作成した投稿" + en: "A post that created" diff --git a/src/web/docs/api/endpoints/style.styl b/src/web/docs/api/endpoints/style.styl new file mode 100644 index 0000000000..12c06fe3af --- /dev/null +++ b/src/web/docs/api/endpoints/style.styl @@ -0,0 +1,16 @@ +@import "../../style" + +#url + padding 8px 12px + font-family Consolas, 'Courier New', Courier, Monaco, monospace + color #fff + background #222e40 + border-radius 4px + +table + .name + font-weight bold + + .type + font-family Consolas, 'Courier New', Courier, Monaco, monospace + diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug new file mode 100644 index 0000000000..d9de9cb74a --- /dev/null +++ b/src/web/docs/api/endpoints/view.pug @@ -0,0 +1,60 @@ +doctype html + +mixin i18n(xs) + each text, lang in xs + span(class=`i18n ${lang}`)= text + +mixin table(params) + table + thead: tr + th Name + th Type + th Optional + th Description + tbody + each param in params + tr + td.name= param.name + td.type + if param.kind == 'id' + | #{param.type} (ID of + = ' ' + a(href=`/docs/api/entities/${param.entity}`)= param.entity + | ) + else if param.kind == 'object' + | #{param.type} ( + a(href=`#${param.def}`)= param.def + | ) + else + = param.type + td.optional= param.optional.toString() + td.desc: +i18n(param.desc) + +html + head + meta(charset="UTF-8") + title #{endpoint} | Misskey API + link(rel="stylesheet" href="/assets/docs/api/endpoints/style.css") + + body + main + h1= endpoint + + p#url= url + + p#desc: +i18n(desc) + + section + h2 Params + +table(params) + + if paramDefs + each paramDef in paramDefs + section(id= paramDef.name) + h3= paramDef.name + +table(paramDef.params) + + section + h2 Response + +table(res) + diff --git a/src/web/docs/api/entities/post.pug b/src/web/docs/api/entities/post.pug new file mode 100644 index 0000000000..954f172717 --- /dev/null +++ b/src/web/docs/api/entities/post.pug @@ -0,0 +1,149 @@ +extend ../../BASE + +block title + | Entity: Post + +block content + h1 Post + p 投稿を表します。 + + section + h2 Properties + table.entity + thead: tr + td Name + td Type + td Description + tbody + tr.nullable.optional + td app + td: a(href='./app', target='_blank') App + td 投稿したアプリ + tr.nullable + td app_id + td ID + td 投稿したアプリのID + tr + td created_at + td Date + td 投稿日時 + tr + td id + td ID + td 投稿ID + tr.optional + td is_liked + td Boolean + td いいね したかどうか + tr + td likes_count + td Number + td いいね数 + tr.nullable.optional + td media_ids + td ID[] + td 添付されたメディアのIDの配列 + tr.nullable.optional + td media + td: a(href='./drive-file', target='_blank') DriveFile[] + td 添付されたメディアの配列 + tr + td replies_count + td Number + td 返信数 + tr.optional + td reply + td: a(href='./post', target='_blank') Post + td 返信先の投稿 + tr.nullable + td reply_id + td ID + td 返信先の投稿のID + tr.optional + td repost + td: a(href='./post', target='_blank') Post + td Repostした投稿 + tr + td repost_count + td Number + td Repostされた数 + tr.nullable + td repost_id + td ID + td Repostした投稿のID + tr.nullable + td text + td String + td 本文 + tr.optional + td user + td: a(href='./user', target='_blank') User + td 投稿者 + tr + td user_id + td ID + td 投稿者のID + + section + h2 Example + pre: code. + { + "created_at": "2016-12-10T00:28:50.114Z", + "media_ids": null, + "reply_id": "584a16b15860fc52320137e3", + "repost_id": null, + "text": "小日向美穂だぞ!", + "user_id": "5848bf7764e572683f4402f8", + "app_id": null, + "likes_count": 1, + "replies_count": 1, + "id": "584b4c42d8e5186f8f755d0c", + "user": { + "birthday": null, + "created_at": "2016-12-08T02:03:35.332Z", + "bio": "女が嫌いです、女性は好きです", + "followers_count": 11, + "following_count": 11, + "links": null, + "location": "", + "name": "女が嫌い", + "posts_count": 26, + "likes_count": 2, + "liked_count": 20, + "username": "onnnagakirai", + "id": "5848bf7764e572683f4402f8", + "avatar_url": "https://file.himasaku.net/5848c0ec64e572683f4402fc", + "banner_url": "https://file.himasaku.net/5848c12864e572683f4402fd", + "is_following": true, + "is_followed": true + }, + "reply": { + "created_at": "2016-12-09T02:28:01.563Z", + "media_ids": null, + "reply_id": "5849d35e547e4249be329884", + "repost_id": null, + "text": "アイコン小日向美穂?", + "user_id": "57d01a501fdf2d07be417afe", + "app_id": null, + "replies_count": 1, + "id": "584a16b15860fc52320137e3", + "user": { + "birthday": null, + "created_at": "2016-09-07T13:46:56.605Z", + "bio": "どうすれば君だけのために生きていけるの", + "followers_count": 51, + "following_count": 97, + "links": null, + "location": "川崎", + "name": "きな子", + "posts_count": 4813, + "username": "syuilo", + "likes_count": 3141, + "liked_count": 750, + "id": "57d01a501fdf2d07be417afe", + "avatar_url": "https://file.himasaku.net/583ddc6e64df272771f74c1a", + "banner_url": "https://file.himasaku.net/584bfc82d8e5186f8f755ec5" + } + }, + "is_liked": true + } diff --git a/src/web/docs/api/entities/user.pug b/src/web/docs/api/entities/user.pug new file mode 100644 index 0000000000..a37886bb19 --- /dev/null +++ b/src/web/docs/api/entities/user.pug @@ -0,0 +1,122 @@ +extend ../../BASE + +block title + | Entity: User + +block content + h1 User + p ユーザーを表します。 + + section + h2 Properties + table.entity + thead: tr + td Name + td Type + td Description + tbody + tr.nullable.optional + td avatar_id + td ID + td アバターに設定しているドライブのファイルのID + tr.nullable + td avatar_url + td String + td アバターURL + tr.nullable.optional + td banner_id + td ID + td バナーに設定しているドライブのファイルのID + tr.nullable + td banner_url + td String + td バナーURL + tr.nullable + td bio + td String + td プロフィール + tr.nullable + td birthday + td String + td 誕生日(YYYY-MM-DD) + tr + td created_at + td Date + td アカウント作成日時 + tr.optional + td drive_capacity + td Number + td ドライブの最大容量(byte単位) + tr + td followers_count + td Number + td フォロワー数 + tr + td following_count + td Number + td フォロー数 + tr + td id + td ID + td ユーザーID + tr.optional + td is_bot + td Boolean + td botかどうか + tr.optional + td is_followed + td Boolean + td フォローされているか + tr.optional + td is_following + td Boolean + td フォローしているか + tr + td liked_count + td Number + td 投稿にいいねされた数 + tr + td likes_count + td Number + td 投稿にいいねした数 + tr.nullable + td location + td String + td 住処 + tr + td name + td String + td ニックネーム + tr + td posts_count + td Number + td 投稿数 + tr + td username + td String + td ユーザー名 + + section + h2 Example + pre: code. + { + "avatar_id": "583ddc6e64df272771f74c1a", + "avatar_url": "https://file.himasaku.net/583ddc6e64df272771f74c1a", + "banner_id": "584bfc82d8e5186f8f755ec5", + "banner_url": "https://file.himasaku.net/584bfc82d8e5186f8f755ec5", + "bio": "どうすれば君だけのために生きていけるの", + "birthday": "1997-12-06", + "created_at": "2016-09-07T13:46:56.605Z", + "drive_capacity": 1073741824, + "email": null, + "followers_count": 51, + "following_count": 97, + "id": "57d01a501fdf2d07be417afe", + "liked_count": 750, + "likes_count": 3130, + "links": null, + "location": "川崎", + "name": "きな子", + "posts_count": 4811, + "username": "syuilo" + } diff --git a/src/web/docs/api/getting-started.md b/src/web/docs/api/getting-started.md new file mode 100644 index 0000000000..e13659914e --- /dev/null +++ b/src/web/docs/api/getting-started.md @@ -0,0 +1,73 @@ +Getting Started +================================================================ +MisskeyはREST APIやStreaming APIを提供しており、プログラムからMisskeyの全ての機能を利用することができます。 +それらのAPIを利用するには、まずAPIを利用したいアカウントのアクセストークンを取得する必要があります: + +自分のアクセストークンを取得したい場合 +---------------------------------------------------------------- +自分自身のアクセストークンは、設定 > API で確認できます。 +

    + アカウントを乗っ取られてしまう可能性があるため、トークンは第三者に教えないでください(アプリなどにも入力しないでください)。
    + 万が一トークンが漏れたりその可能性がある場合は トークンを再生成できます。(副作用として、ログインしているすべてのデバイスでログアウトが発生します) +

    + +他人のアクセストークンを取得する +---------------------------------------------------------------- +不特定多数のユーザーからAPIを利用したい場合、アプリケーションを作成します。 +アプリケーションを作成すると、ユーザーが連携を許可した時に、そのユーザーのアクセストークンを取得することができます。 + +アプリケーションを作成してアクセストークンを取得するまでの流れを説明します。 + +### アプリケーションを作成する +まずはあなたのアプリケーションを作成しましょう。 + | デベロッパーセンターにアクセスし、アプリ > アプリ作成 に進みます。 + br + | 次に、フォームに必要事項を記入します: + dl + dt アプリケーション名 + dd あなたのアプリケーションの名前。 + dt Named ID + dd アプリを識別する/a-z-/で構成されたID。 + dt アプリの概要 + dd アプリの簡単な説明を入力してください。 + dt コールバックURL + dd あなたのアプリケーションがWebアプリケーションである場合、ユーザーが後述するフォームで認証を終えた際にリダイレクトするURLを設定できます。 + dt 権限 + dd アプリケーションが要求する権限。ここで要求した機能だけがAPIからアクセスできます。 + p.tip + | 権限はアプリ作成後も変更できますが、新たな権限を付与する場合、その時点で関連付けられているユーザーはすべて無効になります。 + p + | アプリケーションを作成すると、作ったアプリの管理ページに進みます。 + br + | アプリのシークレットキー(App Secret)が表示されていますので、メモしておいてください。 + p.tip + | アプリに成りすまされる可能性があるため、極力このシークレットキーは公開しないようにしてください。 + + section + h3 ユーザーに認証させる + p あなたのアプリを使ってもらうには、ユーザーにアカウントへアクセスすることを許可してもらい、Misskeyにそのユーザーのアクセストークンを発行してもらう必要があります。 + p 認証セッションを開始するには、#{api_url}/auth/session/generateへパラメータにapp_secretとしてApp Secretを含めたリクエストを送信します。 + p + | そうすると、レスポンスとして認証セッションのトークンや認証フォームのURLが取得できます。 + br + | この認証フォームのURLをブラウザで表示し、ユーザーにフォームを表示してください。 + section + h4 あなたのアプリがコールバックURLを設定している場合 + p ユーザーがアプリの連携を許可すると設定しているコールバックURLにtokenという名前でセッションのトークンが含まれたクエリを付けてリダイレクトします。 + section + h4 あなたのアプリがコールバックURLを設定していない場合 + p ユーザーがアプリの連携を許可したことを(何らかの方法で(たとえばボタンを押させるなど))確認出来るようにしてください。 + p + | 次に、#{api_url}/auth/session/userkeyapp_secretとしてApp Secretを、tokenとしてセッションのトークンをパラメータとして付与したリクエストを送信してください。 + br + | 上手くいけば、認証したユーザーのアクセストークンがレスポンスとして取得できます。おめでとうございます! + p + | 以降アクセストークンは、ユーザーのアクセストークン+アプリのシークレットキーをsha256したものとして扱います。 + + p アクセストークンを取得できたら、あとは簡単です。REST APIなら、リクエストにアクセストークンをiとしてパラメータに含めるだけです。 + + section + h2 リクエスト形式 + p application/jsonを受け付けます。 + p.tip + | 現在application/x-www-form-urlencodedも受け付けていますが、将来的にこのサポートはされなくなる予定です。 diff --git a/src/web/docs/api/library.md b/src/web/docs/api/library.md new file mode 100644 index 0000000000..71ddbe345d --- /dev/null +++ b/src/web/docs/api/library.md @@ -0,0 +1,8 @@ +ライブラリ +================================================================ + +Misskey APIを便利に利用するためのライブラリ一覧です。 + +.NET +---------------------------------------------------------------- +* **[Misq (公式)](https://github.com/syuilo/Misq)** diff --git a/src/web/docs/index.md b/src/web/docs/index.md new file mode 100644 index 0000000000..0846cf27e8 --- /dev/null +++ b/src/web/docs/index.md @@ -0,0 +1,4 @@ +Misskeyについて +================================================================ + +誰か書いて diff --git a/src/web/docs/link-to-twitter.md b/src/web/docs/link-to-twitter.md new file mode 100644 index 0000000000..77fb744576 --- /dev/null +++ b/src/web/docs/link-to-twitter.md @@ -0,0 +1,9 @@ +Twitterと連携する +================================================================ + +設定 -> Twitter から、お使いのMisskeyアカウントとお使いのTwitterアカウントを関連付けることができます。 +アカウントの関連付けを行うと、プロフィールにTwitterアカウントへのリンクが表示されたりなどします。 + +MisskeyがあなたのTwitterアカウントでツイートしたり誰かをフォローしたりといったことは、 +一切行いませんのでご安心ください。(Misskeyはそのような権限を取得しないので、行おうと思っても行えません) +Twitterのアプリケーション認証フォームでこの権限の詳細を確認することができます。また、いつでも連携を取り消すことができます。 diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl new file mode 100644 index 0000000000..9014df87fe --- /dev/null +++ b/src/web/docs/style.styl @@ -0,0 +1,69 @@ +@import "../style" + +body + margin 0 + color #34495e + +main + padding 32px + width 100% + max-width 700px + +footer + padding:32px 0 0 0 + margin 32px 0 0 0 + border-top solid 1px #eee + + .copyright + margin 16px 0 0 0 + color #aaa + +section + margin 32px 0 + +h1 + margin 0 0 24px 0 + padding 16px 0 + font-size 1.5em + border-bottom solid 2px #eee + +h2 + margin 0 0 24px 0 + padding 0 0 16px 0 + font-size 1.4em + border-bottom solid 1px #eee + +h3 + margin 0 + padding 0 + font-size 1.25em + +h4 + margin 0 + +p + margin 1em 0 + line-height 1.6em + +table + width 100% + border-spacing 0 + border-collapse collapse + + thead + font-weight bold + border-bottom solid 2px #eee + + tr + th + text-align left + + tbody + tr + border-bottom dashed 1px #eee + + th, td + padding 8px 16px + +.i18n:not(.ja) + display none diff --git a/src/web/docs/tou.md b/src/web/docs/tou.md new file mode 100644 index 0000000000..fbf87867b4 --- /dev/null +++ b/src/web/docs/tou.md @@ -0,0 +1,4 @@ +利用規約 +================================================================ + +公序良俗に反する行為はおやめください。 diff --git a/src/web/server.ts b/src/web/server.ts index 1d3687f89e..38e87754f3 100644 --- a/src/web/server.ts +++ b/src/web/server.ts @@ -63,6 +63,12 @@ app.get('/manifest.json', (req, res) => */ app.get(/\/api:url/, require('./service/url-preview')); +/** + * Docs + */ +app.get(/^\/docs\/([a-z_\-\/]+?)$/, (req, res) => + res.sendFile(`${__dirname}/docs/${req.params[0]}.html`)); + /** * Routing */ diff --git a/src/web/style.styl b/src/web/style.styl new file mode 100644 index 0000000000..573df10d78 --- /dev/null +++ b/src/web/style.styl @@ -0,0 +1,38 @@ +json('../const.json') + +@charset 'utf-8' + +$theme-color = themeColor +$theme-color-foreground = themeColorForeground + +/* + ::selection + background $theme-color + color #fff +*/ + +* + position relative + box-sizing border-box + background-clip padding-box !important + tap-highlight-color rgba($theme-color, 0.7) + -webkit-tap-highlight-color rgba($theme-color, 0.7) + +html, body + margin 0 + padding 0 + scroll-behavior smooth + text-size-adjust 100% + font-family sans-serif + +a + text-decoration none + color $theme-color + cursor pointer + + &:hover + text-decoration underline + + * + cursor pointer + -- cgit v1.2.3-freya From 5b6641003139606d54e3b8646b156d4fcd05b9d5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 14 Dec 2017 22:36:04 +0900 Subject: :v: --- src/web/docs/api/endpoints/gulpfile.ts | 39 +++++++++++++++++++++------- src/web/docs/api/endpoints/posts/create.yaml | 21 +++++++-------- src/web/docs/api/endpoints/view.pug | 6 ++++- 3 files changed, 45 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/web/docs/api/endpoints/gulpfile.ts b/src/web/docs/api/endpoints/gulpfile.ts index a2c3944709..e375447c55 100644 --- a/src/web/docs/api/endpoints/gulpfile.ts +++ b/src/web/docs/api/endpoints/gulpfile.ts @@ -14,7 +14,8 @@ import config from './../../../../conf'; const parseParam = param => { const id = param.type.match(/^id\((.+?)\)/); - const object = param.type.match(/^object\((.+?)\)/); + const entity = param.type.match(/^entity\((.+?)\)/); + const isObject = /^object/.test(param.type); const isArray = /\[\]$/.test(param.type); if (id) { param.kind = 'id'; @@ -24,18 +25,40 @@ const parseParam = param => { param.type += '[]'; } } - if (object) { - param.kind = 'object'; + if (entity) { + param.kind = 'entity'; param.type = 'object'; - param.def = object[1]; + param.entity = entity[1]; if (isArray) { param.type += '[]'; } } + if (isObject) { + param.kind = 'object'; + } return param; }; +const extractDefs = params => { + const defs = []; + + params.forEach(param => { + if (param.def) { + defs.push({ + name: param.defName, + params: param.def.map(p => parseParam(p)) + }); + + const childDefs = extractDefs(param.def); + + defs.concat(childDefs); + } + }); + + return defs; +}; + gulp.task('doc:endpoints', () => { glob('./src/web/docs/api/endpoints/**/*.yaml', (globErr, files) => { if (globErr) { @@ -50,11 +73,9 @@ gulp.task('doc:endpoints', () => { url: `${config.api_url}/${ep.endpoint}`, desc: ep.desc, params: ep.params.map(p => parseParam(p)), - paramDefs: Object.keys(ep.paramDefs).map(key => ({ - name: key, - params: ep.paramDefs[key].map(p => parseParam(p)) - })), - res: ep.res.map(p => parseParam(p)) + paramDefs: extractDefs(ep.params), + res: ep.res.map(p => parseParam(p)), + resDefs: extractDefs(ep.res) }; pug.renderFile('./src/web/docs/api/endpoints/view.pug', vars, (renderErr, html) => { if (renderErr) { diff --git a/src/web/docs/api/endpoints/posts/create.yaml b/src/web/docs/api/endpoints/posts/create.yaml index b6613038a7..feedf4f0d2 100644 --- a/src/web/docs/api/endpoints/posts/create.yaml +++ b/src/web/docs/api/endpoints/posts/create.yaml @@ -7,7 +7,7 @@ desc: params: - name: "text" type: "string" - optional: false + optional: true desc: ja: "投稿の本文" en: "Text of a post" @@ -30,20 +30,19 @@ params: ja: "引用する投稿" en: "A post you want to quote" - name: "poll" - type: "object(poll)" + type: "object" optional: true desc: ja: "投票" en: "A poll" - -paramDefs: - poll: - - name: "choices" - type: "string[]" - optional: false - desc: - ja: "投票の選択肢" - en: "Choices of a poll" + defName: "poll" + def: + - name: "choices" + type: "string[]" + optional: false + desc: + ja: "投票の選択肢" + en: "Choices of a poll" res: - name: "created_post" diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug index d9de9cb74a..b7b2658a39 100644 --- a/src/web/docs/api/endpoints/view.pug +++ b/src/web/docs/api/endpoints/view.pug @@ -21,9 +21,13 @@ mixin table(params) = ' ' a(href=`/docs/api/entities/${param.entity}`)= param.entity | ) + else if param.kind == 'entity' + | #{param.type} ( + a(href=`/docs/api/entities/${param.entity}`)= param.entity + | ) else if param.kind == 'object' | #{param.type} ( - a(href=`#${param.def}`)= param.def + a(href=`#${param.defName}`)= param.defName | ) else = param.type -- cgit v1.2.3-freya From a357d5c6a51b1d3b36e2735068a2603ff8e1675a Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 14 Dec 2017 22:50:41 +0900 Subject: :v: --- src/web/docs/api/endpoints/posts/create.yaml | 4 ++-- src/web/docs/api/endpoints/style.styl | 2 ++ src/web/docs/api/endpoints/view.pug | 5 ++--- src/web/docs/style.styl | 3 +++ 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/web/docs/api/endpoints/posts/create.yaml b/src/web/docs/api/endpoints/posts/create.yaml index feedf4f0d2..498a99159c 100644 --- a/src/web/docs/api/endpoints/posts/create.yaml +++ b/src/web/docs/api/endpoints/posts/create.yaml @@ -15,8 +15,8 @@ params: type: "id(DriveFile)[]" optional: true desc: - ja: "添付するメディア" - en: "Media you want to attach" + ja: "添付するメディア(1~4つ)" + en: "Media you want to attach (1~4)" - name: "reply_id" type: "id(Post)" optional: true diff --git a/src/web/docs/api/endpoints/style.styl b/src/web/docs/api/endpoints/style.styl index 12c06fe3af..ab74e100b5 100644 --- a/src/web/docs/api/endpoints/style.styl +++ b/src/web/docs/api/endpoints/style.styl @@ -11,6 +11,8 @@ table .name font-weight bold + .name .type + .optional font-family Consolas, 'Courier New', Courier, Monaco, monospace diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug index b7b2658a39..841ca8b3f9 100644 --- a/src/web/docs/api/endpoints/view.pug +++ b/src/web/docs/api/endpoints/view.pug @@ -17,10 +17,9 @@ mixin table(params) td.name= param.name td.type if param.kind == 'id' - | #{param.type} (ID of - = ' ' + | #{param.type} ( a(href=`/docs/api/entities/${param.entity}`)= param.entity - | ) + | ID) else if param.kind == 'entity' | #{param.type} ( a(href=`/docs/api/entities/${param.entity}`)= param.entity diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl index 9014df87fe..5c484adc1b 100644 --- a/src/web/docs/style.styl +++ b/src/web/docs/style.styl @@ -62,6 +62,9 @@ table tr border-bottom dashed 1px #eee + &:nth-child(odd) + background #fbfbfb + th, td padding 8px 16px -- cgit v1.2.3-freya From d6ec5f2fe13bb1e3f4316f04591bf419f587c2bd Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Dec 2017 00:23:45 +0900 Subject: :v: --- gulpfile.ts | 4 +- src/web/docs/api/endpoints/gulpfile.ts | 96 ----------------- src/web/docs/api/endpoints/posts/create.yaml | 8 +- src/web/docs/api/endpoints/style.styl | 12 +-- src/web/docs/api/endpoints/view.pug | 91 +++++----------- src/web/docs/api/entities/post.yaml | 124 +++++++++++++++++++++ src/web/docs/api/entities/style.styl | 1 + src/web/docs/api/entities/view.pug | 23 ++++ src/web/docs/api/gulpfile.ts | 156 +++++++++++++++++++++++++++ src/web/docs/api/mixins.pug | 33 ++++++ src/web/docs/api/style.styl | 11 ++ src/web/docs/layout.pug | 16 +++ 12 files changed, 400 insertions(+), 175 deletions(-) delete mode 100644 src/web/docs/api/endpoints/gulpfile.ts create mode 100644 src/web/docs/api/entities/post.yaml create mode 100644 src/web/docs/api/entities/style.styl create mode 100644 src/web/docs/api/entities/view.pug create mode 100644 src/web/docs/api/gulpfile.ts create mode 100644 src/web/docs/api/mixins.pug create mode 100644 src/web/docs/api/style.styl create mode 100644 src/web/docs/layout.pug (limited to 'src') diff --git a/gulpfile.ts b/gulpfile.ts index 0bc18dd7c4..6807b6d571 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -48,7 +48,7 @@ if (isDebug) { const constants = require('./src/const.json'); -require('./src/web/docs/api/endpoints/gulpfile.ts'); +require('./src/web/docs/api/gulpfile.ts'); gulp.task('build', [ 'build:js', @@ -61,7 +61,7 @@ gulp.task('build', [ gulp.task('rebuild', ['clean', 'build']); gulp.task('build:doc', [ - 'doc:endpoints', + 'doc:api', 'doc:styles' ]); diff --git a/src/web/docs/api/endpoints/gulpfile.ts b/src/web/docs/api/endpoints/gulpfile.ts deleted file mode 100644 index e375447c55..0000000000 --- a/src/web/docs/api/endpoints/gulpfile.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Gulp tasks - */ - -import * as fs from 'fs'; -import * as path from 'path'; -import * as glob from 'glob'; -import * as gulp from 'gulp'; -import * as pug from 'pug'; -import * as yaml from 'js-yaml'; -import * as mkdirp from 'mkdirp'; - -import config from './../../../../conf'; - -const parseParam = param => { - const id = param.type.match(/^id\((.+?)\)/); - const entity = param.type.match(/^entity\((.+?)\)/); - const isObject = /^object/.test(param.type); - const isArray = /\[\]$/.test(param.type); - if (id) { - param.kind = 'id'; - param.type = 'string'; - param.entity = id[1]; - if (isArray) { - param.type += '[]'; - } - } - if (entity) { - param.kind = 'entity'; - param.type = 'object'; - param.entity = entity[1]; - if (isArray) { - param.type += '[]'; - } - } - if (isObject) { - param.kind = 'object'; - } - - return param; -}; - -const extractDefs = params => { - const defs = []; - - params.forEach(param => { - if (param.def) { - defs.push({ - name: param.defName, - params: param.def.map(p => parseParam(p)) - }); - - const childDefs = extractDefs(param.def); - - defs.concat(childDefs); - } - }); - - return defs; -}; - -gulp.task('doc:endpoints', () => { - glob('./src/web/docs/api/endpoints/**/*.yaml', (globErr, files) => { - if (globErr) { - console.error(globErr); - return; - } - //console.log(files); - files.forEach(file => { - const ep = yaml.safeLoad(fs.readFileSync(file, 'utf-8')); - const vars = { - endpoint: ep.endpoint, - url: `${config.api_url}/${ep.endpoint}`, - desc: ep.desc, - params: ep.params.map(p => parseParam(p)), - paramDefs: extractDefs(ep.params), - res: ep.res.map(p => parseParam(p)), - resDefs: extractDefs(ep.res) - }; - pug.renderFile('./src/web/docs/api/endpoints/view.pug', vars, (renderErr, html) => { - if (renderErr) { - console.error(renderErr); - return; - } - const htmlPath = `./built/web/docs/api/endpoints/${ep.endpoint}.html`; - mkdirp(path.dirname(htmlPath), (mkdirErr) => { - if (mkdirErr) { - console.error(mkdirErr); - return; - } - fs.writeFileSync(htmlPath, html, 'utf-8'); - }); - }); - }); - }); -}); diff --git a/src/web/docs/api/endpoints/posts/create.yaml b/src/web/docs/api/endpoints/posts/create.yaml index 498a99159c..5e2307dab4 100644 --- a/src/web/docs/api/endpoints/posts/create.yaml +++ b/src/web/docs/api/endpoints/posts/create.yaml @@ -10,7 +10,7 @@ params: optional: true desc: ja: "投稿の本文" - en: "Text of a post" + en: "The text of your post" - name: "media_ids" type: "id(DriveFile)[]" optional: true @@ -22,19 +22,19 @@ params: optional: true desc: ja: "返信する投稿" - en: "A post you want to reply" + en: "The post you want to reply" - name: "repost_id" type: "id(Post)" optional: true desc: ja: "引用する投稿" - en: "A post you want to quote" + en: "The post you want to quote" - name: "poll" type: "object" optional: true desc: ja: "投票" - en: "A poll" + en: "The poll" defName: "poll" def: - name: "choices" diff --git a/src/web/docs/api/endpoints/style.styl b/src/web/docs/api/endpoints/style.styl index ab74e100b5..07fb7ec2a3 100644 --- a/src/web/docs/api/endpoints/style.styl +++ b/src/web/docs/api/endpoints/style.styl @@ -1,4 +1,4 @@ -@import "../../style" +@import "../style" #url padding 8px 12px @@ -6,13 +6,3 @@ color #fff background #222e40 border-radius 4px - -table - .name - font-weight bold - - .name - .type - .optional - font-family Consolas, 'Courier New', Courier, Monaco, monospace - diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug index 841ca8b3f9..cebef9fa5b 100644 --- a/src/web/docs/api/endpoints/view.pug +++ b/src/web/docs/api/endpoints/view.pug @@ -1,63 +1,30 @@ -doctype html - -mixin i18n(xs) - each text, lang in xs - span(class=`i18n ${lang}`)= text - -mixin table(params) - table - thead: tr - th Name - th Type - th Optional - th Description - tbody - each param in params - tr - td.name= param.name - td.type - if param.kind == 'id' - | #{param.type} ( - a(href=`/docs/api/entities/${param.entity}`)= param.entity - | ID) - else if param.kind == 'entity' - | #{param.type} ( - a(href=`/docs/api/entities/${param.entity}`)= param.entity - | ) - else if param.kind == 'object' - | #{param.type} ( - a(href=`#${param.defName}`)= param.defName - | ) - else - = param.type - td.optional= param.optional.toString() - td.desc: +i18n(param.desc) - -html - head - meta(charset="UTF-8") - title #{endpoint} | Misskey API - link(rel="stylesheet" href="/assets/docs/api/endpoints/style.css") - - body - main - h1= endpoint - - p#url= url - - p#desc: +i18n(desc) - - section - h2 Params - +table(params) - - if paramDefs - each paramDef in paramDefs - section(id= paramDef.name) - h3= paramDef.name - +table(paramDef.params) - - section - h2 Response - +table(res) +extends ../../layout.pug +include ../mixins + +block title + | #{endpoint} | Misskey API + +block meta + link(rel="stylesheet" href="/assets/docs/api/endpoints/style.css") + +block main + h1= endpoint + + p#url= url + + p#desc: +i18n(desc) + + section + h2 Params + +propTable(params) + + if paramDefs + each paramDef in paramDefs + section(id= paramDef.name) + h3= paramDef.name + +propTable(paramDef.params) + + section + h2 Response + +propTable(res) diff --git a/src/web/docs/api/entities/post.yaml b/src/web/docs/api/entities/post.yaml new file mode 100644 index 0000000000..551f3b7c3e --- /dev/null +++ b/src/web/docs/api/entities/post.yaml @@ -0,0 +1,124 @@ +name: "Post" + +desc: + ja: "投稿。" + en: "A post." + +props: + - name: "id" + type: "id" + optional: false + desc: + ja: "投稿ID" + en: "The ID of this post" + - name: "created_at" + type: "date" + optional: false + desc: + ja: "投稿日時" + en: "The posted date of this post" + - name: "text" + type: "string" + optional: true + desc: + ja: "投稿の本文" + en: "The text of this post" + - name: "media_ids" + type: "id(DriveFile)[]" + optional: true + desc: + ja: "添付されているメディアのID" + en: "The IDs of the attached media" + - name: "media" + type: "entity(DriveFile)[]" + optional: true + desc: + ja: "添付されているメディア" + en: "The attached media" + - name: "user_id" + type: "id(User)" + optional: false + desc: + ja: "投稿者ID" + en: "The ID of author of this post" + - name: "user" + type: "entity(User)" + optional: true + desc: + ja: "投稿者" + en: "The author of this post" + - name: "my_reaction" + type: "string" + optional: true + desc: + ja: "この投稿に対する自分のリアクション" + en: "The your reaction of this post" + - name: "reaction_counts" + type: "object" + optional: false + desc: + ja: "リアクションをキーとし、この投稿に対するそのリアクションの数を値としたオブジェクト" + - name: "reply_id" + type: "id(Post)" + optional: true + desc: + ja: "返信した投稿のID" + en: "The ID of the replyed post" + - name: "reply" + type: "entity(Post)" + optional: true + desc: + ja: "返信した投稿" + en: "The replyed post" + - name: "repost_id" + type: "id(Post)" + optional: true + desc: + ja: "引用した投稿のID" + en: "The ID of the quoted post" + - name: "repost" + type: "entity(Post)" + optional: true + desc: + ja: "引用した投稿" + en: "The quoted post" + - name: "poll" + type: "object" + optional: true + desc: + ja: "投票" + en: "The poll" + defName: "poll" + def: + - name: "choices" + type: "object[]" + optional: false + desc: + ja: "投票の選択肢" + en: "The choices of this poll" + defName: "choice" + def: + - name: "id" + type: "number" + optional: false + desc: + ja: "選択肢ID" + en: "The ID of this choice" + - name: "is_voted" + type: "boolean" + optional: true + desc: + ja: "自分がこの選択肢に投票したかどうか" + en: "Whether you voted to this choice" + - name: "text" + type: "string" + optional: false + desc: + ja: "選択肢本文" + en: "The text of this choice" + - name: "votes" + type: "number" + optional: false + desc: + ja: "この選択肢に投票された数" + en: "The number voted for this choice" diff --git a/src/web/docs/api/entities/style.styl b/src/web/docs/api/entities/style.styl new file mode 100644 index 0000000000..bddf0f53ab --- /dev/null +++ b/src/web/docs/api/entities/style.styl @@ -0,0 +1 @@ +@import "../style" diff --git a/src/web/docs/api/entities/view.pug b/src/web/docs/api/entities/view.pug new file mode 100644 index 0000000000..f210582f1a --- /dev/null +++ b/src/web/docs/api/entities/view.pug @@ -0,0 +1,23 @@ +extends ../../layout.pug +include ../mixins + +block title + | #{name} | Misskey API + +block meta + link(rel="stylesheet" href="/assets/docs/api/entities/style.css") + +block main + h1= name + + p#desc: +i18n(desc) + + section + h2 Properties + +propTable(props) + + if propDefs + each propDef in propDefs + section(id= propDef.name) + h3= propDef.name + +propTable(propDef.params) diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts new file mode 100644 index 0000000000..05567b6233 --- /dev/null +++ b/src/web/docs/api/gulpfile.ts @@ -0,0 +1,156 @@ +/** + * Gulp tasks + */ + +import * as fs from 'fs'; +import * as path from 'path'; +import * as glob from 'glob'; +import * as gulp from 'gulp'; +import * as pug from 'pug'; +import * as yaml from 'js-yaml'; +import * as mkdirp from 'mkdirp'; + +import config from './../../../conf'; + +const kebab = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); + +const parseParam = param => { + const id = param.type.match(/^id\((.+?)\)|^id/); + const entity = param.type.match(/^entity\((.+?)\)/); + const isObject = /^object/.test(param.type); + const isDate = /^date/.test(param.type); + const isArray = /\[\]$/.test(param.type); + if (id) { + param.kind = 'id'; + param.type = 'string'; + param.entity = id[1]; + if (isArray) { + param.type += '[]'; + } + } + if (entity) { + param.kind = 'entity'; + param.type = 'object'; + param.entity = entity[1]; + if (isArray) { + param.type += '[]'; + } + } + if (isObject) { + param.kind = 'object'; + } + if (isDate) { + param.kind = 'date'; + param.type = 'string'; + if (isArray) { + param.type += '[]'; + } + } + + return param; +}; + +const sortParams = params => { + params.sort((a, b) => { + if (a.name < b.name) + return -1; + if (a.name > b.name) + return 1; + return 0; + }); + return params; +}; + +const extractDefs = params => { + let defs = []; + + params.forEach(param => { + if (param.def) { + defs.push({ + name: param.defName, + params: sortParams(param.def.map(p => parseParam(p))) + }); + + const childDefs = extractDefs(param.def); + + defs = defs.concat(childDefs); + } + }); + + return defs; +}; + +gulp.task('doc:api', [ + 'doc:api:endpoints', + 'doc:api:entities' +]); + +gulp.task('doc:api:endpoints', () => { + glob('./src/web/docs/api/endpoints/**/*.yaml', (globErr, files) => { + if (globErr) { + console.error(globErr); + return; + } + //console.log(files); + files.forEach(file => { + const ep = yaml.safeLoad(fs.readFileSync(file, 'utf-8')); + const vars = { + endpoint: ep.endpoint, + url: `${config.api_url}/${ep.endpoint}`, + desc: ep.desc, + params: sortParams(ep.params.map(p => parseParam(p))), + paramDefs: extractDefs(ep.params), + res: sortParams(ep.res.map(p => parseParam(p))), + resDefs: extractDefs(ep.res), + kebab + }; + pug.renderFile('./src/web/docs/api/endpoints/view.pug', vars, (renderErr, html) => { + if (renderErr) { + console.error(renderErr); + return; + } + const htmlPath = `./built/web/docs/api/endpoints/${ep.endpoint}.html`; + mkdirp(path.dirname(htmlPath), (mkdirErr) => { + if (mkdirErr) { + console.error(mkdirErr); + return; + } + fs.writeFileSync(htmlPath, html, 'utf-8'); + }); + }); + }); + }); +}); + +gulp.task('doc:api:entities', () => { + glob('./src/web/docs/api/entities/**/*.yaml', (globErr, files) => { + if (globErr) { + console.error(globErr); + return; + } + files.forEach(file => { + const entity = yaml.safeLoad(fs.readFileSync(file, 'utf-8')); + const vars = { + name: entity.name, + desc: entity.desc, + props: sortParams(entity.props.map(p => parseParam(p))), + propDefs: extractDefs(entity.props), + kebab + }; + pug.renderFile('./src/web/docs/api/entities/view.pug', vars, (renderErr, html) => { + if (renderErr) { + console.error(renderErr); + return; + } + const htmlPath = `./built/web/docs/api/entities/${kebab(entity.name)}.html`; + mkdirp(path.dirname(htmlPath), (mkdirErr) => { + if (mkdirErr) { + console.error(mkdirErr); + return; + } + fs.writeFileSync(htmlPath, html, 'utf-8'); + }); + }); + }); + }); +}); diff --git a/src/web/docs/api/mixins.pug b/src/web/docs/api/mixins.pug new file mode 100644 index 0000000000..b302c78263 --- /dev/null +++ b/src/web/docs/api/mixins.pug @@ -0,0 +1,33 @@ +mixin propTable(props) + table.props + thead: tr + th Name + th Type + th Optional + th Description + tbody + each prop in props + tr + td.name= prop.name + td.type + i= prop.type + if prop.kind == 'id' + if prop.entity + | ( + a(href=`/docs/api/entities/${kebab(prop.entity)}`)= prop.entity + | ID) + else + | (ID) + else if prop.kind == 'entity' + | ( + a(href=`/docs/api/entities/${kebab(prop.entity)}`)= prop.entity + | ) + else if prop.kind == 'object' + if prop.def + | ( + a(href=`#${prop.defName}`)= prop.defName + | ) + else if prop.kind == 'date' + | (Date) + td.optional= prop.optional.toString() + td.desc: +i18n(prop.desc) diff --git a/src/web/docs/api/style.styl b/src/web/docs/api/style.styl new file mode 100644 index 0000000000..3675a4da6f --- /dev/null +++ b/src/web/docs/api/style.styl @@ -0,0 +1,11 @@ +@import "../style" + +table.props + .name + font-weight bold + + .name + .type + .optional + font-family Consolas, 'Courier New', Courier, Monaco, monospace + diff --git a/src/web/docs/layout.pug b/src/web/docs/layout.pug new file mode 100644 index 0000000000..68ca9eb62d --- /dev/null +++ b/src/web/docs/layout.pug @@ -0,0 +1,16 @@ +doctype html + +mixin i18n(xs) + each text, lang in xs + span(class=`i18n ${lang}`)!= text + +html + head + meta(charset="UTF-8") + title + block title + block meta + + body + main + block main -- cgit v1.2.3-freya From 13e4034ceee1e3983c852a2c40ce89eeb30dcecd Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Dec 2017 00:54:28 +0900 Subject: :v: --- src/web/docs/api/entities/post.pug | 149 ------------------------------------ src/web/docs/api/entities/user.yaml | 137 +++++++++++++++++++++++++++++++++ src/web/docs/api/gulpfile.ts | 2 +- 3 files changed, 138 insertions(+), 150 deletions(-) delete mode 100644 src/web/docs/api/entities/post.pug create mode 100644 src/web/docs/api/entities/user.yaml (limited to 'src') diff --git a/src/web/docs/api/entities/post.pug b/src/web/docs/api/entities/post.pug deleted file mode 100644 index 954f172717..0000000000 --- a/src/web/docs/api/entities/post.pug +++ /dev/null @@ -1,149 +0,0 @@ -extend ../../BASE - -block title - | Entity: Post - -block content - h1 Post - p 投稿を表します。 - - section - h2 Properties - table.entity - thead: tr - td Name - td Type - td Description - tbody - tr.nullable.optional - td app - td: a(href='./app', target='_blank') App - td 投稿したアプリ - tr.nullable - td app_id - td ID - td 投稿したアプリのID - tr - td created_at - td Date - td 投稿日時 - tr - td id - td ID - td 投稿ID - tr.optional - td is_liked - td Boolean - td いいね したかどうか - tr - td likes_count - td Number - td いいね数 - tr.nullable.optional - td media_ids - td ID[] - td 添付されたメディアのIDの配列 - tr.nullable.optional - td media - td: a(href='./drive-file', target='_blank') DriveFile[] - td 添付されたメディアの配列 - tr - td replies_count - td Number - td 返信数 - tr.optional - td reply - td: a(href='./post', target='_blank') Post - td 返信先の投稿 - tr.nullable - td reply_id - td ID - td 返信先の投稿のID - tr.optional - td repost - td: a(href='./post', target='_blank') Post - td Repostした投稿 - tr - td repost_count - td Number - td Repostされた数 - tr.nullable - td repost_id - td ID - td Repostした投稿のID - tr.nullable - td text - td String - td 本文 - tr.optional - td user - td: a(href='./user', target='_blank') User - td 投稿者 - tr - td user_id - td ID - td 投稿者のID - - section - h2 Example - pre: code. - { - "created_at": "2016-12-10T00:28:50.114Z", - "media_ids": null, - "reply_id": "584a16b15860fc52320137e3", - "repost_id": null, - "text": "小日向美穂だぞ!", - "user_id": "5848bf7764e572683f4402f8", - "app_id": null, - "likes_count": 1, - "replies_count": 1, - "id": "584b4c42d8e5186f8f755d0c", - "user": { - "birthday": null, - "created_at": "2016-12-08T02:03:35.332Z", - "bio": "女が嫌いです、女性は好きです", - "followers_count": 11, - "following_count": 11, - "links": null, - "location": "", - "name": "女が嫌い", - "posts_count": 26, - "likes_count": 2, - "liked_count": 20, - "username": "onnnagakirai", - "id": "5848bf7764e572683f4402f8", - "avatar_url": "https://file.himasaku.net/5848c0ec64e572683f4402fc", - "banner_url": "https://file.himasaku.net/5848c12864e572683f4402fd", - "is_following": true, - "is_followed": true - }, - "reply": { - "created_at": "2016-12-09T02:28:01.563Z", - "media_ids": null, - "reply_id": "5849d35e547e4249be329884", - "repost_id": null, - "text": "アイコン小日向美穂?", - "user_id": "57d01a501fdf2d07be417afe", - "app_id": null, - "replies_count": 1, - "id": "584a16b15860fc52320137e3", - "user": { - "birthday": null, - "created_at": "2016-09-07T13:46:56.605Z", - "bio": "どうすれば君だけのために生きていけるの", - "followers_count": 51, - "following_count": 97, - "links": null, - "location": "川崎", - "name": "きな子", - "posts_count": 4813, - "username": "syuilo", - "likes_count": 3141, - "liked_count": 750, - "id": "57d01a501fdf2d07be417afe", - "avatar_url": "https://file.himasaku.net/583ddc6e64df272771f74c1a", - "banner_url": "https://file.himasaku.net/584bfc82d8e5186f8f755ec5" - } - }, - "is_liked": true - } diff --git a/src/web/docs/api/entities/user.yaml b/src/web/docs/api/entities/user.yaml new file mode 100644 index 0000000000..9b1efd1fe6 --- /dev/null +++ b/src/web/docs/api/entities/user.yaml @@ -0,0 +1,137 @@ +name: "User" + +desc: + ja: "ユーザー。" + en: "A user." + +props: + - name: "id" + type: "id" + optional: false + desc: + ja: "ユーザーID" + en: "The ID of this user" + - name: "created_at" + type: "date" + optional: false + desc: + ja: "アカウント作成日時" + en: "The registered date of this user" + - name: "username" + type: "string" + optional: false + desc: + ja: "ユーザー名" + en: "The username of this user" + - name: "description" + type: "string" + optional: false + desc: + ja: "アカウントの説明(自己紹介)" + en: "The description of this user" + - name: "avatar_id" + type: "id(DriveFile)" + optional: true + desc: + ja: "アバターのID" + en: "The ID of the avatar of this user" + - name: "avatar_url" + type: "string" + optional: false + desc: + ja: "アバターのURL" + en: "The URL of the avatar of this user" + - name: "banner_id" + type: "id(DriveFile)" + optional: true + desc: + ja: "バナーのID" + en: "The ID of the banner of this user" + - name: "banner_url" + type: "string" + optional: false + desc: + ja: "バナーのURL" + en: "The URL of the banner of this user" + - name: "followers_count" + type: "number" + optional: false + desc: + ja: "フォロワーの数" + en: "The number of the followers for this user" + - name: "following_count" + type: "number" + optional: false + desc: + ja: "フォローしているユーザーの数" + en: "The number of the following users for this user" + - name: "last_used_at" + type: "date" + optional: false + desc: + ja: "最終利用日時" + en: "The last used date of this user" + - name: "posts_count" + type: "number" + optional: false + desc: + ja: "投稿の数" + en: "The number of the posts of this user" + - name: "pinned_post" + type: "entity(Post)" + optional: true + desc: + ja: "ピン留めされた投稿" + en: "The pinned post of this user" + - name: "pinned_post_id" + type: "id(Post)" + optional: true + desc: + ja: "ピン留めされた投稿のID" + en: "The ID of the pinned post of this user" + - name: "drive_capacity" + type: "number" + optional: false + desc: + ja: "ドライブの容量(bytes)" + en: "The capacity of drive of this user (bytes)" + - name: "twitter" + type: "object" + optional: true + desc: + ja: "連携されているTwitterアカウント情報" + en: "The info of the connected twitter account of this user" + defName: "twitter" + def: + - name: "user_id" + type: "string" + optional: false + desc: + ja: "ユーザーID" + en: "The user ID" + - name: "screen_name" + type: "string" + optional: false + desc: + ja: "ユーザー名" + en: "The screen name of this user" + - name: "profile" + type: "object" + optional: false + desc: + ja: "プロフィール" + en: "The profile of this user" + defName: "profile" + def: + - name: "location" + type: "string" + optional: true + desc: + ja: "場所" + en: "The location of this user" + - name: "birthday" + type: "string" + optional: true + desc: + ja: "誕生日 (YYYY-MM-DD)" + en: "The birthday of this user (YYYY-MM-DD)" diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts index 05567b6233..6453996d31 100644 --- a/src/web/docs/api/gulpfile.ts +++ b/src/web/docs/api/gulpfile.ts @@ -77,7 +77,7 @@ const extractDefs = params => { } }); - return defs; + return sortParams(defs); }; gulp.task('doc:api', [ -- cgit v1.2.3-freya From 55e266fbbe55ea1dc8bd5cdce4e52d5625eea38d Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Dec 2017 04:43:48 +0900 Subject: :art: --- src/web/docs/style.styl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl index 5c484adc1b..a4abc5a9a3 100644 --- a/src/web/docs/style.styl +++ b/src/web/docs/style.styl @@ -56,7 +56,12 @@ table tr th + position sticky + top 0 + z-index 1 text-align left + box-shadow 0 1px 0 0 #eee + background #fff tbody tr -- cgit v1.2.3-freya From 5725e39a707af39c0a5118a04282bbaf186ee922 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Dec 2017 05:07:21 +0900 Subject: :v: --- src/web/docs/api/entities/user.pug | 122 ------------------------------------ src/web/docs/api/entities/user.yaml | 10 +++ 2 files changed, 10 insertions(+), 122 deletions(-) delete mode 100644 src/web/docs/api/entities/user.pug (limited to 'src') diff --git a/src/web/docs/api/entities/user.pug b/src/web/docs/api/entities/user.pug deleted file mode 100644 index a37886bb19..0000000000 --- a/src/web/docs/api/entities/user.pug +++ /dev/null @@ -1,122 +0,0 @@ -extend ../../BASE - -block title - | Entity: User - -block content - h1 User - p ユーザーを表します。 - - section - h2 Properties - table.entity - thead: tr - td Name - td Type - td Description - tbody - tr.nullable.optional - td avatar_id - td ID - td アバターに設定しているドライブのファイルのID - tr.nullable - td avatar_url - td String - td アバターURL - tr.nullable.optional - td banner_id - td ID - td バナーに設定しているドライブのファイルのID - tr.nullable - td banner_url - td String - td バナーURL - tr.nullable - td bio - td String - td プロフィール - tr.nullable - td birthday - td String - td 誕生日(YYYY-MM-DD) - tr - td created_at - td Date - td アカウント作成日時 - tr.optional - td drive_capacity - td Number - td ドライブの最大容量(byte単位) - tr - td followers_count - td Number - td フォロワー数 - tr - td following_count - td Number - td フォロー数 - tr - td id - td ID - td ユーザーID - tr.optional - td is_bot - td Boolean - td botかどうか - tr.optional - td is_followed - td Boolean - td フォローされているか - tr.optional - td is_following - td Boolean - td フォローしているか - tr - td liked_count - td Number - td 投稿にいいねされた数 - tr - td likes_count - td Number - td 投稿にいいねした数 - tr.nullable - td location - td String - td 住処 - tr - td name - td String - td ニックネーム - tr - td posts_count - td Number - td 投稿数 - tr - td username - td String - td ユーザー名 - - section - h2 Example - pre: code. - { - "avatar_id": "583ddc6e64df272771f74c1a", - "avatar_url": "https://file.himasaku.net/583ddc6e64df272771f74c1a", - "banner_id": "584bfc82d8e5186f8f755ec5", - "banner_url": "https://file.himasaku.net/584bfc82d8e5186f8f755ec5", - "bio": "どうすれば君だけのために生きていけるの", - "birthday": "1997-12-06", - "created_at": "2016-09-07T13:46:56.605Z", - "drive_capacity": 1073741824, - "email": null, - "followers_count": 51, - "following_count": 97, - "id": "57d01a501fdf2d07be417afe", - "liked_count": 750, - "likes_count": 3130, - "links": null, - "location": "川崎", - "name": "きな子", - "posts_count": 4811, - "username": "syuilo" - } diff --git a/src/web/docs/api/entities/user.yaml b/src/web/docs/api/entities/user.yaml index 9b1efd1fe6..abc3f300d2 100644 --- a/src/web/docs/api/entities/user.yaml +++ b/src/web/docs/api/entities/user.yaml @@ -65,6 +65,16 @@ props: desc: ja: "フォローしているユーザーの数" en: "The number of the following users for this user" + - name: "is_following" + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーをフォローしているか" + - name: "is_followed" + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーにフォローされているか" - name: "last_used_at" type: "date" optional: false -- cgit v1.2.3-freya From 169b99a358f166185147970b916adf1a09d23de3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Dec 2017 06:41:57 +0900 Subject: :v: --- gulpfile.ts | 19 ++-------- src/web/docs/api/endpoints/view.pug | 3 +- src/web/docs/api/entities/view.pug | 2 +- src/web/docs/api/gulpfile.ts | 60 ++++++++++++++++++++------------ src/web/docs/api/mixins.pug | 6 ++-- src/web/docs/gulpfile.ts | 64 ++++++++++++++++++++++++++++++++++ src/web/docs/index.en.pug | 9 +++++ src/web/docs/index.ja.pug | 9 +++++ src/web/docs/index.md | 4 --- src/web/docs/layout.pug | 23 ++++++++++--- src/web/docs/style.styl | 69 +++++++++++++++++++++---------------- src/web/docs/vars.ts | 36 +++++++++++++++++++ 12 files changed, 220 insertions(+), 84 deletions(-) create mode 100644 src/web/docs/gulpfile.ts create mode 100644 src/web/docs/index.en.pug create mode 100644 src/web/docs/index.ja.pug delete mode 100644 src/web/docs/index.md create mode 100644 src/web/docs/vars.ts (limited to 'src') diff --git a/gulpfile.ts b/gulpfile.ts index 6807b6d571..e7d4770610 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -13,7 +13,6 @@ import * as es from 'event-stream'; import cssnano = require('gulp-cssnano'); import * as uglifyComposer from 'gulp-uglify/composer'; import pug = require('gulp-pug'); -import stylus = require('gulp-stylus'); import * as rimraf from 'rimraf'; import chalk from 'chalk'; import imagemin = require('gulp-imagemin'); @@ -48,32 +47,18 @@ if (isDebug) { const constants = require('./src/const.json'); -require('./src/web/docs/api/gulpfile.ts'); +require('./src/web/docs/gulpfile.ts'); gulp.task('build', [ 'build:js', 'build:ts', 'build:copy', 'build:client', - 'build:doc' + 'doc' ]); gulp.task('rebuild', ['clean', 'build']); -gulp.task('build:doc', [ - 'doc:api', - 'doc:styles' -]); - -gulp.task('doc:styles', () => - gulp.src('./src/web/docs/**/*.styl') - .pipe(stylus()) - .pipe(isProduction - ? (cssnano as any)() - : gutil.noop()) - .pipe(gulp.dest('./built/web/assets/docs/')) -); - gulp.task('build:js', () => gulp.src(['./src/**/*.js', '!./src/web/**/*.js']) .pipe(gulp.dest('./built/')) diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug index cebef9fa5b..cab814cabc 100644 --- a/src/web/docs/api/endpoints/view.pug +++ b/src/web/docs/api/endpoints/view.pug @@ -12,7 +12,7 @@ block main p#url= url - p#desc: +i18n(desc) + p#desc= desc[lang] || desc['ja'] section h2 Params @@ -27,4 +27,3 @@ block main section h2 Response +propTable(res) - diff --git a/src/web/docs/api/entities/view.pug b/src/web/docs/api/entities/view.pug index f210582f1a..756e966b53 100644 --- a/src/web/docs/api/entities/view.pug +++ b/src/web/docs/api/entities/view.pug @@ -10,7 +10,7 @@ block meta block main h1= name - p#desc: +i18n(desc) + p#desc= desc[lang] || desc['ja'] section h2 Properties diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts index 6453996d31..6cbae5ea2d 100644 --- a/src/web/docs/api/gulpfile.ts +++ b/src/web/docs/api/gulpfile.ts @@ -12,6 +12,12 @@ import * as mkdirp from 'mkdirp'; import config from './../../../conf'; +import generateVars from '../vars'; + +const commonVars = generateVars(); + +const langs = ['ja', 'en']; + const kebab = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); const parseParam = param => { @@ -102,20 +108,25 @@ gulp.task('doc:api:endpoints', () => { paramDefs: extractDefs(ep.params), res: sortParams(ep.res.map(p => parseParam(p))), resDefs: extractDefs(ep.res), - kebab + kebab, + common: commonVars }; - pug.renderFile('./src/web/docs/api/endpoints/view.pug', vars, (renderErr, html) => { - if (renderErr) { - console.error(renderErr); - return; - } - const htmlPath = `./built/web/docs/api/endpoints/${ep.endpoint}.html`; - mkdirp(path.dirname(htmlPath), (mkdirErr) => { - if (mkdirErr) { - console.error(mkdirErr); + langs.forEach(lang => { + pug.renderFile('./src/web/docs/api/endpoints/view.pug', Object.assign({}, vars, { + lang + }), (renderErr, html) => { + if (renderErr) { + console.error(renderErr); return; } - fs.writeFileSync(htmlPath, html, 'utf-8'); + const htmlPath = `./built/web/docs/${lang}/api/endpoints/${ep.endpoint}.html`; + mkdirp(path.dirname(htmlPath), (mkdirErr) => { + if (mkdirErr) { + console.error(mkdirErr); + return; + } + fs.writeFileSync(htmlPath, html, 'utf-8'); + }); }); }); }); @@ -135,20 +146,25 @@ gulp.task('doc:api:entities', () => { desc: entity.desc, props: sortParams(entity.props.map(p => parseParam(p))), propDefs: extractDefs(entity.props), - kebab + kebab, + common: commonVars }; - pug.renderFile('./src/web/docs/api/entities/view.pug', vars, (renderErr, html) => { - if (renderErr) { - console.error(renderErr); - return; - } - const htmlPath = `./built/web/docs/api/entities/${kebab(entity.name)}.html`; - mkdirp(path.dirname(htmlPath), (mkdirErr) => { - if (mkdirErr) { - console.error(mkdirErr); + langs.forEach(lang => { + pug.renderFile('./src/web/docs/api/entities/view.pug', Object.assign({}, vars, { + lang + }), (renderErr, html) => { + if (renderErr) { + console.error(renderErr); return; } - fs.writeFileSync(htmlPath, html, 'utf-8'); + const htmlPath = `./built/web/docs/${lang}/api/entities/${kebab(entity.name)}.html`; + mkdirp(path.dirname(htmlPath), (mkdirErr) => { + if (mkdirErr) { + console.error(mkdirErr); + return; + } + fs.writeFileSync(htmlPath, html, 'utf-8'); + }); }); }); }); diff --git a/src/web/docs/api/mixins.pug b/src/web/docs/api/mixins.pug index b302c78263..3ddd7cb48a 100644 --- a/src/web/docs/api/mixins.pug +++ b/src/web/docs/api/mixins.pug @@ -14,13 +14,13 @@ mixin propTable(props) if prop.kind == 'id' if prop.entity | ( - a(href=`/docs/api/entities/${kebab(prop.entity)}`)= prop.entity + a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity | ID) else | (ID) else if prop.kind == 'entity' | ( - a(href=`/docs/api/entities/${kebab(prop.entity)}`)= prop.entity + a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity | ) else if prop.kind == 'object' if prop.def @@ -30,4 +30,4 @@ mixin propTable(props) else if prop.kind == 'date' | (Date) td.optional= prop.optional.toString() - td.desc: +i18n(prop.desc) + td.desc!= prop.desc[lang] || prop.desc['ja'] diff --git a/src/web/docs/gulpfile.ts b/src/web/docs/gulpfile.ts new file mode 100644 index 0000000000..6f2351dacb --- /dev/null +++ b/src/web/docs/gulpfile.ts @@ -0,0 +1,64 @@ +/** + * Gulp tasks + */ + +import * as fs from 'fs'; +import * as path from 'path'; +import * as glob from 'glob'; +import * as gulp from 'gulp'; +import * as pug from 'pug'; +//import * as yaml from 'js-yaml'; +import * as mkdirp from 'mkdirp'; +import stylus = require('gulp-stylus'); +import cssnano = require('gulp-cssnano'); + +//import config from './../../conf'; + +import generateVars from './vars'; + +require('./api/gulpfile.ts'); + +gulp.task('doc', [ + 'doc:docs', + 'doc:api', + 'doc:styles' +]); + +const commonVars = generateVars(); + +gulp.task('doc:docs', () => { + glob('./src/web/docs/**/*.*.pug', (globErr, files) => { + if (globErr) { + console.error(globErr); + return; + } + files.forEach(file => { + const [, name, lang] = file.match(/docs\/(.+?)\.(.+?)\.pug$/); + const vars = { + common: commonVars, + lang: lang + }; + pug.renderFile(file, vars, (renderErr, html) => { + if (renderErr) { + console.error(renderErr); + return; + } + const htmlPath = `./built/web/docs/${lang}/${name}.html`; + mkdirp(path.dirname(htmlPath), (mkdirErr) => { + if (mkdirErr) { + console.error(mkdirErr); + return; + } + fs.writeFileSync(htmlPath, html, 'utf-8'); + }); + }); + }); + }); +}); + +gulp.task('doc:styles', () => + gulp.src('./src/web/docs/**/*.styl') + .pipe(stylus()) + .pipe((cssnano as any)()) + .pipe(gulp.dest('./built/web/assets/docs/')) +); diff --git a/src/web/docs/index.en.pug b/src/web/docs/index.en.pug new file mode 100644 index 0000000000..af0bba8b2c --- /dev/null +++ b/src/web/docs/index.en.pug @@ -0,0 +1,9 @@ +extends ./layout.pug + +block title + | Misskey Docs + +block main + h1 Misskey Docs + + p Welcome to docs of Misskey. diff --git a/src/web/docs/index.ja.pug b/src/web/docs/index.ja.pug new file mode 100644 index 0000000000..cd43045f6e --- /dev/null +++ b/src/web/docs/index.ja.pug @@ -0,0 +1,9 @@ +extends ./layout.pug + +block title + | Misskey ドキュメント + +block main + h1 Misskey ドキュメント + + p Misskeyのドキュメントへようこそ diff --git a/src/web/docs/index.md b/src/web/docs/index.md deleted file mode 100644 index 0846cf27e8..0000000000 --- a/src/web/docs/index.md +++ /dev/null @@ -1,4 +0,0 @@ -Misskeyについて -================================================================ - -誰か書いて diff --git a/src/web/docs/layout.pug b/src/web/docs/layout.pug index 68ca9eb62d..d6ecb4b6aa 100644 --- a/src/web/docs/layout.pug +++ b/src/web/docs/layout.pug @@ -1,16 +1,29 @@ doctype html -mixin i18n(xs) - each text, lang in xs - span(class=`i18n ${lang}`)!= text - -html +html(lang= lang) head meta(charset="UTF-8") + meta(name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no") title block title + link(rel="stylesheet" href="/assets/docs/style.css") block meta body + nav + ul + each doc in common.docs + li: a(href=`/docs/${lang}/${doc.name}`)= doc.title[lang] || doc.title['ja'] + section + h2 API + ul + li Entities + ul + each entity in common.entities + li: a(href=`/docs/${lang}/api/entities/${common.kebab(entity)}`)= entity + li Endpoints + ul + each endpoint in common.endpoints + li: a(href=`/docs/${lang}/api/endpoints/${common.kebab(endpoint)}`)= endpoint main block main diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl index a4abc5a9a3..2e2f9f5743 100644 --- a/src/web/docs/style.styl +++ b/src/web/docs/style.styl @@ -5,10 +5,49 @@ body color #34495e main + margin 0 0 0 256px padding 32px width 100% max-width 700px + section + margin 32px 0 + + h1 + margin 0 0 24px 0 + padding 16px 0 + font-size 1.5em + border-bottom solid 2px #eee + + h2 + margin 0 0 24px 0 + padding 0 0 16px 0 + font-size 1.4em + border-bottom solid 1px #eee + + h3 + margin 0 + padding 0 + font-size 1.25em + + h4 + margin 0 + + p + margin 1em 0 + line-height 1.6em + +nav + display block + position fixed + top 0 + left 0 + width 256px + height 100% + overflow auto + padding 32px + border-right solid 2px #eee + footer padding:32px 0 0 0 margin 32px 0 0 0 @@ -18,33 +57,6 @@ footer margin 16px 0 0 0 color #aaa -section - margin 32px 0 - -h1 - margin 0 0 24px 0 - padding 16px 0 - font-size 1.5em - border-bottom solid 2px #eee - -h2 - margin 0 0 24px 0 - padding 0 0 16px 0 - font-size 1.4em - border-bottom solid 1px #eee - -h3 - margin 0 - padding 0 - font-size 1.25em - -h4 - margin 0 - -p - margin 1em 0 - line-height 1.6em - table width 100% border-spacing 0 @@ -72,6 +84,3 @@ table th, td padding 8px 16px - -.i18n:not(.ja) - display none diff --git a/src/web/docs/vars.ts b/src/web/docs/vars.ts new file mode 100644 index 0000000000..ed2149df4a --- /dev/null +++ b/src/web/docs/vars.ts @@ -0,0 +1,36 @@ +import * as fs from 'fs'; +import * as glob from 'glob'; +import * as yaml from 'js-yaml'; + +export default function() { + const vars = {}; + + const endpoints = glob.sync('./src/web/docs/api/endpoints/**/*.yaml'); + vars['endpoints'] = endpoints.map(ep => { + const _ep = yaml.safeLoad(fs.readFileSync(ep, 'utf-8')); + return _ep.endpoint; + }); + + const entities = glob.sync('./src/web/docs/api/entities/**/*.yaml'); + vars['entities'] = entities.map(x => { + const _x = yaml.safeLoad(fs.readFileSync(x, 'utf-8')); + return _x.name; + }); + + const docs = glob.sync('./src/web/docs/**/*.*.pug'); + vars['docs'] = {}; + docs.forEach(x => { + const [, name, lang] = x.match(/docs\/(.+?)\.(.+?)\.pug$/); + if (vars['docs'][name] == null) { + vars['docs'][name] = { + name, + title: {} + }; + } + vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/\r\n\th1 (.+?)\r\n/)[1]; + }); + + vars['kebab'] = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); + + return vars; +} -- cgit v1.2.3-freya From fae40ad1dde72f09ecd0e0630b4e757cf9758010 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Dec 2017 06:45:19 +0900 Subject: :v: --- src/web/docs/vars.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/docs/vars.ts b/src/web/docs/vars.ts index ed2149df4a..80fdc9a7de 100644 --- a/src/web/docs/vars.ts +++ b/src/web/docs/vars.ts @@ -27,7 +27,7 @@ export default function() { title: {} }; } - vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/\r\n\th1 (.+?)\r\n/)[1]; + vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/\r?\n\th1 (.+?)\r?\n/)[1]; }); vars['kebab'] = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); -- cgit v1.2.3-freya From 3bcdbe151f89622aabc9c38a8a4d69abdec97619 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Fri, 15 Dec 2017 09:03:22 +0900 Subject: :v: --- src/web/docs/api/entities/drive-file.yaml | 73 +++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/web/docs/api/entities/drive-file.yaml (limited to 'src') diff --git a/src/web/docs/api/entities/drive-file.yaml b/src/web/docs/api/entities/drive-file.yaml new file mode 100644 index 0000000000..2ebbb089ab --- /dev/null +++ b/src/web/docs/api/entities/drive-file.yaml @@ -0,0 +1,73 @@ +name: "DriveFile" + +desc: + ja: "ドライブのファイル。" + en: "A file of Drive." + +props: + - name: "id" + type: "id" + optional: false + desc: + ja: "ファイルID" + en: "The ID of this file" + - name: "created_at" + type: "date" + optional: false + desc: + ja: "アップロード日時" + en: "The upload date of this file" + - name: "user_id" + type: "id(User)" + optional: false + desc: + ja: "所有者ID" + en: "The ID of the owner of this file" + - name: "user" + type: "entity(User)" + optional: true + desc: + ja: "所有者" + en: "The owner of this file" + - name: "name" + type: "string" + optional: false + desc: + ja: "ファイル名" + en: "The name of this file" + - name: "md5" + type: "string" + optional: false + desc: + ja: "ファイルのMD5ハッシュ値" + en: "The md5 hash value of this file" + - name: "type" + type: "string" + optional: false + desc: + ja: "ファイルの種類" + en: "The type of this file" + - name: "datasize" + type: "number" + optional: false + desc: + ja: "ファイルサイズ(bytes)" + en: "The size of this file (bytes)" + - name: "url" + type: "string" + optional: false + desc: + ja: "ファイルのURL" + en: "The URL of this file" + - name: "folder_id" + type: "id(DriveFolder)" + optional: true + desc: + ja: "フォルダID" + en: "The ID of the folder of this file" + - name: "folder" + type: "entity(DriveFolder)" + optional: true + desc: + ja: "フォルダ" + en: "The folder of this file" -- cgit v1.2.3-freya From e1cc715589f83147b64a76bf0962b7a77dd2d19c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Dec 2017 00:19:10 +0900 Subject: :v: --- src/web/docs/api/endpoints/view.pug | 3 --- src/web/docs/api/entities/view.pug | 3 --- src/web/docs/api/gulpfile.ts | 14 ++++++++------ src/web/docs/gulpfile.ts | 24 +++++++++++++++++------- src/web/docs/index.en.pug | 10 ++-------- src/web/docs/index.ja.pug | 10 ++-------- src/web/docs/layout.pug | 4 +++- src/web/docs/vars.ts | 2 +- 8 files changed, 33 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug index cab814cabc..d456022f6e 100644 --- a/src/web/docs/api/endpoints/view.pug +++ b/src/web/docs/api/endpoints/view.pug @@ -1,9 +1,6 @@ extends ../../layout.pug include ../mixins -block title - | #{endpoint} | Misskey API - block meta link(rel="stylesheet" href="/assets/docs/api/endpoints/style.css") diff --git a/src/web/docs/api/entities/view.pug b/src/web/docs/api/entities/view.pug index 756e966b53..57c6d4cad7 100644 --- a/src/web/docs/api/entities/view.pug +++ b/src/web/docs/api/entities/view.pug @@ -1,9 +1,6 @@ extends ../../layout.pug include ../mixins -block title - | #{name} | Misskey API - block meta link(rel="stylesheet" href="/assets/docs/api/entities/style.css") diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts index 6cbae5ea2d..139ae92412 100644 --- a/src/web/docs/api/gulpfile.ts +++ b/src/web/docs/api/gulpfile.ts @@ -108,12 +108,13 @@ gulp.task('doc:api:endpoints', () => { paramDefs: extractDefs(ep.params), res: sortParams(ep.res.map(p => parseParam(p))), resDefs: extractDefs(ep.res), - kebab, - common: commonVars }; langs.forEach(lang => { pug.renderFile('./src/web/docs/api/endpoints/view.pug', Object.assign({}, vars, { - lang + lang, + title: ep.endpoint, + kebab, + common: commonVars }), (renderErr, html) => { if (renderErr) { console.error(renderErr); @@ -146,12 +147,13 @@ gulp.task('doc:api:entities', () => { desc: entity.desc, props: sortParams(entity.props.map(p => parseParam(p))), propDefs: extractDefs(entity.props), - kebab, - common: commonVars }; langs.forEach(lang => { pug.renderFile('./src/web/docs/api/entities/view.pug', Object.assign({}, vars, { - lang + lang, + title: entity.name, + kebab, + common: commonVars }), (renderErr, html) => { if (renderErr) { console.error(renderErr); diff --git a/src/web/docs/gulpfile.ts b/src/web/docs/gulpfile.ts index 6f2351dacb..2377844650 100644 --- a/src/web/docs/gulpfile.ts +++ b/src/web/docs/gulpfile.ts @@ -36,20 +36,30 @@ gulp.task('doc:docs', () => { const [, name, lang] = file.match(/docs\/(.+?)\.(.+?)\.pug$/); const vars = { common: commonVars, - lang: lang + lang: lang, + title: fs.readFileSync(file, 'utf-8').match(/^h1 (.+?)\r?\n/)[1] }; - pug.renderFile(file, vars, (renderErr, html) => { + pug.renderFile(file, vars, (renderErr, content) => { if (renderErr) { console.error(renderErr); return; } - const htmlPath = `./built/web/docs/${lang}/${name}.html`; - mkdirp(path.dirname(htmlPath), (mkdirErr) => { - if (mkdirErr) { - console.error(mkdirErr); + + pug.renderFile('./src/web/docs/layout.pug', Object.assign({}, vars, { + content + }), (renderErr2, html) => { + if (renderErr2) { + console.error(renderErr2); return; } - fs.writeFileSync(htmlPath, html, 'utf-8'); + const htmlPath = `./built/web/docs/${lang}/${name}.html`; + mkdirp(path.dirname(htmlPath), (mkdirErr) => { + if (mkdirErr) { + console.error(mkdirErr); + return; + } + fs.writeFileSync(htmlPath, html, 'utf-8'); + }); }); }); }); diff --git a/src/web/docs/index.en.pug b/src/web/docs/index.en.pug index af0bba8b2c..1fcc870d3d 100644 --- a/src/web/docs/index.en.pug +++ b/src/web/docs/index.en.pug @@ -1,9 +1,3 @@ -extends ./layout.pug +h1 Misskey Docs -block title - | Misskey Docs - -block main - h1 Misskey Docs - - p Welcome to docs of Misskey. +p Welcome to docs of Misskey. diff --git a/src/web/docs/index.ja.pug b/src/web/docs/index.ja.pug index cd43045f6e..4a0bf7fa1d 100644 --- a/src/web/docs/index.ja.pug +++ b/src/web/docs/index.ja.pug @@ -1,9 +1,3 @@ -extends ./layout.pug +h1 Misskey ドキュメント -block title - | Misskey ドキュメント - -block main - h1 Misskey ドキュメント - - p Misskeyのドキュメントへようこそ +p Misskeyのドキュメントへようこそ diff --git a/src/web/docs/layout.pug b/src/web/docs/layout.pug index d6ecb4b6aa..f8570dd3ac 100644 --- a/src/web/docs/layout.pug +++ b/src/web/docs/layout.pug @@ -5,7 +5,7 @@ html(lang= lang) meta(charset="UTF-8") meta(name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no") title - block title + | #{title} | Misskey Docs link(rel="stylesheet" href="/assets/docs/style.css") block meta @@ -27,3 +27,5 @@ html(lang= lang) li: a(href=`/docs/${lang}/api/endpoints/${common.kebab(endpoint)}`)= endpoint main block main + if content + | !{content} diff --git a/src/web/docs/vars.ts b/src/web/docs/vars.ts index 80fdc9a7de..37bc9d7b0f 100644 --- a/src/web/docs/vars.ts +++ b/src/web/docs/vars.ts @@ -27,7 +27,7 @@ export default function() { title: {} }; } - vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/\r?\n\th1 (.+?)\r?\n/)[1]; + vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/^h1 (.+?)\r?\n/)[1]; }); vars['kebab'] = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); -- cgit v1.2.3-freya From 1a733f6b7128aed69fee2993eda1ec5f4ff9d79c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Dec 2017 01:06:28 +0900 Subject: :v: --- src/web/docs/api.ja.pug | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ src/web/docs/style.styl | 2 -- src/web/docs/vars.ts | 3 +++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 src/web/docs/api.ja.pug (limited to 'src') diff --git a/src/web/docs/api.ja.pug b/src/web/docs/api.ja.pug new file mode 100644 index 0000000000..588b926bdd --- /dev/null +++ b/src/web/docs/api.ja.pug @@ -0,0 +1,66 @@ +h1 Misskey API + +p MisskeyはWeb APIを公開しており、アプリケーションから様々な操作を行うことができます。 + +section + h2 自分の所有するアカウントからAPIにアクセスする場合 + p 「設定」で、APIにアクセスするのに必要なAPIキーを取得してください。 + p APIにアクセスする際には、リクエストにAPIキーを「i」というパラメータ名で含めます。 + p APIの詳しい使用法は「Misskey APIの利用」セクションをご覧ください。 + +section + h2 アプリケーションからAPIにアクセスする場合 + p + | あなたのWebサービスやアプリケーションなどからMisskey APIを利用したい場合、 + | ユーザーにアカウントへのアクセスを許可してもらい、ユーザーのアクセストークンを取得する必要があります。 + p アクセストークンを取得するまでの流れを説明します。 + + section + h3 1.アプリケーションを登録する + p まず、あなたのWebサービスやアプリケーションをMisskeyに登録します。 + p デベロッパーセンターから登録を行ってください。 + p 登録が済むとアプリケーションのシークレットキーが入手できます。 + + section + h3 2.ユーザーに認証させる + p あなたのアプリケーションを使ってもらうには、ユーザーにアカウントへのアクセスの許可をもらう必要があります。 + p + | 認証セッションを開始するには、#{common.config.api_url}/auth/session/generate へパラメータに app_secret としてシークレットキーを含めたリクエストを送信します。 + | リクエスト形式はJSONで、メソッドはPOSTです。 + | レスポンスとして認証セッションのトークンや認証フォームのURLが取得できるので、認証フォームのURLをブラウザで表示し、ユーザーにフォームを提示してください。 + + p + | あなたのアプリがコールバックURLを設定している場合、 + | ユーザーがアプリの連携を許可すると設定しているコールバックURLに token という名前でセッションのトークンが含まれたクエリを付けてリダイレクトします。 + + p + | あなたのアプリがコールバックURLを設定していない場合、ユーザーがアプリの連携を許可したことを(何らかの方法で(たとえばボタンを押させるなど))確認出来るようにしてください。 + + section + h3 3.ユーザーのアクセストークンを取得する + p ユーザーが連携を許可したら、#{common.config.api_url}/auth/session/userkey へ次のパラメータを含むリクエストを送信します: + table + thead + tr + th 名前 + th 型 + th 説明 + tbody + tr + td app_secret + td string + td アプリのシークレットキー + tr + td token + td string + td セッションのトークン + p 上手くいけば、認証したユーザーのアクセストークンがレスポンスとして取得できます。おめでとうございます! + + p アクセストークンが取得できたら、「ユーザーのアクセストークン+アプリのシークレットキーをsha256したもの」を「i」というパラメータでリクエストに含めるだけで、APIにアクセスできます。 + + p APIの詳しい使用法は「Misskey APIの利用」セクションをご覧ください。 + +section + h2 Misskey APIの利用 + p APIはすべてリクエストのパラメータ・レスポンスともにJSON形式です。また、すべてのエンドポイントはPOSTメソッドのみ受け付けます。 + p APIリファレンスもご確認ください。 diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl index 2e2f9f5743..f222e65bfd 100644 --- a/src/web/docs/style.styl +++ b/src/web/docs/style.styl @@ -77,8 +77,6 @@ table tbody tr - border-bottom dashed 1px #eee - &:nth-child(odd) background #fbfbfb diff --git a/src/web/docs/vars.ts b/src/web/docs/vars.ts index 37bc9d7b0f..ffa262a065 100644 --- a/src/web/docs/vars.ts +++ b/src/web/docs/vars.ts @@ -1,6 +1,7 @@ import * as fs from 'fs'; import * as glob from 'glob'; import * as yaml from 'js-yaml'; +import config from '../../conf'; export default function() { const vars = {}; @@ -32,5 +33,7 @@ export default function() { vars['kebab'] = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); + vars['config'] = config; + return vars; } -- cgit v1.2.3-freya From 42dad3873f863762262a4abfef2daa479ecc0bc0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Dec 2017 04:10:05 +0900 Subject: :v: --- src/web/docs/api/getting-started.md | 73 ------------------------------------- src/web/docs/api/library.md | 8 ---- src/web/docs/layout.pug | 9 +++-- src/web/docs/link-to-twitter.md | 9 ----- 4 files changed, 5 insertions(+), 94 deletions(-) delete mode 100644 src/web/docs/api/getting-started.md delete mode 100644 src/web/docs/api/library.md delete mode 100644 src/web/docs/link-to-twitter.md (limited to 'src') diff --git a/src/web/docs/api/getting-started.md b/src/web/docs/api/getting-started.md deleted file mode 100644 index e13659914e..0000000000 --- a/src/web/docs/api/getting-started.md +++ /dev/null @@ -1,73 +0,0 @@ -Getting Started -================================================================ -MisskeyはREST APIやStreaming APIを提供しており、プログラムからMisskeyの全ての機能を利用することができます。 -それらのAPIを利用するには、まずAPIを利用したいアカウントのアクセストークンを取得する必要があります: - -自分のアクセストークンを取得したい場合 ----------------------------------------------------------------- -自分自身のアクセストークンは、設定 > API で確認できます。 -

    - アカウントを乗っ取られてしまう可能性があるため、トークンは第三者に教えないでください(アプリなどにも入力しないでください)。
    - 万が一トークンが漏れたりその可能性がある場合は トークンを再生成できます。(副作用として、ログインしているすべてのデバイスでログアウトが発生します) -

    - -他人のアクセストークンを取得する ----------------------------------------------------------------- -不特定多数のユーザーからAPIを利用したい場合、アプリケーションを作成します。 -アプリケーションを作成すると、ユーザーが連携を許可した時に、そのユーザーのアクセストークンを取得することができます。 - -アプリケーションを作成してアクセストークンを取得するまでの流れを説明します。 - -### アプリケーションを作成する -まずはあなたのアプリケーションを作成しましょう。 - | デベロッパーセンターにアクセスし、アプリ > アプリ作成 に進みます。 - br - | 次に、フォームに必要事項を記入します: - dl - dt アプリケーション名 - dd あなたのアプリケーションの名前。 - dt Named ID - dd アプリを識別する/a-z-/で構成されたID。 - dt アプリの概要 - dd アプリの簡単な説明を入力してください。 - dt コールバックURL - dd あなたのアプリケーションがWebアプリケーションである場合、ユーザーが後述するフォームで認証を終えた際にリダイレクトするURLを設定できます。 - dt 権限 - dd アプリケーションが要求する権限。ここで要求した機能だけがAPIからアクセスできます。 - p.tip - | 権限はアプリ作成後も変更できますが、新たな権限を付与する場合、その時点で関連付けられているユーザーはすべて無効になります。 - p - | アプリケーションを作成すると、作ったアプリの管理ページに進みます。 - br - | アプリのシークレットキー(App Secret)が表示されていますので、メモしておいてください。 - p.tip - | アプリに成りすまされる可能性があるため、極力このシークレットキーは公開しないようにしてください。 - - section - h3 ユーザーに認証させる - p あなたのアプリを使ってもらうには、ユーザーにアカウントへアクセスすることを許可してもらい、Misskeyにそのユーザーのアクセストークンを発行してもらう必要があります。 - p 認証セッションを開始するには、#{api_url}/auth/session/generateへパラメータにapp_secretとしてApp Secretを含めたリクエストを送信します。 - p - | そうすると、レスポンスとして認証セッションのトークンや認証フォームのURLが取得できます。 - br - | この認証フォームのURLをブラウザで表示し、ユーザーにフォームを表示してください。 - section - h4 あなたのアプリがコールバックURLを設定している場合 - p ユーザーがアプリの連携を許可すると設定しているコールバックURLにtokenという名前でセッションのトークンが含まれたクエリを付けてリダイレクトします。 - section - h4 あなたのアプリがコールバックURLを設定していない場合 - p ユーザーがアプリの連携を許可したことを(何らかの方法で(たとえばボタンを押させるなど))確認出来るようにしてください。 - p - | 次に、#{api_url}/auth/session/userkeyapp_secretとしてApp Secretを、tokenとしてセッションのトークンをパラメータとして付与したリクエストを送信してください。 - br - | 上手くいけば、認証したユーザーのアクセストークンがレスポンスとして取得できます。おめでとうございます! - p - | 以降アクセストークンは、ユーザーのアクセストークン+アプリのシークレットキーをsha256したものとして扱います。 - - p アクセストークンを取得できたら、あとは簡単です。REST APIなら、リクエストにアクセストークンをiとしてパラメータに含めるだけです。 - - section - h2 リクエスト形式 - p application/jsonを受け付けます。 - p.tip - | 現在application/x-www-form-urlencodedも受け付けていますが、将来的にこのサポートはされなくなる予定です。 diff --git a/src/web/docs/api/library.md b/src/web/docs/api/library.md deleted file mode 100644 index 71ddbe345d..0000000000 --- a/src/web/docs/api/library.md +++ /dev/null @@ -1,8 +0,0 @@ -ライブラリ -================================================================ - -Misskey APIを便利に利用するためのライブラリ一覧です。 - -.NET ----------------------------------------------------------------- -* **[Misq (公式)](https://github.com/syuilo/Misq)** diff --git a/src/web/docs/layout.pug b/src/web/docs/layout.pug index f8570dd3ac..ac3743d2f4 100644 --- a/src/web/docs/layout.pug +++ b/src/web/docs/layout.pug @@ -3,28 +3,29 @@ doctype html html(lang= lang) head meta(charset="UTF-8") - meta(name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no") + meta(name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no") title | #{title} | Misskey Docs link(rel="stylesheet" href="/assets/docs/style.css") block meta + base(href=`/docs/${lang}/`) body nav ul each doc in common.docs - li: a(href=`/docs/${lang}/${doc.name}`)= doc.title[lang] || doc.title['ja'] + li: a(href=`./${doc.name}`)= doc.title[lang] || doc.title['ja'] section h2 API ul li Entities ul each entity in common.entities - li: a(href=`/docs/${lang}/api/entities/${common.kebab(entity)}`)= entity + li: a(href=`./api/entities/${common.kebab(entity)}`)= entity li Endpoints ul each endpoint in common.endpoints - li: a(href=`/docs/${lang}/api/endpoints/${common.kebab(endpoint)}`)= endpoint + li: a(href=`./api/endpoints/${common.kebab(endpoint)}`)= endpoint main block main if content diff --git a/src/web/docs/link-to-twitter.md b/src/web/docs/link-to-twitter.md deleted file mode 100644 index 77fb744576..0000000000 --- a/src/web/docs/link-to-twitter.md +++ /dev/null @@ -1,9 +0,0 @@ -Twitterと連携する -================================================================ - -設定 -> Twitter から、お使いのMisskeyアカウントとお使いのTwitterアカウントを関連付けることができます。 -アカウントの関連付けを行うと、プロフィールにTwitterアカウントへのリンクが表示されたりなどします。 - -MisskeyがあなたのTwitterアカウントでツイートしたり誰かをフォローしたりといったことは、 -一切行いませんのでご安心ください。(Misskeyはそのような権限を取得しないので、行おうと思っても行えません) -Twitterのアプリケーション認証フォームでこの権限の詳細を確認することができます。また、いつでも連携を取り消すことができます。 -- cgit v1.2.3-freya From 446b6a4f6bb376abdd6ebee5546f568d8c5dbc83 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Dec 2017 05:04:02 +0900 Subject: :v: --- src/web/docs/api/endpoints/posts/timeline.yaml | 32 ++++++++++++++++++++++++++ src/web/docs/api/endpoints/view.pug | 7 +++--- src/web/docs/api/gulpfile.ts | 4 ++-- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 src/web/docs/api/endpoints/posts/timeline.yaml (limited to 'src') diff --git a/src/web/docs/api/endpoints/posts/timeline.yaml b/src/web/docs/api/endpoints/posts/timeline.yaml new file mode 100644 index 0000000000..e1d78c082e --- /dev/null +++ b/src/web/docs/api/endpoints/posts/timeline.yaml @@ -0,0 +1,32 @@ +endpoint: "posts/timeline" + +desc: + ja: "タイムラインを取得します。" + en: "Get your timeline." + +params: + - name: "limit" + type: "number" + optional: true + desc: + ja: "取得する最大の数" + - name: "since_id" + type: "id(Post)" + optional: true + desc: + ja: "指定すると、この投稿を基点としてより新しい投稿を取得します" + - name: "max_id" + type: "id(Post)" + optional: true + desc: + ja: "指定すると、この投稿を基点としてより古い投稿を取得します" + - name: "since_date" + type: "number" + optional: true + desc: + ja: "指定した時間を基点としてより新しい投稿を取得します。数値は、1970 年 1 月 1 日 00:00:00 UTC から指定した日時までの経過時間をミリ秒単位で表します。" + - name: "max_date" + type: "number" + optional: true + desc: + ja: "指定した時間を基点としてより古い投稿を取得します。数値は、1970 年 1 月 1 日 00:00:00 UTC から指定した日時までの経過時間をミリ秒単位で表します。" diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug index d456022f6e..62a6f59edd 100644 --- a/src/web/docs/api/endpoints/view.pug +++ b/src/web/docs/api/endpoints/view.pug @@ -21,6 +21,7 @@ block main h3= paramDef.name +propTable(paramDef.params) - section - h2 Response - +propTable(res) + if res + section + h2 Response + +propTable(res) diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts index 139ae92412..908280453c 100644 --- a/src/web/docs/api/gulpfile.ts +++ b/src/web/docs/api/gulpfile.ts @@ -106,8 +106,8 @@ gulp.task('doc:api:endpoints', () => { desc: ep.desc, params: sortParams(ep.params.map(p => parseParam(p))), paramDefs: extractDefs(ep.params), - res: sortParams(ep.res.map(p => parseParam(p))), - resDefs: extractDefs(ep.res), + res: ep.res ? sortParams(ep.res.map(p => parseParam(p))) : null, + resDefs: ep.res ? extractDefs(ep.res) : null, }; langs.forEach(lang => { pug.renderFile('./src/web/docs/api/endpoints/view.pug', Object.assign({}, vars, { -- cgit v1.2.3-freya From 076956640871df99249e43e7df133f4f4e06043e Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 17 Dec 2017 01:41:22 +0900 Subject: :v: --- docs/setup.en.md | 2 +- docs/setup.ja.md | 2 +- gulpfile.ts | 15 ++++----------- package.json | 2 -- src/config.ts | 4 ++-- src/web/app/common/tags/introduction.tag | 2 +- src/web/app/common/tags/nav-links.tag | 5 ++++- src/web/app/common/tags/signup.tag | 4 +++- src/web/app/common/tags/twitter-setting.tag | 2 +- src/web/app/desktop/tags/pages/entrance.tag | 2 +- src/web/app/mobile/tags/ui.tag | 4 +++- src/web/docs/about.en.pug | 3 +++ src/web/docs/about.ja.pug | 3 +++ src/web/docs/api/endpoints/view.pug | 2 +- src/web/docs/api/entities/view.pug | 2 +- src/web/docs/api/mixins.pug | 4 ++-- src/web/docs/gulpfile.ts | 2 +- src/web/docs/layout.pug | 4 ++-- src/web/docs/server.ts | 21 +++++++++++++++++++++ src/web/docs/tou.ja.pug | 3 +++ src/web/docs/tou.md | 4 ---- src/web/server.ts | 11 +++++------ tools/letsencrypt/get-cert.sh | 2 +- webpack/plugins/consts.ts | 2 +- 24 files changed, 65 insertions(+), 42 deletions(-) create mode 100644 src/web/docs/about.en.pug create mode 100644 src/web/docs/about.ja.pug create mode 100644 src/web/docs/server.ts create mode 100644 src/web/docs/tou.ja.pug delete mode 100644 src/web/docs/tou.md (limited to 'src') diff --git a/docs/setup.en.md b/docs/setup.en.md index b81245d892..13b0bdaeb5 100644 --- a/docs/setup.en.md +++ b/docs/setup.en.md @@ -24,7 +24,7 @@ Note that Misskey uses following subdomains: * **api**.*{primary domain}* * **auth**.*{primary domain}* -* **about**.*{primary domain}* +* **docs**.*{primary domain}* * **ch**.*{primary domain}* * **stats**.*{primary domain}* * **status**.*{primary domain}* diff --git a/docs/setup.ja.md b/docs/setup.ja.md index 1662d1ee5a..564c790978 100644 --- a/docs/setup.ja.md +++ b/docs/setup.ja.md @@ -25,7 +25,7 @@ Misskeyは以下のサブドメインを使います: * **api**.*{primary domain}* * **auth**.*{primary domain}* -* **about**.*{primary domain}* +* **docs**.*{primary domain}* * **ch**.*{primary domain}* * **stats**.*{primary domain}* * **status**.*{primary domain}* diff --git a/gulpfile.ts b/gulpfile.ts index e7d4770610..3b7a126407 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -9,7 +9,6 @@ import * as gulp from 'gulp'; import * as gutil from 'gulp-util'; import * as ts from 'gulp-typescript'; import tslint from 'gulp-tslint'; -import * as es from 'event-stream'; import cssnano = require('gulp-cssnano'); import * as uglifyComposer from 'gulp-uglify/composer'; import pug = require('gulp-pug'); @@ -74,16 +73,10 @@ gulp.task('build:ts', () => { }); gulp.task('build:copy', () => - es.merge( - gulp.src([ - './src/**/assets/**/*', - '!./src/web/app/**/assets/**/*' - ]).pipe(gulp.dest('./built/')) as any, - gulp.src([ - './src/web/about/**/*', - '!./src/web/about/**/*.pug' - ]).pipe(gulp.dest('./built/web/about/')) as any - ) + gulp.src([ + './src/**/assets/**/*', + '!./src/web/app/**/assets/**/*' + ]).pipe(gulp.dest('./built/')) ); gulp.task('test', ['lint', 'mocha']); diff --git a/package.json b/package.json index 29ba72bbe4..8c0cf340db 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "@types/debug": "0.0.30", "@types/deep-equal": "1.0.1", "@types/elasticsearch": "5.0.19", - "@types/event-stream": "3.3.33", "@types/eventemitter3": "2.0.2", "@types/express": "4.0.39", "@types/gm": "1.17.33", @@ -99,7 +98,6 @@ "diskusage": "0.2.4", "elasticsearch": "14.0.0", "escape-regexp": "0.0.1", - "event-stream": "3.3.4", "eventemitter3": "3.0.0", "exif-js": "2.3.0", "express": "4.16.2", diff --git a/src/config.ts b/src/config.ts index 3ff8007586..3ffefe278b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -101,7 +101,7 @@ type Mixin = { secondary_scheme: string; api_url: string; auth_url: string; - about_url: string; + docs_url: string; ch_url: string; stats_url: string; status_url: string; @@ -131,7 +131,7 @@ export default function load() { mixin.auth_url = `${mixin.scheme}://auth.${mixin.host}`; mixin.ch_url = `${mixin.scheme}://ch.${mixin.host}`; mixin.dev_url = `${mixin.scheme}://dev.${mixin.host}`; - mixin.about_url = `${mixin.scheme}://about.${mixin.host}`; + mixin.docs_url = `${mixin.scheme}://docs.${mixin.host}`; mixin.stats_url = `${mixin.scheme}://stats.${mixin.host}`; mixin.status_url = `${mixin.scheme}://status.${mixin.host}`; mixin.drive_url = `${mixin.secondary_scheme}://file.${mixin.secondary_host}`; diff --git a/src/web/app/common/tags/introduction.tag b/src/web/app/common/tags/introduction.tag index 3256688d10..28afc6fa46 100644 --- a/src/web/app/common/tags/introduction.tag +++ b/src/web/app/common/tags/introduction.tag @@ -3,7 +3,7 @@

    Misskeyとは?

    Misskeyみすきーは、syuiloが2014年くらいからオープンソースで開発・運営を行っている、ミニブログベースのSNSです。

    無料で誰でも利用でき、広告も掲載していません。

    -

    もっと知りたい方はこちら

    +

    もっと知りたい方はこちら

    + diff --git a/src/web/app/common/tags/signup.tag b/src/web/app/common/tags/signup.tag index 4816fe66db..b488efb927 100644 --- a/src/web/app/common/tags/signup.tag +++ b/src/web/app/common/tags/signup.tag @@ -34,7 +34,7 @@ @@ -182,6 +182,8 @@ this.passwordRetypeState = null; this.recaptchaed = false; + this.aboutUrl = `${_DOCS_URL_}/${_LANG_}/tou`; + window.onRecaptchaed = () => { this.recaptchaed = true; this.update(); diff --git a/src/web/app/common/tags/twitter-setting.tag b/src/web/app/common/tags/twitter-setting.tag index 3b70505ba2..4d57cfa55a 100644 --- a/src/web/app/common/tags/twitter-setting.tag +++ b/src/web/app/common/tags/twitter-setting.tag @@ -1,5 +1,5 @@ -

    %i18n:common.tags.mk-twitter-setting.description%%i18n:common.tags.mk-twitter-setting.detail%

    +

    %i18n:common.tags.mk-twitter-setting.description%%i18n:common.tags.mk-twitter-setting.detail%

    { I.twitter ? '%i18n:common.tags.mk-twitter-setting.reconnect%' : '%i18n:common.tags.mk-twitter-setting.connect%' } diff --git a/src/web/app/desktop/tags/pages/entrance.tag b/src/web/app/desktop/tags/pages/entrance.tag index 44548e4183..b07b22c80c 100644 --- a/src/web/app/desktop/tags/pages/entrance.tag +++ b/src/web/app/desktop/tags/pages/entrance.tag @@ -150,7 +150,7 @@ - %fa:question% + %fa:question%

    { user ? user.name : 'アカウント' }

    diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag index 62e128489a..621f89f336 100644 --- a/src/web/app/mobile/tags/ui.tag +++ b/src/web/app/mobile/tags/ui.tag @@ -248,7 +248,7 @@
  • %fa:cog%%i18n:mobile.tags.mk-ui-nav.settings%%fa:angle-right%
-

%i18n:mobile.tags.mk-ui-nav.about%

+

%i18n:mobile.tags.mk-ui-nav.about%

- diff --git a/src/web/app/common/tags/index.ts b/src/web/app/common/tags/index.ts index 2f4e1181d4..df99d93cc5 100644 --- a/src/web/app/common/tags/index.ts +++ b/src/web/app/common/tags/index.ts @@ -12,7 +12,6 @@ require('./signin.tag'); require('./signup.tag'); require('./forkit.tag'); require('./introduction.tag'); -require('./copyright.tag'); require('./signin-history.tag'); require('./twitter-setting.tag'); require('./authorized-apps.tag'); diff --git a/src/web/app/desktop/tags/pages/entrance.tag b/src/web/app/desktop/tags/pages/entrance.tag index b07b22c80c..974f49a4fe 100644 --- a/src/web/app/desktop/tags/pages/entrance.tag +++ b/src/web/app/desktop/tags/pages/entrance.tag @@ -18,7 +18,7 @@
- +

{ _COPYRIGHT_ }

@@ -101,7 +101,7 @@ text-align center border-top solid 1px #fff - > mk-copyright + > .c margin 0 line-height 64px font-size 10px diff --git a/src/web/app/mobile/tags/page/entrance.tag b/src/web/app/mobile/tags/page/entrance.tag index 380fb780bc..191874caf9 100644 --- a/src/web/app/mobile/tags/page/entrance.tag +++ b/src/web/app/mobile/tags/page/entrance.tag @@ -8,7 +8,7 @@
- +

{ _COPYRIGHT_ }

diff --git a/src/web/app/mobile/router.ts b/src/web/app/mobile/router.ts index d0c6add0b8..afb9aa6201 100644 --- a/src/web/app/mobile/router.ts +++ b/src/web/app/mobile/router.ts @@ -23,7 +23,7 @@ export default (mios: MiOS) => { route('/i/settings/authorized-apps', settingsAuthorizedApps); route('/post/new', newPost); route('/post::post', post); - route('/search::query', search); + route('/search', search); route('/:user', user.bind(null, 'overview')); route('/:user/graphs', user.bind(null, 'graphs')); route('/:user/followers', userFollowers); @@ -83,7 +83,7 @@ export default (mios: MiOS) => { function search(ctx) { const el = document.createElement('mk-search-page'); - el.setAttribute('query', ctx.params.query); + el.setAttribute('query', ctx.querystring.substr(2)); mount(el); } diff --git a/src/web/app/mobile/tags/search-posts.tag b/src/web/app/mobile/tags/search-posts.tag index 967764bc2c..023a35bf62 100644 --- a/src/web/app/mobile/tags/search-posts.tag +++ b/src/web/app/mobile/tags/search-posts.tag @@ -15,6 +15,8 @@ width calc(100% - 32px) diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug new file mode 100644 index 0000000000..f7ec9519f5 --- /dev/null +++ b/src/web/docs/search.ja.pug @@ -0,0 +1,38 @@ +h1 検索 + +p 投稿を検索することができます。 +p + | キーワードを半角スペースで区切ると、and検索になります。 + | 例えば、「git コミット」と検索すると、「gitで編集したファイルの特定の行だけコミットする方法がわからない」などがマッチします。 + +section + h2 オプション + p + | オプションを使用して、より高度な検索をすることもできます。 + | オプションを指定するには、「オプション名:値」という形式でクエリに含めます。 + p 利用可能なオプション一覧です: + + table + thead + tr + th 名前 + th 説明 + tbody + tr + td user + td ユーザー名。投稿者を限定します。 + tr + td reply + td 返信を含めるか否か。(trueかfalse) + tr + td media + td メディアが添付されているか。(trueかfalse) + tr + td until + td 上限の日時。(YYYY-MM-DD) + tr + td since + td 下限の日時。(YYYY-MM-DD) + + p 例えば、「@syuiloの2017年11月1日から2017年12月31日までの『Misskey』というテキストを含む返信ではない投稿」を検索したい場合、クエリは以下のようになります: + code user:syuilo since:2017-11-01 until:2017-12-31 reply:false Misskey -- cgit v1.2.3-freya From 59120063fe792ba0bc230749a36b1e4acf86443f Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Thu, 21 Dec 2017 06:31:56 +0900 Subject: #1023 --- src/api/endpoints/posts/search.ts | 21 ++++++++++++++++++--- src/web/app/common/scripts/parse-search-query.ts | 3 +++ src/web/docs/search.ja.pug | 3 +++ 3 files changed, 24 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index dba7a53b5f..88cdd32dac 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -6,6 +6,7 @@ import $ from 'cafy'; const escapeRegexp = require('escape-regexp'); import Post from '../../models/post'; import User from '../../models/user'; +import getFriends from '../../common/get-friends'; import serialize from '../../serializers/post'; import config from '../../../conf'; @@ -29,6 +30,10 @@ module.exports = (params, me) => new Promise(async (res, rej) => { const [username, usernameErr] = $(params.username).optional.string().$; if (usernameErr) return rej('invalid username param'); + // Get 'following' parameter + const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$; + if (followingErr) return rej('invalid following param'); + // Get 'include_replies' parameter const [includeReplies = true, includeRepliesErr] = $(params.include_replies).optional.boolean().$; if (includeRepliesErr) return rej('invalid include_replies param'); @@ -67,11 +72,11 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // If Elasticsearch is available, search by it // If not, search by MongoDB (config.elasticsearch.enable ? byElasticsearch : byNative) - (res, rej, me, text, user, includeReplies, withMedia, sinceDate, untilDate, offset, limit); + (res, rej, me, text, user, following, includeReplies, withMedia, sinceDate, untilDate, offset, limit); }); // Search by MongoDB -async function byNative(res, rej, me, text, userId, includeReplies, withMedia, sinceDate, untilDate, offset, max) { +async function byNative(res, rej, me, text, userId, following, includeReplies, withMedia, sinceDate, untilDate, offset, max) { const q: any = {}; if (text) { @@ -84,6 +89,16 @@ async function byNative(res, rej, me, text, userId, includeReplies, withMedia, s q.user_id = userId; } + if (following != null) { + const ids = await getFriends(me._id, false); + q.user_id = {}; + if (following) { + q.user_id.$in = ids; + } else { + q.user_id.$nin = ids; + } + } + if (!includeReplies) { q.reply_id = null; } @@ -122,7 +137,7 @@ async function byNative(res, rej, me, text, userId, includeReplies, withMedia, s } // Search by Elasticsearch -async function byElasticsearch(res, rej, me, text, userId, includeReplies, withMedia, sinceDate, untilDate, offset, max) { +async function byElasticsearch(res, rej, me, text, userId, following, includeReplies, withMedia, sinceDate, untilDate, offset, max) { const es = require('../../db/elasticsearch'); es.search({ diff --git a/src/web/app/common/scripts/parse-search-query.ts b/src/web/app/common/scripts/parse-search-query.ts index adcbfbb8fe..62b2cf51b1 100644 --- a/src/web/app/common/scripts/parse-search-query.ts +++ b/src/web/app/common/scripts/parse-search-query.ts @@ -10,6 +10,9 @@ export default function(qs: string) { case 'user': q['username'] = value; break; + case 'follow': + q['following'] = value == 'null' ? null : value == 'true'; + break; case 'reply': q['include_replies'] = value == 'true'; break; diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index f7ec9519f5..7d4d23fb6a 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -21,6 +21,9 @@ section tr td user td ユーザー名。投稿者を限定します。 + tr + td follow + td フォローしているユーザーのみに限定。(trueかfalse) tr td reply td 返信を含めるか否か。(trueかfalse) -- cgit v1.2.3-freya From 40f5e67ff0f803fab117c405a0614df915381433 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Thu, 21 Dec 2017 07:35:16 +0900 Subject: :v: --- src/api/endpoints/posts/search.ts | 130 +++++++++++++++++------ src/web/app/common/scripts/parse-search-query.ts | 7 +- src/web/docs/search.ja.pug | 29 ++++- 3 files changed, 131 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 88cdd32dac..21e9134d38 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -34,13 +34,17 @@ module.exports = (params, me) => new Promise(async (res, rej) => { const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$; if (followingErr) return rej('invalid following param'); - // Get 'include_replies' parameter - const [includeReplies = true, includeRepliesErr] = $(params.include_replies).optional.boolean().$; - if (includeRepliesErr) return rej('invalid include_replies param'); + // Get 'reply' parameter + const [reply = null, replyErr] = $(params.reply).optional.nullable.boolean().$; + if (replyErr) return rej('invalid reply param'); - // Get 'with_media' parameter - const [withMedia = false, withMediaErr] = $(params.with_media).optional.boolean().$; - if (withMediaErr) return rej('invalid with_media param'); + // Get 'repost' parameter + const [repost = null, repostErr] = $(params.repost).optional.nullable.boolean().$; + if (repostErr) return rej('invalid repost param'); + + // Get 'media' parameter + const [media = null, mediaErr] = $(params.media).optional.nullable.boolean().$; + if (mediaErr) return rej('invalid media param'); // Get 'since_date' parameter const [sinceDate, sinceDateErr] = $(params.since_date).optional.number().$; @@ -72,53 +76,119 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // If Elasticsearch is available, search by it // If not, search by MongoDB (config.elasticsearch.enable ? byElasticsearch : byNative) - (res, rej, me, text, user, following, includeReplies, withMedia, sinceDate, untilDate, offset, limit); + (res, rej, me, text, user, following, reply, repost, media, sinceDate, untilDate, offset, limit); }); // Search by MongoDB -async function byNative(res, rej, me, text, userId, following, includeReplies, withMedia, sinceDate, untilDate, offset, max) { - const q: any = {}; +async function byNative(res, rej, me, text, userId, following, reply, repost, media, sinceDate, untilDate, offset, max) { + const q: any = { + $and: [] + }; + + const push = q.$and.push; if (text) { - q.$and = text.split(' ').map(x => ({ - text: new RegExp(escapeRegexp(x)) - })); + push({ + $and: text.split(' ').map(x => ({ + text: new RegExp(escapeRegexp(x)) + })) + }); } if (userId) { - q.user_id = userId; + push({ + user_id: userId + }); } if (following != null) { const ids = await getFriends(me._id, false); - q.user_id = {}; - if (following) { - q.user_id.$in = ids; + push({ + user_id: following ? { + $in: ids + } : { + $nin: ids + } + }); + } + + if (reply != null) { + if (reply) { + push({ + reply_id: { + $exists: true, + $ne: null + } + }); } else { - q.user_id.$nin = ids; + push({ + $or: [{ + reply_id: { + $exists: false + } + }, { + reply_id: null + }] + }); } } - if (!includeReplies) { - q.reply_id = null; + if (repost != null) { + if (repost) { + push({ + repost_id: { + $exists: true, + $ne: null + } + }); + } else { + push({ + $or: [{ + repost_id: { + $exists: false + } + }, { + repost_id: null + }] + }); + } } - if (withMedia) { - q.media_ids = { - $exists: true, - $ne: null - }; + if (media != null) { + if (media) { + push({ + media_ids: { + $exists: true, + $ne: null + } + }); + } else { + push({ + $or: [{ + media_ids: { + $exists: false + } + }, { + media_ids: null + }] + }); + } } if (sinceDate) { - q.created_at = { - $gt: new Date(sinceDate) - }; + push({ + created_at: { + $gt: new Date(sinceDate) + } + }); } if (untilDate) { - if (q.created_at == undefined) q.created_at = {}; - q.created_at.$lt = new Date(untilDate); + push({ + created_at: { + $lt: new Date(untilDate) + } + }); } // Search posts @@ -137,7 +207,7 @@ async function byNative(res, rej, me, text, userId, following, includeReplies, w } // Search by Elasticsearch -async function byElasticsearch(res, rej, me, text, userId, following, includeReplies, withMedia, sinceDate, untilDate, offset, max) { +async function byElasticsearch(res, rej, me, text, userId, following, reply, repost, media, sinceDate, untilDate, offset, max) { const es = require('../../db/elasticsearch'); es.search({ diff --git a/src/web/app/common/scripts/parse-search-query.ts b/src/web/app/common/scripts/parse-search-query.ts index 62b2cf51b1..f65e4683a6 100644 --- a/src/web/app/common/scripts/parse-search-query.ts +++ b/src/web/app/common/scripts/parse-search-query.ts @@ -14,10 +14,13 @@ export default function(qs: string) { q['following'] = value == 'null' ? null : value == 'true'; break; case 'reply': - q['include_replies'] = value == 'true'; + q['reply'] = value == 'null' ? null : value == 'true'; + break; + case 'repost': + q['repost'] = value == 'null' ? null : value == 'true'; break; case 'media': - q['with_media'] = value == 'true'; + q['media'] = value == 'null' ? null : value == 'true'; break; case 'until': case 'since': diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index 7d4d23fb6a..d46e5f4a04 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -23,13 +23,36 @@ section td ユーザー名。投稿者を限定します。 tr td follow - td フォローしているユーザーのみに限定。(trueかfalse) + td + | true ... フォローしているユーザーに限定。 + br + | false ... フォローしていないユーザーに限定。 + br + | null ... 特に限定しない(デフォルト) tr td reply - td 返信を含めるか否か。(trueかfalse) + td + | true ... 返信に限定。 + br + | false ... 返信でない投稿に限定。 + br + | null ... 特に限定しない(デフォルト) + tr + td repost + td + | true ... Repostに限定。 + br + | false ... Repostでない投稿に限定。 + br + | null ... 特に限定しない(デフォルト) tr td media - td メディアが添付されているか。(trueかfalse) + td + | true ... メディアが添付されている投稿に限定。 + br + | false ... メディアが添付されていない投稿に限定。 + br + | null ... 特に限定しない(デフォルト) tr td until td 上限の日時。(YYYY-MM-DD) -- cgit v1.2.3-freya From b2223c19e18ee5884ea13ec0d33f3ddb1ac9ea27 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Thu, 21 Dec 2017 07:45:45 +0900 Subject: Fix bug --- src/api/endpoints/posts/search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 21e9134d38..a3c44d09ce 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -85,7 +85,7 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me $and: [] }; - const push = q.$and.push; + const push = x => q.$and.push(x); if (text) { push({ -- cgit v1.2.3-freya From aff76a57c0d123b992d7284faba6c5a146985246 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Thu, 21 Dec 2017 07:57:31 +0900 Subject: :v: --- src/api/endpoints/posts/search.ts | 31 +++++++++++++++++++++--- src/web/app/common/scripts/parse-search-query.ts | 3 +++ src/web/docs/search.ja.pug | 8 ++++++ 3 files changed, 39 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index a3c44d09ce..777cd7909a 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -46,6 +46,10 @@ module.exports = (params, me) => new Promise(async (res, rej) => { const [media = null, mediaErr] = $(params.media).optional.nullable.boolean().$; if (mediaErr) return rej('invalid media param'); + // Get 'poll' parameter + const [poll = null, pollErr] = $(params.poll).optional.nullable.boolean().$; + if (pollErr) return rej('invalid poll param'); + // Get 'since_date' parameter const [sinceDate, sinceDateErr] = $(params.since_date).optional.number().$; if (sinceDateErr) throw 'invalid since_date param'; @@ -76,11 +80,11 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // If Elasticsearch is available, search by it // If not, search by MongoDB (config.elasticsearch.enable ? byElasticsearch : byNative) - (res, rej, me, text, user, following, reply, repost, media, sinceDate, untilDate, offset, limit); + (res, rej, me, text, user, following, reply, repost, media, poll, sinceDate, untilDate, offset, limit); }); // Search by MongoDB -async function byNative(res, rej, me, text, userId, following, reply, repost, media, sinceDate, untilDate, offset, max) { +async function byNative(res, rej, me, text, userId, following, reply, repost, media, poll, sinceDate, untilDate, offset, max) { const q: any = { $and: [] }; @@ -175,6 +179,27 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me } } + if (poll != null) { + if (poll) { + push({ + poll: { + $exists: true, + $ne: null + } + }); + } else { + push({ + $or: [{ + poll: { + $exists: false + } + }, { + poll: null + }] + }); + } + } + if (sinceDate) { push({ created_at: { @@ -207,7 +232,7 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me } // Search by Elasticsearch -async function byElasticsearch(res, rej, me, text, userId, following, reply, repost, media, sinceDate, untilDate, offset, max) { +async function byElasticsearch(res, rej, me, text, userId, following, reply, repost, media, poll, sinceDate, untilDate, offset, max) { const es = require('../../db/elasticsearch'); es.search({ diff --git a/src/web/app/common/scripts/parse-search-query.ts b/src/web/app/common/scripts/parse-search-query.ts index f65e4683a6..c021ee6417 100644 --- a/src/web/app/common/scripts/parse-search-query.ts +++ b/src/web/app/common/scripts/parse-search-query.ts @@ -22,6 +22,9 @@ export default function(qs: string) { case 'media': q['media'] = value == 'null' ? null : value == 'true'; break; + case 'poll': + q['poll'] = value == 'null' ? null : value == 'true'; + break; case 'until': case 'since': // YYYY-MM-DD diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index d46e5f4a04..41e443d746 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -53,6 +53,14 @@ section | false ... メディアが添付されていない投稿に限定。 br | null ... 特に限定しない(デフォルト) + tr + td poll + td + | true ... 投票が添付されている投稿に限定。 + br + | false ... 投票が添付されていない投稿に限定。 + br + | null ... 特に限定しない(デフォルト) tr td until td 上限の日時。(YYYY-MM-DD) -- cgit v1.2.3-freya From 169142cec3e10f157b43342267e22c11f890ff29 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Thu, 21 Dec 2017 11:08:17 +0900 Subject: Fix #1025 --- src/web/app/desktop/tags/search-posts.tag | 13 +++++++------ src/web/app/mobile/tags/search-posts.tag | 10 ++++------ 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/web/app/desktop/tags/search-posts.tag b/src/web/app/desktop/tags/search-posts.tag index c6b24837d2..2acb675d44 100644 --- a/src/web/app/desktop/tags/search-posts.tag +++ b/src/web/app/desktop/tags/search-posts.tag @@ -41,7 +41,8 @@ this.isLoading = true; this.isEmpty = false; this.moreLoading = false; - this.page = 0; + this.limit = 30; + this.offset = 0; this.on('mount', () => { document.addEventListener('keydown', this.onDocumentKeydown); @@ -72,16 +73,16 @@ this.more = () => { if (this.moreLoading || this.isLoading || this.timeline.posts.length == 0) return; + this.offset += this.limit; this.update({ moreLoading: true }); - this.api('posts/search', { - query: this.query, - page: this.page + 1 + return this.api('posts/search', Object.assign({}, parse(this.query), { + limit: this.limit, + offset: this.offset }).then(posts => { this.update({ - moreLoading: false, - page: page + 1 + moreLoading: false }); this.refs.timeline.prependPosts(posts); }); diff --git a/src/web/app/mobile/tags/search-posts.tag b/src/web/app/mobile/tags/search-posts.tag index 023a35bf62..b37ba69e85 100644 --- a/src/web/app/mobile/tags/search-posts.tag +++ b/src/web/app/mobile/tags/search-posts.tag @@ -19,11 +19,10 @@ this.mixin('api'); - this.max = 30; + this.limit = 30; this.offset = 0; this.query = this.opts.query; - this.withMedia = this.opts.withMedia; this.init = new Promise((res, rej) => { this.api('posts/search', parse(this.query)).then(posts => { @@ -33,10 +32,9 @@ }); this.more = () => { - this.offset += this.max; - return this.api('posts/search', { - query: this.query, - max: this.max, + this.offset += this.limit; + return this.api('posts/search', Object.assign({}, parse(this.query), { + limit: this.limit, offset: this.offset }); }; -- cgit v1.2.3-freya From f7d3b2c6ec8b467390bd030ddf7215a09610faad Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Thu, 21 Dec 2017 11:13:49 +0900 Subject: oops --- src/web/app/desktop/tags/search-posts.tag | 2 +- src/web/app/mobile/tags/search-posts.tag | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/app/desktop/tags/search-posts.tag b/src/web/app/desktop/tags/search-posts.tag index 2acb675d44..f7ec85a4fe 100644 --- a/src/web/app/desktop/tags/search-posts.tag +++ b/src/web/app/desktop/tags/search-posts.tag @@ -80,7 +80,7 @@ return this.api('posts/search', Object.assign({}, parse(this.query), { limit: this.limit, offset: this.offset - }).then(posts => { + })).then(posts => { this.update({ moreLoading: false }); diff --git a/src/web/app/mobile/tags/search-posts.tag b/src/web/app/mobile/tags/search-posts.tag index b37ba69e85..3e3c034f21 100644 --- a/src/web/app/mobile/tags/search-posts.tag +++ b/src/web/app/mobile/tags/search-posts.tag @@ -36,7 +36,7 @@ return this.api('posts/search', Object.assign({}, parse(this.query), { limit: this.limit, offset: this.offset - }); + })); }; -- cgit v1.2.3-freya From 0dc97370a34d88c9274f5a89f1714d7ce99f7a25 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 21 Dec 2017 15:28:50 +0900 Subject: Fix bug --- src/api/endpoints/posts/search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 777cd7909a..bd3bbfc12e 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -105,7 +105,7 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me }); } - if (following != null) { + if (following != null && me != null) { const ids = await getFriends(me._id, false); push({ user_id: following ? { -- cgit v1.2.3-freya From fd28d1bcc325ad22afc8584fc9fe6e9091d0524a Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 21 Dec 2017 15:30:15 +0900 Subject: #1026 --- src/api/endpoints/posts/search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index bd3bbfc12e..16d54f729f 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -111,7 +111,7 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me user_id: following ? { $in: ids } : { - $nin: ids + $nin: ids.concat(me._id) } }); } -- cgit v1.2.3-freya From 41623f85901437631707c308e0550b9be8e7b782 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 21 Dec 2017 15:37:26 +0900 Subject: Fix bug --- src/api/endpoints/posts/search.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 16d54f729f..ac25652a0b 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -85,7 +85,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Search by MongoDB async function byNative(res, rej, me, text, userId, following, reply, repost, media, poll, sinceDate, untilDate, offset, max) { - const q: any = { + let q: any = { $and: [] }; @@ -216,6 +216,10 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me }); } + if (q.$and.length == 0) { + q = {}; + } + // Search posts const posts = await Post .find(q, { -- cgit v1.2.3-freya From 8fd78aebbf01755ffdecb9aa17dff1f842b194ff Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Fri, 22 Dec 2017 04:50:50 +0900 Subject: wip --- src/api/endpoints/posts/timeline.ts | 12 +++++++++++- src/api/models/mute.ts | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/api/models/mute.ts (limited to 'src') diff --git a/src/api/endpoints/posts/timeline.ts b/src/api/endpoints/posts/timeline.ts index 91cba0a047..6cc7825e64 100644 --- a/src/api/endpoints/posts/timeline.ts +++ b/src/api/endpoints/posts/timeline.ts @@ -77,7 +77,17 @@ module.exports = async (params, user, app) => { channel_id: { $in: watchingChannelIds } - }] + }], + // mute + user_id: { + $nin: mutes + }, + '_reply.user_id': { + $nin: mutes + }, + '_repost.user_id': { + $nin: mutes + }, } as any; if (sinceId) { diff --git a/src/api/models/mute.ts b/src/api/models/mute.ts new file mode 100644 index 0000000000..16018b82f7 --- /dev/null +++ b/src/api/models/mute.ts @@ -0,0 +1,3 @@ +import db from '../../db/mongodb'; + +export default db.get('mute') as any; // fuck type definition -- cgit v1.2.3-freya From 11e05a3a3298ea072f24ece0ad7a5c8c00bb1b23 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 05:41:21 +0900 Subject: wip --- src/api/endpoints/posts/create.ts | 6 ++- tools/migration/node.2017-12-22.hiseikika.js | 67 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 tools/migration/node.2017-12-22.hiseikika.js (limited to 'src') diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index 7270efaf71..9d791538fe 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -215,7 +215,11 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { poll: poll, text: text, user_id: user._id, - app_id: app ? app._id : null + app_id: app ? app._id : null, + + // 以下非正規化データ + _reply: reply ? { user_id: reply.user_id } : undefined, + _repost: repost ? { user_id: repost.user_id } : undefined, }); // Serialize diff --git a/tools/migration/node.2017-12-22.hiseikika.js b/tools/migration/node.2017-12-22.hiseikika.js new file mode 100644 index 0000000000..ff8294c8d1 --- /dev/null +++ b/tools/migration/node.2017-12-22.hiseikika.js @@ -0,0 +1,67 @@ +// for Node.js interpret + +const { default: Post } = require('../../built/api/models/post') +const { default: zip } = require('@prezzemolo/zip') + +const migrate = async (post) => { + const x = {}; + if (post.reply_id != null) { + const reply = await Post.findOne({ + _id: post.reply_id + }); + x['_reply.user_id'] = reply.user_id; + } + if (post.repost_id != null) { + const repost = await Post.findOne({ + _id: post.repost_id + }); + x['_repost.user_id'] = repost.user_id; + } + if (post.reply_id != null || post.repost_id != null) { + const result = await Post.update(post._id, { + $set: x, + }); + return result.ok === 1; + } else { + return true; + } +} + +async function main() { + const query = { + $or: [{ + reply_id: { + $exists: true, + $ne: null + } + }, { + repost_id: { + $exists: true, + $ne: null + } + }] + } + + const count = await Post.count(query); + + const dop = Number.parseInt(process.argv[2]) || 5 + const idop = ((count - (count % dop)) / dop) + 1 + + return zip( + 1, + async (time) => { + console.log(`${time} / ${idop}`) + const doc = await Post.find(query, { + limit: dop, skip: time * dop + }) + return Promise.all(doc.map(migrate)) + }, + idop + ).then(a => { + const rv = [] + a.forEach(e => rv.push(...e)) + return rv + }) +} + +main().then(console.dir).catch(console.error) -- cgit v1.2.3-freya From a134aa5a81ea2c443153b3723abf662a8069e36a Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 06:03:54 +0900 Subject: wip --- src/api/endpoints.ts | 17 +++++++++ src/api/endpoints/mute/create.ts | 61 +++++++++++++++++++++++++++++++ src/api/endpoints/mute/delete.ts | 63 ++++++++++++++++++++++++++++++++ src/api/endpoints/mute/list.ts | 73 +++++++++++++++++++++++++++++++++++++ src/api/endpoints/posts/timeline.ts | 19 +++++++--- 5 files changed, 228 insertions(+), 5 deletions(-) create mode 100644 src/api/endpoints/mute/create.ts create mode 100644 src/api/endpoints/mute/delete.ts create mode 100644 src/api/endpoints/mute/list.ts (limited to 'src') diff --git a/src/api/endpoints.ts b/src/api/endpoints.ts index 1138df193b..e846381578 100644 --- a/src/api/endpoints.ts +++ b/src/api/endpoints.ts @@ -222,6 +222,23 @@ const endpoints: Endpoint[] = [ withCredential: true, kind: 'notification-read' }, + + { + name: 'mute/create', + withCredential: true, + kind: 'account/write' + }, + { + name: 'mute/delete', + withCredential: true, + kind: 'account/write' + }, + { + name: 'mute/list', + withCredential: true, + kind: 'account/read' + }, + { name: 'notifications/get_unread_count', withCredential: true, diff --git a/src/api/endpoints/mute/create.ts b/src/api/endpoints/mute/create.ts new file mode 100644 index 0000000000..f44854ab52 --- /dev/null +++ b/src/api/endpoints/mute/create.ts @@ -0,0 +1,61 @@ +/** + * Module dependencies + */ +import $ from 'cafy'; +import User from '../../models/user'; +import Mute from '../../models/mute'; + +/** + * Mute a user + * + * @param {any} params + * @param {any} user + * @return {Promise} + */ +module.exports = (params, user) => new Promise(async (res, rej) => { + const muter = user; + + // Get 'user_id' parameter + const [userId, userIdErr] = $(params.user_id).id().$; + if (userIdErr) return rej('invalid user_id param'); + + // 自分自身 + if (user._id.equals(userId)) { + return rej('mutee is yourself'); + } + + // Get mutee + const mutee = await User.findOne({ + _id: userId + }, { + fields: { + data: false, + profile: false + } + }); + + if (mutee === null) { + return rej('user not found'); + } + + // Check if already muting + const exist = await Mute.findOne({ + muter_id: muter._id, + mutee_id: mutee._id, + deleted_at: { $exists: false } + }); + + if (exist !== null) { + return rej('already muting'); + } + + // Create mute + await Mute.insert({ + created_at: new Date(), + muter_id: muter._id, + mutee_id: mutee._id, + }); + + // Send response + res(); +}); diff --git a/src/api/endpoints/mute/delete.ts b/src/api/endpoints/mute/delete.ts new file mode 100644 index 0000000000..d6bff3353a --- /dev/null +++ b/src/api/endpoints/mute/delete.ts @@ -0,0 +1,63 @@ +/** + * Module dependencies + */ +import $ from 'cafy'; +import User from '../../models/user'; +import Mute from '../../models/mute'; + +/** + * Unmute a user + * + * @param {any} params + * @param {any} user + * @return {Promise} + */ +module.exports = (params, user) => new Promise(async (res, rej) => { + const muter = user; + + // Get 'user_id' parameter + const [userId, userIdErr] = $(params.user_id).id().$; + if (userIdErr) return rej('invalid user_id param'); + + // Check if the mutee is yourself + if (user._id.equals(userId)) { + return rej('mutee is yourself'); + } + + // Get mutee + const mutee = await User.findOne({ + _id: userId + }, { + fields: { + data: false, + profile: false + } + }); + + if (mutee === null) { + return rej('user not found'); + } + + // Check not muting + const exist = await Mute.findOne({ + muter_id: muter._id, + mutee_id: mutee._id, + deleted_at: { $exists: false } + }); + + if (exist === null) { + return rej('already not muting'); + } + + // Delete mute + await Mute.update({ + _id: exist._id + }, { + $set: { + deleted_at: new Date() + } + }); + + // Send response + res(); +}); diff --git a/src/api/endpoints/mute/list.ts b/src/api/endpoints/mute/list.ts new file mode 100644 index 0000000000..740e19f0bb --- /dev/null +++ b/src/api/endpoints/mute/list.ts @@ -0,0 +1,73 @@ +/** + * Module dependencies + */ +import $ from 'cafy'; +import Mute from '../../models/mute'; +import serialize from '../../serializers/user'; +import getFriends from '../../common/get-friends'; + +/** + * Get muted users of a user + * + * @param {any} params + * @param {any} me + * @return {Promise} + */ +module.exports = (params, me) => new Promise(async (res, rej) => { + // Get 'iknow' parameter + const [iknow = false, iknowErr] = $(params.iknow).optional.boolean().$; + if (iknowErr) return rej('invalid iknow param'); + + // Get 'limit' parameter + const [limit = 30, limitErr] = $(params.limit).optional.number().range(1, 100).$; + if (limitErr) return rej('invalid limit param'); + + // Get 'cursor' parameter + const [cursor = null, cursorErr] = $(params.cursor).optional.id().$; + if (cursorErr) return rej('invalid cursor param'); + + // Construct query + const query = { + muter_id: me._id, + deleted_at: { $exists: false } + } as any; + + if (iknow) { + // Get my friends + const myFriends = await getFriends(me._id); + + query.mutee_id = { + $in: myFriends + }; + } + + // カーソルが指定されている場合 + if (cursor) { + query._id = { + $lt: cursor + }; + } + + // Get mutes + const mutes = await Mute + .find(query, { + limit: limit + 1, + sort: { _id: -1 } + }); + + // 「次のページ」があるかどうか + const inStock = mutes.length === limit + 1; + if (inStock) { + mutes.pop(); + } + + // Serialize + const users = await Promise.all(mutes.map(async m => + await serialize(m.mutee_id, me, { detail: true }))); + + // Response + res({ + users: users, + next: inStock ? mutes[mutes.length - 1]._id : null, + }); +}); diff --git a/src/api/endpoints/posts/timeline.ts b/src/api/endpoints/posts/timeline.ts index 6cc7825e64..da7ffd0c14 100644 --- a/src/api/endpoints/posts/timeline.ts +++ b/src/api/endpoints/posts/timeline.ts @@ -4,6 +4,7 @@ import $ from 'cafy'; import rap from '@prezzemolo/rap'; import Post from '../../models/post'; +import Mute from '../../models/mute'; import ChannelWatching from '../../models/channel-watching'; import getFriends from '../../common/get-friends'; import serialize from '../../serializers/post'; @@ -42,15 +43,23 @@ module.exports = async (params, user, app) => { throw 'only one of since_id, until_id, since_date, until_date can be specified'; } - const { followingIds, watchingChannelIds } = await rap({ + const { followingIds, watchingChannelIds, mutedUserIds } = await rap({ // ID list of the user itself and other users who the user follows followingIds: getFriends(user._id), + // Watchしているチャンネルを取得 watchingChannelIds: ChannelWatching.find({ user_id: user._id, // 削除されたドキュメントは除く deleted_at: { $exists: false } - }).then(watches => watches.map(w => w.channel_id)) + }).then(watches => watches.map(w => w.channel_id)), + + // ミュートしているユーザーを取得 + mutedUserIds: Mute.find({ + muter_id: user._id, + // 削除されたドキュメントは除く + deleted_at: { $exists: false } + }).then(ms => ms.map(m => m.mutee_id)) }); //#region Construct query @@ -80,13 +89,13 @@ module.exports = async (params, user, app) => { }], // mute user_id: { - $nin: mutes + $nin: mutedUserIds }, '_reply.user_id': { - $nin: mutes + $nin: mutedUserIds }, '_repost.user_id': { - $nin: mutes + $nin: mutedUserIds }, } as any; -- cgit v1.2.3-freya From 26b40d8886ccf87eed5cce2868b14994c29752b9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 06:38:48 +0900 Subject: wip --- src/api/endpoints/posts/search.ts | 89 +++++++++++++++++++++++++++++++++++++-- src/web/docs/search.ja.pug | 16 +++++++ 2 files changed, 102 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index ac25652a0b..f722231d4c 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -6,6 +6,7 @@ import $ from 'cafy'; const escapeRegexp = require('escape-regexp'); import Post from '../../models/post'; import User from '../../models/user'; +import Mute from '../../models/mute'; import getFriends from '../../common/get-friends'; import serialize from '../../serializers/post'; import config from '../../../conf'; @@ -34,6 +35,10 @@ module.exports = (params, me) => new Promise(async (res, rej) => { const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$; if (followingErr) return rej('invalid following param'); + // Get 'mute' parameter + const [mute = 'mute_all', muteErr] = $(params.mute).optional.string().$; + if (muteErr) return rej('invalid mute param'); + // Get 'reply' parameter const [reply = null, replyErr] = $(params.reply).optional.nullable.boolean().$; if (replyErr) return rej('invalid reply param'); @@ -80,11 +85,11 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // If Elasticsearch is available, search by it // If not, search by MongoDB (config.elasticsearch.enable ? byElasticsearch : byNative) - (res, rej, me, text, user, following, reply, repost, media, poll, sinceDate, untilDate, offset, limit); + (res, rej, me, text, user, following, mute, reply, repost, media, poll, sinceDate, untilDate, offset, limit); }); // Search by MongoDB -async function byNative(res, rej, me, text, userId, following, reply, repost, media, poll, sinceDate, untilDate, offset, max) { +async function byNative(res, rej, me, text, userId, following, mute, reply, repost, media, poll, sinceDate, untilDate, offset, max) { let q: any = { $and: [] }; @@ -116,6 +121,84 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me }); } + if (me != null) { + const mutes = await Mute.find({ + muter_id: me._id, + deleted_at: { $exists: false } + }); + const mutedUserIds = mutes.map(m => m.mutee_id); + + switch (mute) { + case 'mute_all': + push({ + user_id: { + $nin: mutedUserIds + }, + '_reply.user_id': { + $nin: mutedUserIds + }, + '_repost.user_id': { + $nin: mutedUserIds + } + }); + break; + case 'mute_related': + push({ + '_reply.user_id': { + $nin: mutedUserIds + }, + '_repost.user_id': { + $nin: mutedUserIds + } + }); + break; + case 'mute_direct': + push({ + user_id: { + $nin: mutedUserIds + } + }); + break; + case 'direct_only': + push({ + user_id: { + $in: mutedUserIds + } + }); + break; + case 'related_only': + push({ + $or: [{ + '_reply.user_id': { + $in: mutedUserIds + } + }, { + '_repost.user_id': { + $in: mutedUserIds + } + }] + }); + break; + case 'all_only': + push({ + $or: [{ + user_id: { + $in: mutedUserIds + } + }, { + '_reply.user_id': { + $in: mutedUserIds + } + }, { + '_repost.user_id': { + $in: mutedUserIds + } + }] + }); + break; + } + } + if (reply != null) { if (reply) { push({ @@ -236,7 +319,7 @@ async function byNative(res, rej, me, text, userId, following, reply, repost, me } // Search by Elasticsearch -async function byElasticsearch(res, rej, me, text, userId, following, reply, repost, media, poll, sinceDate, untilDate, offset, max) { +async function byElasticsearch(res, rej, me, text, userId, following, mute, reply, repost, media, poll, sinceDate, untilDate, offset, max) { const es = require('../../db/elasticsearch'); es.search({ diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index 41e443d746..552f95c60f 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -29,6 +29,22 @@ section | false ... フォローしていないユーザーに限定。 br | null ... 特に限定しない(デフォルト) + tr + td mute + td + | mute_all ... ミュートしているユーザーの投稿とその投稿に対する返信やRepostを除外する(デフォルト) + br + | mute_related ... ミュートしているユーザーの投稿に対する返信やRepostだけ除外する + br + | mute_direct ... ミュートしているユーザーの投稿だけ除外する + br + | disabled ... ミュートしているユーザーの投稿とその投稿に対する返信やRepostも含める + br + | direct_only ... ミュートしているユーザーの投稿だけに限定 + br + | related_only ... ミュートしているユーザーの投稿に対する返信やRepostだけに限定 + br + | all_only ... ミュートしているユーザーの投稿とその投稿に対する返信やRepostに限定 tr td reply td -- cgit v1.2.3-freya From 34923888c7f504b95912719e54325cb8633c8cda Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 06:56:37 +0900 Subject: wip --- locales/en.yml | 5 +++++ locales/ja.yml | 5 +++++ src/api/serializers/user.ts | 15 +++++++++++++-- src/web/app/desktop/tags/user.tag | 27 ++++++++++++++++++++++++++- src/web/docs/api/entities/user.yaml | 6 ++++++ src/web/docs/mute.ja.pug | 3 +++ 6 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 src/web/docs/mute.ja.pug (limited to 'src') diff --git a/locales/en.yml b/locales/en.yml index 57e0c4116f..dd3ee2a2a2 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -473,6 +473,11 @@ desktop: mk-user: last-used-at: "Last used at" + follows-you: "Follows you" + mute: "Mute" + muted: "Muting" + unmute: "Unmute" + photos: title: "Photos" loading: "Loading" diff --git a/locales/ja.yml b/locales/ja.yml index ee52f07166..d12eec86d1 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -473,6 +473,11 @@ desktop: mk-user: last-used-at: "最終アクセス" + follows-you: "フォローされています" + mute: "ミュートする" + muted: "ミュートしています" + unmute: "ミュート解除" + photos: title: "フォト" loading: "読み込み中" diff --git a/src/api/serializers/user.ts b/src/api/serializers/user.ts index fe924911c1..ac157097a8 100644 --- a/src/api/serializers/user.ts +++ b/src/api/serializers/user.ts @@ -6,6 +6,7 @@ import deepcopy = require('deepcopy'); import { default as User, IUser } from '../models/user'; import serializePost from './post'; import Following from '../models/following'; +import Mute from '../models/mute'; import getFriends from '../common/get-friends'; import config from '../../conf'; import rap from '@prezzemolo/rap'; @@ -113,7 +114,7 @@ export default ( } if (meId && !meId.equals(_user.id)) { - // If the user is following + // Whether the user is following _user.is_following = (async () => { const follow = await Following.findOne({ follower_id: meId, @@ -123,7 +124,7 @@ export default ( return follow !== null; })(); - // If the user is followed + // Whether the user is followed _user.is_followed = (async () => { const follow2 = await Following.findOne({ follower_id: _user.id, @@ -132,6 +133,16 @@ export default ( }); return follow2 !== null; })(); + + // Whether the user is muted + _user.is_muted = (async () => { + const mute = await Mute.findOne({ + muter_id: meId, + mutee_id: _user.id, + deleted_at: { $exists: false } + }); + return mute !== null; + })(); } if (opts.detail) { diff --git a/src/web/app/desktop/tags/user.tag b/src/web/app/desktop/tags/user.tag index b4db47f9dd..b29d1eaebc 100644 --- a/src/web/app/desktop/tags/user.tag +++ b/src/web/app/desktop/tags/user.tag @@ -226,7 +226,9 @@
-

フォローされています

+

%i18n:desktop.tags.mk-user.follows-you%

+

%i18n:desktop.tags.mk-user.muted% %i18n:desktop.tags.mk-user.unmute%

+

%i18n:desktop.tags.mk-user.mute%

{ user.description }
@@ -311,6 +313,7 @@ this.age = require('s-age'); this.mixin('i'); + this.mixin('api'); this.user = this.opts.user; @@ -325,6 +328,28 @@ user: this.user }); }; + + this.mute = () => { + this.api('mute/create', { + user_id: this.user.id + }).then(() => { + this.user.is_muted = true; + this.update(); + }, e => { + alert('error'); + }); + }; + + this.unmute = () => { + this.api('mute/delete', { + user_id: this.user.id + }).then(() => { + this.user.is_muted = false; + this.update(); + }, e => { + alert('error'); + }); + }; diff --git a/src/web/docs/api/entities/user.yaml b/src/web/docs/api/entities/user.yaml index abc3f300d2..e62ad84db8 100644 --- a/src/web/docs/api/entities/user.yaml +++ b/src/web/docs/api/entities/user.yaml @@ -75,6 +75,12 @@ props: optional: true desc: ja: "自分がこのユーザーにフォローされているか" + - name: "is_muted" + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーをミュートしているか" + en: "Whether you muted this user" - name: "last_used_at" type: "date" optional: false diff --git a/src/web/docs/mute.ja.pug b/src/web/docs/mute.ja.pug new file mode 100644 index 0000000000..4f5fad8b68 --- /dev/null +++ b/src/web/docs/mute.ja.pug @@ -0,0 +1,3 @@ +h1 ミュート + +p ユーザーをミュートすると、タイムラインや検索結果に対象のユーザーの投稿(およびそれらの投稿に対する返信やRepost)が表示されなくなります。 -- cgit v1.2.3-freya From 6575a6de5bbcab9a88448e4366feb77f1845a580 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 07:26:23 +0900 Subject: wip --- src/api/endpoints/i/notifications.ts | 23 ++++++++++++++++++----- src/api/stream/home.ts | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/i/notifications.ts b/src/api/endpoints/i/notifications.ts index 48254e5e67..fb9be7f61b 100644 --- a/src/api/endpoints/i/notifications.ts +++ b/src/api/endpoints/i/notifications.ts @@ -3,6 +3,7 @@ */ import $ from 'cafy'; import Notification from '../../models/notification'; +import Mute from '../../models/mute'; import serialize from '../../serializers/notification'; import getFriends from '../../common/get-friends'; import read from '../../common/read-notification'; @@ -45,8 +46,18 @@ module.exports = (params, user) => new Promise(async (res, rej) => { return rej('cannot set since_id and until_id'); } + const mute = await Mute.find({ + muter_id: user._id, + deleted_at: { $exists: false } + }); + const query = { - notifiee_id: user._id + notifiee_id: user._id, + $and: [{ + notifier_id: { + $nin: mute.map(m => m.mutee_id) + } + }] } as any; const sort = { @@ -54,12 +65,14 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }; if (following) { - // ID list of the user $self and other users who the user follows + // ID list of the user itself and other users who the user follows const followingIds = await getFriends(user._id); - query.notifier_id = { - $in: followingIds - }; + query.$and.push({ + notifier_id: { + $in: followingIds + } + }); } if (type) { diff --git a/src/api/stream/home.ts b/src/api/stream/home.ts index 7c8f3bfec8..7dcdb5ed73 100644 --- a/src/api/stream/home.ts +++ b/src/api/stream/home.ts @@ -3,19 +3,48 @@ import * as redis from 'redis'; import * as debug from 'debug'; import User from '../models/user'; +import Mute from '../models/mute'; import serializePost from '../serializers/post'; import readNotification from '../common/read-notification'; const log = debug('misskey'); -export default function homeStream(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any): void { +export default async function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient, user: any) { // Subscribe Home stream channel subscriber.subscribe(`misskey:user-stream:${user._id}`); + const mute = await Mute.find({ + muter_id: user._id, + deleted_at: { $exists: false } + }); + const mutedUserIds = mute.map(m => m.mutee_id.toString()); + subscriber.on('message', async (channel, data) => { switch (channel.split(':')[1]) { case 'user-stream': - connection.send(data); + try { + const x = JSON.parse(data); + + if (x.type == 'post') { + if (mutedUserIds.indexOf(x.body.user_id) != -1) { + return; + } + if (x.body.reply != null && mutedUserIds.indexOf(x.body.reply.user_id) != -1) { + return; + } + if (x.body.repost != null && mutedUserIds.indexOf(x.body.repost.user_id) != -1) { + return; + } + } else if (x.type == 'notification') { + if (mutedUserIds.indexOf(x.body.user_id) != -1) { + return; + } + } + + connection.send(data); + } catch (e) { + connection.send(data); + } break; case 'post-stream': const postId = channel.split(':')[2]; -- cgit v1.2.3-freya From 8b515b4dae8c272257ee8892713fe954f0ff9c4a Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 07:38:57 +0900 Subject: wip --- src/api/common/notify.ts | 12 ++++++++++++ src/api/endpoints/notifications/get_unread_count.ts | 10 ++++++++++ 2 files changed, 22 insertions(+) (limited to 'src') diff --git a/src/api/common/notify.ts b/src/api/common/notify.ts index 4b3e6a5d54..f06622f912 100644 --- a/src/api/common/notify.ts +++ b/src/api/common/notify.ts @@ -1,5 +1,6 @@ import * as mongo from 'mongodb'; import Notification from '../models/notification'; +import Mute from '../models/mute'; import event from '../event'; import serialize from '../serializers/notification'; @@ -32,6 +33,17 @@ export default ( setTimeout(async () => { const fresh = await Notification.findOne({ _id: notification._id }, { is_read: true }); if (!fresh.is_read) { + //#region ただしミュートしているユーザーからの通知なら無視 + const mute = await Mute.find({ + muter_id: notifiee, + deleted_at: { $exists: false } + }); + const mutedUserIds = mute.map(m => m.mutee_id.toString()); + if (mutedUserIds.indexOf(notifier.toHexString()) != -1) { + return; + } + //#endregion + event(notifiee, 'unread_notification', await serialize(notification)); } }, 3000); diff --git a/src/api/endpoints/notifications/get_unread_count.ts b/src/api/endpoints/notifications/get_unread_count.ts index 9514e78713..845d6b29ce 100644 --- a/src/api/endpoints/notifications/get_unread_count.ts +++ b/src/api/endpoints/notifications/get_unread_count.ts @@ -2,6 +2,7 @@ * Module dependencies */ import Notification from '../../models/notification'; +import Mute from '../../models/mute'; /** * Get count of unread notifications @@ -11,9 +12,18 @@ import Notification from '../../models/notification'; * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { + const mute = await Mute.find({ + muter_id: user._id, + deleted_at: { $exists: false } + }); + const mutedUserIds = mute.map(m => m.mutee_id); + const count = await Notification .count({ notifiee_id: user._id, + notifier_id: { + $nin: mutedUserIds + }, is_read: false }); -- cgit v1.2.3-freya From f93bc3a8ec7eae63330193bc87c5b1437bf874ed Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 07:43:56 +0900 Subject: wip --- src/api/common/notify.ts | 2 +- src/api/endpoints/posts/create.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/api/common/notify.ts b/src/api/common/notify.ts index f06622f912..2b79416a30 100644 --- a/src/api/common/notify.ts +++ b/src/api/common/notify.ts @@ -39,7 +39,7 @@ export default ( deleted_at: { $exists: false } }); const mutedUserIds = mute.map(m => m.mutee_id.toString()); - if (mutedUserIds.indexOf(notifier.toHexString()) != -1) { + if (mutedUserIds.indexOf(notifier.toString()) != -1) { return; } //#endregion diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index 9d791538fe..a1d05c67c6 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -8,6 +8,7 @@ import { default as Post, IPost, isValidText } from '../../models/post'; import { default as User, IUser } from '../../models/user'; import { default as Channel, IChannel } from '../../models/channel'; import Following from '../../models/following'; +import Mute from '../../models/mute'; import DriveFile from '../../models/drive-file'; import Watching from '../../models/post-watching'; import ChannelWatching from '../../models/channel-watching'; @@ -240,7 +241,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { const mentions = []; - function addMention(mentionee, reason) { + async function addMention(mentionee, reason) { // Reject if already added if (mentions.some(x => x.equals(mentionee))) return; @@ -249,8 +250,15 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { // Publish event if (!user._id.equals(mentionee)) { - event(mentionee, reason, postObj); - pushSw(mentionee, reason, postObj); + const mentioneeMutes = await Mute.find({ + muter_id: mentionee, + deleted_at: { $exists: false } + }); + const mentioneesMutedUserIds = mentioneeMutes.map(m => m.mutee_id.toString()); + if (mentioneesMutedUserIds.indexOf(user._id.toString()) == -1) { + event(mentionee, reason, postObj); + pushSw(mentionee, reason, postObj); + } } } -- cgit v1.2.3-freya From 4bd694fb59f87a8adcb471dd17874d9aa65d4bc6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 07:57:46 +0900 Subject: Update mute.ja.pug --- src/web/docs/mute.ja.pug | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/docs/mute.ja.pug b/src/web/docs/mute.ja.pug index 4f5fad8b68..a1f3960064 100644 --- a/src/web/docs/mute.ja.pug +++ b/src/web/docs/mute.ja.pug @@ -1,3 +1,7 @@ h1 ミュート -p ユーザーをミュートすると、タイムラインや検索結果に対象のユーザーの投稿(およびそれらの投稿に対する返信やRepost)が表示されなくなります。 +p ユーザーをミュートすると、タイムラインや検索結果に対象のユーザーの投稿(およびそれらの投稿に対する返信やRepost)が表示されなくなります。また、ミュートしているユーザーからの通知も表示されなくなります。 + +p ユーザーページからそのユーザーをミュートすることができます。 + +p ミュートを行ったことは相手に通知されず、ミュートされていることを知ることもできません。 -- cgit v1.2.3-freya From 2c4d86d8a0fca323b162adb73af60bbf644e7beb Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Fri, 22 Dec 2017 10:38:59 +0900 Subject: wip --- locales/en.yml | 4 ++++ locales/ja.yml | 4 ++++ src/web/app/desktop/tags/settings.tag | 38 +++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) (limited to 'src') diff --git a/locales/en.yml b/locales/en.yml index dd3ee2a2a2..e559846772 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -346,6 +346,9 @@ desktop: failed: "Failed to setup. please ensure that the token is correct." info: "From the next sign in, enter the token that is displayed on the device in addition to the password." + mk-mute-setting: + no-users: "No muted users" + mk-post-form: post-placeholder: "What's happening?" reply-placeholder: "Reply to this post..." @@ -379,6 +382,7 @@ desktop: mk-settings: profile: "Profile" + mute: "Mute" drive: "Drive" security: "Security" password: "Password" diff --git a/locales/ja.yml b/locales/ja.yml index d12eec86d1..70ff8739f3 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -346,6 +346,9 @@ desktop: failed: "設定に失敗しました。トークンに誤りがないかご確認ください。" info: "次回サインインからは、同様にパスワードに加えてデバイスに表示されているトークンを入力します。" + mk-mute-setting: + no-users: "ミュートしているユーザーはいません" + mk-post-form: post-placeholder: "いまどうしてる?" reply-placeholder: "この投稿への返信..." @@ -379,6 +382,7 @@ desktop: mk-settings: profile: "プロフィール" + mute: "ミュート" drive: "ドライブ" security: "セキュリティ" password: "パスワード" diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag index 2f36d9b3ec..457b7e2276 100644 --- a/src/web/app/desktop/tags/settings.tag +++ b/src/web/app/desktop/tags/settings.tag @@ -4,6 +4,7 @@

%fa:desktop .fw%Web

%fa:R bell .fw%通知

%fa:cloud .fw%%i18n:desktop.tags.mk-settings.drive%

+

%fa:ban .fw%%i18n:desktop.tags.mk-settings.mute%

%fa:puzzle-piece .fw%アプリ

%fa:B twitter .fw%Twitter

%fa:unlock-alt .fw%%i18n:desktop.tags.mk-settings.security%

@@ -26,6 +27,11 @@ +
+

%i18n:desktop.tags.mk-settings.mute%

+ +
+

アプリケーション

@@ -386,3 +392,35 @@ }); + + +
+

%fa:info-circle%%i18n:desktop.tags.mk-mute-setting.no-users%

+
+
+
+

{ user.name } @{ user.username }

+
+
+ + + +
-- cgit v1.2.3-freya From a900843b0a7d4a4d771c903fe406ab8741a31185 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 12:59:37 +0900 Subject: Update mute.ja.pug --- src/web/docs/mute.ja.pug | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/docs/mute.ja.pug b/src/web/docs/mute.ja.pug index a1f3960064..176ace5e54 100644 --- a/src/web/docs/mute.ja.pug +++ b/src/web/docs/mute.ja.pug @@ -1,7 +1,14 @@ h1 ミュート -p ユーザーをミュートすると、タイムラインや検索結果に対象のユーザーの投稿(およびそれらの投稿に対する返信やRepost)が表示されなくなります。また、ミュートしているユーザーからの通知も表示されなくなります。 +p ユーザーページから、そのユーザーをミュートすることができます。 -p ユーザーページからそのユーザーをミュートすることができます。 +p ユーザーをミュートすると、そのユーザーに関する次のコンテンツがMisskeyに表示されなくなります: +ul + li タイムラインや投稿の検索結果内の、そのユーザーの +投稿(およびそれらの投稿に対する返信やRepost) + li そのユーザーからの通知 + li メッセージ履歴一覧内の、そのユーザーとのメッセージ履歴 p ミュートを行ったことは相手に通知されず、ミュートされていることを知ることもできません。 + +p 設定>ミュート から、自分がミュートしているユーザー一覧を確認することができます。 -- cgit v1.2.3-freya From 6e59c822528dab8b011d663b1618b4ab30cd5f3d Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 12:59:59 +0900 Subject: oops --- src/web/docs/mute.ja.pug | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/web/docs/mute.ja.pug b/src/web/docs/mute.ja.pug index 176ace5e54..5e79af5f8c 100644 --- a/src/web/docs/mute.ja.pug +++ b/src/web/docs/mute.ja.pug @@ -4,8 +4,7 @@ p ユーザーページから、そのユーザーをミュートすることが p ユーザーをミュートすると、そのユーザーに関する次のコンテンツがMisskeyに表示されなくなります: ul - li タイムラインや投稿の検索結果内の、そのユーザーの -投稿(およびそれらの投稿に対する返信やRepost) + li タイムラインや投稿の検索結果内の、そのユーザーの投稿(およびそれらの投稿に対する返信やRepost) li そのユーザーからの通知 li メッセージ履歴一覧内の、そのユーザーとのメッセージ履歴 -- cgit v1.2.3-freya From e21ab77dd5fc007cc92fffd4362890fbde89db56 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 14:21:40 +0900 Subject: wip --- src/api/endpoints/messaging/history.ts | 11 ++++++++++- src/api/endpoints/messaging/messages/create.ts | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/messaging/history.ts b/src/api/endpoints/messaging/history.ts index 5f7c9276dd..f14740dff5 100644 --- a/src/api/endpoints/messaging/history.ts +++ b/src/api/endpoints/messaging/history.ts @@ -3,6 +3,7 @@ */ import $ from 'cafy'; import History from '../../models/messaging-history'; +import Mute from '../../models/mute'; import serialize from '../../serializers/messaging-message'; /** @@ -17,10 +18,18 @@ module.exports = (params, user) => new Promise(async (res, rej) => { const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$; if (limitErr) return rej('invalid limit param'); + const mute = await Mute.find({ + muter_id: user._id, + deleted_at: { $exists: false } + }); + // Get history const history = await History .find({ - user_id: user._id + user_id: user._id, + partner: { + $nin: mute.map(m => m.mutee_id) + } }, { limit: limit, sort: { diff --git a/src/api/endpoints/messaging/messages/create.ts b/src/api/endpoints/messaging/messages/create.ts index 3c7689f967..f69f2e0fb2 100644 --- a/src/api/endpoints/messaging/messages/create.ts +++ b/src/api/endpoints/messaging/messages/create.ts @@ -6,6 +6,7 @@ import Message from '../../../models/messaging-message'; import { isValidText } from '../../../models/messaging-message'; import History from '../../../models/messaging-history'; import User from '../../../models/user'; +import Mute from '../../../models/mute'; import DriveFile from '../../../models/drive-file'; import serialize from '../../../serializers/messaging-message'; import publishUserStream from '../../../event'; @@ -97,6 +98,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => { setTimeout(async () => { const freshMessage = await Message.findOne({ _id: message._id }, { is_read: true }); if (!freshMessage.is_read) { + //#region ただしミュートしているユーザーからの通知なら無視 + const mute = await Mute.find({ + muter_id: recipient._id, + deleted_at: { $exists: false } + }); + const mutedUserIds = mute.map(m => m.mutee_id.toString()); + if (mutedUserIds.indexOf(user._id.toString()) != -1) { + return; + } + //#endregion + publishUserStream(message.recipient_id, 'unread_messaging_message', messageObj); pushSw(message.recipient_id, 'unread_messaging_message', messageObj); } -- cgit v1.2.3-freya From ef5a963b32afd5842894a2a61fa4c2d078853224 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 14:35:47 +0900 Subject: wip --- src/api/endpoints/messaging/unread.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/api/endpoints/messaging/unread.ts b/src/api/endpoints/messaging/unread.ts index 40bc83fe1c..c4326e1d22 100644 --- a/src/api/endpoints/messaging/unread.ts +++ b/src/api/endpoints/messaging/unread.ts @@ -2,6 +2,7 @@ * Module dependencies */ import Message from '../../models/messaging-message'; +import Mute from '../../models/mute'; /** * Get count of unread messages @@ -11,8 +12,17 @@ import Message from '../../models/messaging-message'; * @return {Promise} */ module.exports = (params, user) => new Promise(async (res, rej) => { + const mute = await Mute.find({ + muter_id: user._id, + deleted_at: { $exists: false } + }); + const mutedUserIds = mute.map(m => m.mutee_id); + const count = await Message .count({ + user_id: { + $nin: mutedUserIds + }, recipient_id: user._id, is_read: false }); -- cgit v1.2.3-freya From 09af75a92d94cc59e41e0401da9af59a1a90e29f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 22 Dec 2017 16:22:33 +0900 Subject: Update create.ts --- src/api/endpoints/messaging/messages/create.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/messaging/messages/create.ts b/src/api/endpoints/messaging/messages/create.ts index f69f2e0fb2..4e9d10197c 100644 --- a/src/api/endpoints/messaging/messages/create.ts +++ b/src/api/endpoints/messaging/messages/create.ts @@ -98,7 +98,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { setTimeout(async () => { const freshMessage = await Message.findOne({ _id: message._id }, { is_read: true }); if (!freshMessage.is_read) { - //#region ただしミュートしているユーザーからの通知なら無視 + //#region ただしミュートされているなら発行しない const mute = await Mute.find({ muter_id: recipient._id, deleted_at: { $exists: false } -- cgit v1.2.3-freya From 52ea44394aaf9f48340077812ea8357df157ec88 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 23 Dec 2017 00:39:00 +0900 Subject: Update search.ja.pug --- src/web/docs/search.ja.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index 552f95c60f..e94990205b 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -8,7 +8,7 @@ p section h2 オプション p - | オプションを使用して、より高度な検索をすることもできます。 + | オプションを使用して、より高度な検索を行えます。 | オプションを指定するには、「オプション名:値」という形式でクエリに含めます。 p 利用可能なオプション一覧です: -- cgit v1.2.3-freya From 8376b10b3b93d3c6cc50d69a6f0ae3ceb8c96c74 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 23 Dec 2017 04:21:15 +0900 Subject: #1035 --- src/api/endpoints/posts/search.ts | 4 +++- src/web/docs/search.ja.pug | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index f722231d4c..4697e6ed0f 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -99,7 +99,9 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo if (text) { push({ $and: text.split(' ').map(x => ({ - text: new RegExp(escapeRegexp(x)) + text: x[0] == '-' ? { + $ne: new RegExp(escapeRegexp(x)) + } : new RegExp(escapeRegexp(x)) })) }); } diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index e94990205b..5baac9d400 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -5,6 +5,12 @@ p | キーワードを半角スペースで区切ると、and検索になります。 | 例えば、「git コミット」と検索すると、「gitで編集したファイルの特定の行だけコミットする方法がわからない」などがマッチします。 +section + h2 キーワードの除外 + p キーワードの前に「-」(ハイフン)をプリフィクスすると、そのキーワードを含まない投稿に限定します。 + p 例えば、「gitというキーワードを含むが、コミットというキーワードは含まない投稿」を検索したい場合、クエリは以下のようになります: + code git -コミット + section h2 オプション p -- cgit v1.2.3-freya From 67c269ddf54d43b68c06b8fb2726f72d87600c11 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 23 Dec 2017 04:21:48 +0900 Subject: oops --- src/api/endpoints/posts/search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 4697e6ed0f..33ef2a0a05 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -100,7 +100,7 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo push({ $and: text.split(' ').map(x => ({ text: x[0] == '-' ? { - $ne: new RegExp(escapeRegexp(x)) + $ne: new RegExp(escapeRegexp(x.substr(1))) } : new RegExp(escapeRegexp(x)) })) }); -- cgit v1.2.3-freya From 3e343814e395a3c4b7374629d3f6082705ea7f8d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 23 Dec 2017 04:22:45 +0900 Subject: oops --- src/web/docs/search.ja.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index 5baac9d400..09173a3503 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -7,7 +7,7 @@ p section h2 キーワードの除外 - p キーワードの前に「-」(ハイフン)をプリフィクスすると、そのキーワードを含まない投稿に限定します。 + p キーワードの前に「-」(ハイフン)をプリフィクスすると、そのキーワードを含まない投稿に限定します。 p 例えば、「gitというキーワードを含むが、コミットというキーワードは含まない投稿」を検索したい場合、クエリは以下のようになります: code git -コミット -- cgit v1.2.3-freya From 020ce794af9493d3a037bc4cd942c6f0fac75330 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 23 Dec 2017 04:26:37 +0900 Subject: oops --- src/api/endpoints/posts/search.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 33ef2a0a05..6cea5bdf53 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -99,8 +99,9 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo if (text) { push({ $and: text.split(' ').map(x => ({ + // キーワードが-で始まる場合そのキーワードを除外する text: x[0] == '-' ? { - $ne: new RegExp(escapeRegexp(x.substr(1))) + $not: new RegExp(escapeRegexp(x.substr(1))) } : new RegExp(escapeRegexp(x)) })) }); -- cgit v1.2.3-freya From 7cf4aa9f110cebf1bf3017471b8e96d2522ad462 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 23 Dec 2017 04:38:56 +0900 Subject: #1034 --- src/api/endpoints/posts/search.ts | 24 ++++++++++++++++-------- src/web/docs/search.ja.pug | 5 +++++ 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 6cea5bdf53..26675989dd 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -97,14 +97,22 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo const push = x => q.$and.push(x); if (text) { - push({ - $and: text.split(' ').map(x => ({ - // キーワードが-で始まる場合そのキーワードを除外する - text: x[0] == '-' ? { - $not: new RegExp(escapeRegexp(x.substr(1))) - } : new RegExp(escapeRegexp(x)) - })) - }); + // 完全一致検索 + if (/"""(.+?)"""/.test(text)) { + const x = text.match(/"""(.+?)"""/)[1]; + push({ + text: x + }); + } else { + push({ + $and: text.split(' ').map(x => ({ + // キーワードが-で始まる場合そのキーワードを除外する + text: x[0] == '-' ? { + $not: new RegExp(escapeRegexp(x.substr(1))) + } : new RegExp(escapeRegexp(x)) + })) + }); + } } if (userId) { diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index 09173a3503..9e64789488 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -11,6 +11,11 @@ section p 例えば、「gitというキーワードを含むが、コミットというキーワードは含まない投稿」を検索したい場合、クエリは以下のようになります: code git -コミット +section + h2 完全一致 + p テキストを「"""」で囲むと、そのテキストと完全に一致する投稿を検索します。 + p 例えば、「"""にゃーん"""」と検索すると、「にゃーん」という投稿のみがヒットし、「にゃーん…」という投稿はヒットしません。 + section h2 オプション p -- cgit v1.2.3-freya From f0818edd6e1d566a3d7e2b5495eeb389d728f564 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 23 Dec 2017 07:21:52 +0900 Subject: #1037 #1038 --- src/api/endpoints/posts/search.ts | 136 ++++++++--------------- src/web/app/common/scripts/parse-search-query.ts | 5 +- src/web/docs/search.ja.pug | 19 +++- 3 files changed, 71 insertions(+), 89 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 26675989dd..31c9a8d3c8 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -1,7 +1,6 @@ /** * Module dependencies */ -import * as mongo from 'mongodb'; import $ from 'cafy'; const escapeRegexp = require('escape-regexp'); import Post from '../../models/post'; @@ -9,7 +8,6 @@ import User from '../../models/user'; import Mute from '../../models/mute'; import getFriends from '../../common/get-friends'; import serialize from '../../serializers/post'; -import config from '../../../conf'; /** * Search a post @@ -23,13 +21,21 @@ module.exports = (params, me) => new Promise(async (res, rej) => { const [text, textError] = $(params.text).optional.string().$; if (textError) return rej('invalid text param'); - // Get 'user_id' parameter - const [userId, userIdErr] = $(params.user_id).optional.id().$; - if (userIdErr) return rej('invalid user_id param'); + // Get 'include_user_ids' parameter + const [includeUserIds = [], includeUserIdsErr] = $(params.include_user_ids).optional.array('id').$; + if (includeUserIdsErr) return rej('invalid include_user_ids param'); - // Get 'username' parameter - const [username, usernameErr] = $(params.username).optional.string().$; - if (usernameErr) return rej('invalid username param'); + // Get 'exclude_user_ids' parameter + const [excludeUserIds = [], excludeUserIdsErr] = $(params.exclude_user_ids).optional.array('id').$; + if (excludeUserIdsErr) return rej('invalid exclude_user_ids param'); + + // Get 'include_user_usernames' parameter + const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.include_user_usernames).optional.array('string').$; + if (includeUserUsernamesErr) return rej('invalid include_user_usernames param'); + + // Get 'exclude_user_usernames' parameter + const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.exclude_user_usernames).optional.array('string').$; + if (excludeUserUsernamesErr) return rej('invalid exclude_user_usernames param'); // Get 'following' parameter const [following = null, followingErr] = $(params.following).optional.nullable.boolean().$; @@ -71,25 +77,36 @@ module.exports = (params, me) => new Promise(async (res, rej) => { const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 30).$; if (limitErr) return rej('invalid limit param'); - let user = userId; + let includeUsers = includeUserIds; + if (includeUserUsernames != null) { + const ids = (await Promise.all(includeUserUsernames.map(async (username) => { + const _user = await User.findOne({ + username_lower: username.toLowerCase() + }); + return _user ? _user._id : null; + }))).filter(id => id != null); + includeUsers = includeUsers.concat(ids); + } - if (user == null && username != null) { - const _user = await User.findOne({ - username_lower: username.toLowerCase() - }); - if (_user) { - user = _user._id; - } + let excludeUsers = excludeUserIds; + if (excludeUserUsernames != null) { + const ids = (await Promise.all(excludeUserUsernames.map(async (username) => { + const _user = await User.findOne({ + username_lower: username.toLowerCase() + }); + return _user ? _user._id : null; + }))).filter(id => id != null); + excludeUsers = excludeUsers.concat(ids); } - // If Elasticsearch is available, search by it - // If not, search by MongoDB - (config.elasticsearch.enable ? byElasticsearch : byNative) - (res, rej, me, text, user, following, mute, reply, repost, media, poll, sinceDate, untilDate, offset, limit); + search(res, rej, me, text, includeUsers, excludeUsers, following, + mute, reply, repost, media, poll, sinceDate, untilDate, offset, limit); }); -// Search by MongoDB -async function byNative(res, rej, me, text, userId, following, mute, reply, repost, media, poll, sinceDate, untilDate, offset, max) { +async function search( + res, rej, me, text, includeUserIds, excludeUserIds, following, + mute, reply, repost, media, poll, sinceDate, untilDate, offset, max) { + let q: any = { $and: [] }; @@ -115,9 +132,17 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo } } - if (userId) { + if (includeUserIds && includeUserIds.length != 0) { push({ - user_id: userId + user_id: { + $in: includeUserIds + } + }); + } else if (excludeUserIds && excludeUserIds.length != 0) { + push({ + user_id: { + $nin: excludeUserIds + } }); } @@ -328,66 +353,3 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo res(await Promise.all(posts.map(async post => await serialize(post, me)))); } - -// Search by Elasticsearch -async function byElasticsearch(res, rej, me, text, userId, following, mute, reply, repost, media, poll, sinceDate, untilDate, offset, max) { - const es = require('../../db/elasticsearch'); - - es.search({ - index: 'misskey', - type: 'post', - body: { - size: max, - from: offset, - query: { - simple_query_string: { - fields: ['text'], - query: text, - default_operator: 'and' - } - }, - sort: [ - { _doc: 'desc' } - ], - highlight: { - pre_tags: [''], - post_tags: [''], - encoder: 'html', - fields: { - text: {} - } - } - } - }, async (error, response) => { - if (error) { - console.error(error); - return res(500); - } - - if (response.hits.total === 0) { - return res([]); - } - - const hits = response.hits.hits.map(hit => new mongo.ObjectID(hit._id)); - - // Fetch found posts - const posts = await Post - .find({ - _id: { - $in: hits - } - }, { - sort: { - _id: -1 - } - }); - - posts.map(post => { - post._highlight = response.hits.hits.filter(hit => post._id.equals(hit._id))[0].highlight.text[0]; - }); - - // Serialize - res(await Promise.all(posts.map(async post => - await serialize(post, me)))); - }); -} diff --git a/src/web/app/common/scripts/parse-search-query.ts b/src/web/app/common/scripts/parse-search-query.ts index c021ee6417..512791ecb0 100644 --- a/src/web/app/common/scripts/parse-search-query.ts +++ b/src/web/app/common/scripts/parse-search-query.ts @@ -8,7 +8,10 @@ export default function(qs: string) { const [key, value] = x.split(':'); switch (key) { case 'user': - q['username'] = value; + q['include_user_usernames'] = value.split(','); + break; + case 'exclude_user': + q['exclude_user_usernames'] = value.split(','); break; case 'follow': q['following'] = value == 'null' ? null : value == 'true'; diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug index 9e64789488..f33091ee6b 100644 --- a/src/web/docs/search.ja.pug +++ b/src/web/docs/search.ja.pug @@ -31,7 +31,24 @@ section tbody tr td user - td ユーザー名。投稿者を限定します。 + td + | 指定されたユーザー名のユーザーの投稿に限定します。 + | 「,」(カンマ)で区切って、複数ユーザーを指定することもできます。 + br + | 例えば、 + code user:himawari,sakurako + | と検索すると「@himawariまたは@sakurakoの投稿」だけに限定します。 + | (つまりユーザーのホワイトリストです) + tr + td exclude_user + td + | 指定されたユーザー名のユーザーの投稿を除外します。 + | 「,」(カンマ)で区切って、複数ユーザーを指定することもできます。 + br + | 例えば、 + code exclude_user:akari,chinatsu + | と検索すると「@akariまたは@chinatsu以外の投稿」に限定します。 + | (つまりユーザーのブラックリストです) tr td follow td -- cgit v1.2.3-freya From 84ed78cef7b84353bc1ea48c91b78ecfb2a21f08 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 23 Dec 2017 07:21:57 +0900 Subject: :art: --- src/web/docs/style.styl | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl index 3dcb3e1696..a726d49b16 100644 --- a/src/web/docs/style.styl +++ b/src/web/docs/style.styl @@ -106,6 +106,7 @@ table min-width 128px code + display inline-block padding 8px 10px font-family Consolas, 'Courier New', Courier, Monaco, monospace color #295c92 -- cgit v1.2.3-freya From 59c64ba7d91be1fbedba3c7188150e0f81c76818 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 31 Dec 2017 14:38:41 +0900 Subject: Improve readability --- src/db/mongodb.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/db/mongodb.ts b/src/db/mongodb.ts index c978e6460f..be234b3650 100644 --- a/src/db/mongodb.ts +++ b/src/db/mongodb.ts @@ -1,8 +1,8 @@ import config from '../conf'; const uri = config.mongodb.user && config.mongodb.pass -? `mongodb://${config.mongodb.user}:${config.mongodb.pass}@${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}` -: `mongodb://${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`; + ? `mongodb://${config.mongodb.user}:${config.mongodb.pass}@${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}` + : `mongodb://${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`; /** * monk -- cgit v1.2.3-freya From deb86bf6e5fce7d97e449a1f7f2a7db48915a03d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 31 Dec 2017 15:15:19 +0900 Subject: Fix bug SEE: https://github.com/mongodb/node-mongodb-native/blob/3.0.0/CHANGES_3.0.0.md --- src/db/mongodb.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/db/mongodb.ts b/src/db/mongodb.ts index be234b3650..1263ccaacd 100644 --- a/src/db/mongodb.ts +++ b/src/db/mongodb.ts @@ -24,9 +24,9 @@ const nativeDbConn = async (): Promise => { if (mdb) return mdb; const db = await ((): Promise => new Promise((resolve, reject) => { - mongodb.MongoClient.connect(uri, (e, db) => { + (mongodb as any).MongoClient.connect(uri, (e, client) => { if (e) return reject(e); - resolve(db); + resolve(client.db(config.mongodb.db)); }); }))(); -- cgit v1.2.3-freya From 17369103d7d38e0d96083d331981e00c9565abb0 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Mon, 1 Jan 2018 00:02:58 +0900 Subject: LICENSE: Update year to 2018 --- LICENSE | 2 +- src/const.json | 2 +- webpack/plugins/banner.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/LICENSE b/LICENSE index e3733b3961..0b6e30e45f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2017 syuilo +Copyright (c) 2014-2018 syuilo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/const.json b/src/const.json index 0ee6ac2068..d8fe4fe6cd 100644 --- a/src/const.json +++ b/src/const.json @@ -1,5 +1,5 @@ { - "copyright": "Copyright (c) 2014-2017 syuilo", + "copyright": "Copyright (c) 2014-2018 syuilo", "themeColor": "#ff4e45", "themeColorForeground": "#fff" } diff --git a/webpack/plugins/banner.ts b/webpack/plugins/banner.ts index 47b8cd3555..a8774e0a39 100644 --- a/webpack/plugins/banner.ts +++ b/webpack/plugins/banner.ts @@ -3,7 +3,7 @@ import * as webpack from 'webpack'; export default version => new webpack.BannerPlugin({ banner: - `Misskey v${version} | MIT Licensed, (c) syuilo 2014-2017\n` + + `Misskey v${version} | MIT Licensed, (c) syuilo 2014-2018\n` + 'https://github.com/syuilo/misskey\n' + `built by ${os.hostname()} at ${new Date()}\n` + 'hash:[hash], chunkhash:[chunkhash]' -- cgit v1.2.3-freya From 88e4f1b287e9fa6be12b5a2277073265d6732527 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 1 Jan 2018 02:08:41 +0900 Subject: :v: --- src/common/build/license.ts | 13 +++++++++++++ src/web/docs/license.en.pug | 3 +++ src/web/docs/license.ja.pug | 3 +++ src/web/docs/vars.ts | 3 +++ webpack/module/rules/license.ts | 9 ++------- 5 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 src/common/build/license.ts create mode 100644 src/web/docs/license.en.pug create mode 100644 src/web/docs/license.ja.pug (limited to 'src') diff --git a/src/common/build/license.ts b/src/common/build/license.ts new file mode 100644 index 0000000000..e5c264df8a --- /dev/null +++ b/src/common/build/license.ts @@ -0,0 +1,13 @@ +import * as fs from 'fs'; + +const license = fs.readFileSync(__dirname + '/../../../LICENSE', 'utf-8'); + +const licenseHtml = license + .replace(/\r\n/g, '\n') + .replace(/(.)\n(.)/g, '$1 $2') + .replace(/(^|\n)(.*?)($|\n)/g, '

$2

'); + +export { + license, + licenseHtml +}; diff --git a/src/web/docs/license.en.pug b/src/web/docs/license.en.pug new file mode 100644 index 0000000000..240756e7ea --- /dev/null +++ b/src/web/docs/license.en.pug @@ -0,0 +1,3 @@ +h1 License + +div!= common.license diff --git a/src/web/docs/license.ja.pug b/src/web/docs/license.ja.pug new file mode 100644 index 0000000000..1f44f3f5e7 --- /dev/null +++ b/src/web/docs/license.ja.pug @@ -0,0 +1,3 @@ +h1 ライセンス + +div!= common.license diff --git a/src/web/docs/vars.ts b/src/web/docs/vars.ts index 65b224fbff..95ae9ee629 100644 --- a/src/web/docs/vars.ts +++ b/src/web/docs/vars.ts @@ -4,6 +4,7 @@ import * as yaml from 'js-yaml'; import { fa } from '../../common/build/fa'; import config from '../../conf'; +import { licenseHtml } from '../../common/build/license'; const constants = require('../../const.json'); export default function(): { [key: string]: any } { @@ -42,5 +43,7 @@ export default function(): { [key: string]: any } { vars['facss'] = fa.dom.css(); + vars['license'] = licenseHtml; + return vars; } diff --git a/webpack/module/rules/license.ts b/webpack/module/rules/license.ts index 1795af960d..de8b7d79fb 100644 --- a/webpack/module/rules/license.ts +++ b/webpack/module/rules/license.ts @@ -2,13 +2,8 @@ * Inject license */ -import * as fs from 'fs'; const StringReplacePlugin = require('string-replace-webpack-plugin'); - -const license = fs.readFileSync(__dirname + '/../../../LICENSE', 'utf-8') - .replace(/\r\n/g, '\n') - .replace(/(.)\n(.)/g, '$1 $2') - .replace(/(^|\n)(.*?)($|\n)/g, '

$2

'); +import { licenseHtml } from '../../../src/common/build/license'; export default () => ({ enforce: 'pre', @@ -16,7 +11,7 @@ export default () => ({ exclude: /node_modules/, loader: StringReplacePlugin.replace({ replacements: [{ - pattern: '%license%', replacement: () => license + pattern: '%license%', replacement: () => licenseHtml }] }) }); -- cgit v1.2.3-freya From f7cae37ce48a51b6d199635a05bb79132b8d5505 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 1 Jan 2018 02:26:25 +0900 Subject: Fix bug --- src/db/mongodb.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/db/mongodb.ts b/src/db/mongodb.ts index 1263ccaacd..bbbe70c34f 100644 --- a/src/db/mongodb.ts +++ b/src/db/mongodb.ts @@ -1,7 +1,10 @@ import config from '../conf'; -const uri = config.mongodb.user && config.mongodb.pass - ? `mongodb://${config.mongodb.user}:${config.mongodb.pass}@${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}` +const u = config.mongodb.user ? encodeURIComponent(config.mongodb.user) : null; +const p = config.mongodb.pass ? encodeURIComponent(config.mongodb.pass) : null; + +const uri = u && p + ? `mongodb://${u}:${p}@${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}` : `mongodb://${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`; /** -- cgit v1.2.3-freya From 6b9f6c6e3b2f82ea2a466614626b7bfaa6ad9286 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 8 Jan 2018 01:47:56 +0900 Subject: Show the licenses in the doc --- package.json | 2 ++ src/web/docs/api/gulpfile.ts | 8 ++++---- src/web/docs/gulpfile.ts | 4 ++-- src/web/docs/license.en.pug | 14 ++++++++++++++ src/web/docs/license.ja.pug | 14 ++++++++++++++ src/web/docs/style.styl | 2 ++ src/web/docs/vars.ts | 17 ++++++++++++++++- 7 files changed, 54 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/package.json b/package.json index 9245a6e2a1..69c92efdfd 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "@types/is-root": "1.0.0", "@types/is-url": "1.2.28", "@types/js-yaml": "3.10.1", + "@types/license-checker": "^15.0.0", "@types/mkdirp": "0.5.2", "@types/mocha": "2.2.45", "@types/mongodb": "2.2.18", @@ -122,6 +123,7 @@ "is-root": "1.0.0", "is-url": "1.2.2", "js-yaml": "3.10.0", + "license-checker": "^15.0.0", "mecab-async": "0.1.2", "mkdirp": "0.5.1", "mocha": "4.1.0", diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts index 4c30871a0f..cd1bf15307 100644 --- a/src/web/docs/api/gulpfile.ts +++ b/src/web/docs/api/gulpfile.ts @@ -17,8 +17,6 @@ import config from './../../../conf'; import generateVars from '../vars'; -const commonVars = generateVars(); - const langs = Object.keys(locales); const kebab = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); @@ -94,7 +92,8 @@ gulp.task('doc:api', [ 'doc:api:entities' ]); -gulp.task('doc:api:endpoints', () => { +gulp.task('doc:api:endpoints', async () => { + const commonVars = await generateVars(); glob('./src/web/docs/api/endpoints/**/*.yaml', (globErr, files) => { if (globErr) { console.error(globErr); @@ -144,7 +143,8 @@ gulp.task('doc:api:endpoints', () => { }); }); -gulp.task('doc:api:entities', () => { +gulp.task('doc:api:entities', async () => { + const commonVars = await generateVars(); glob('./src/web/docs/api/entities/**/*.yaml', (globErr, files) => { if (globErr) { console.error(globErr); diff --git a/src/web/docs/gulpfile.ts b/src/web/docs/gulpfile.ts index 71033e1bc7..d5ddda108d 100644 --- a/src/web/docs/gulpfile.ts +++ b/src/web/docs/gulpfile.ts @@ -23,9 +23,9 @@ gulp.task('doc', [ 'doc:styles' ]); -const commonVars = generateVars(); +gulp.task('doc:docs', async () => { + const commonVars = await generateVars(); -gulp.task('doc:docs', () => { glob('./src/web/docs/**/*.*.pug', (globErr, files) => { if (globErr) { console.error(globErr); diff --git a/src/web/docs/license.en.pug b/src/web/docs/license.en.pug index 240756e7ea..45d8b76473 100644 --- a/src/web/docs/license.en.pug +++ b/src/web/docs/license.en.pug @@ -1,3 +1,17 @@ h1 License div!= common.license + +details + summary Libraries + + section + h2 Libraries + + each dependency, name in common.dependencies + details + summary= name + + section + h3= name + pre= dependency.licenseText diff --git a/src/web/docs/license.ja.pug b/src/web/docs/license.ja.pug index 1f44f3f5e7..7bd9a62941 100644 --- a/src/web/docs/license.ja.pug +++ b/src/web/docs/license.ja.pug @@ -1,3 +1,17 @@ h1 ライセンス div!= common.license + +details + summary ライブラリ + + section + h2 ライブラリ + + each dependency, name in common.dependencies + details + summary= name + + section + h3= name + pre= dependency.licenseText diff --git a/src/web/docs/style.styl b/src/web/docs/style.styl index a726d49b16..bc165f8728 100644 --- a/src/web/docs/style.styl +++ b/src/web/docs/style.styl @@ -114,5 +114,7 @@ code border-radius 4px pre + overflow auto + > code display block diff --git a/src/web/docs/vars.ts b/src/web/docs/vars.ts index 95ae9ee629..6f713f21d0 100644 --- a/src/web/docs/vars.ts +++ b/src/web/docs/vars.ts @@ -1,13 +1,16 @@ import * as fs from 'fs'; +import * as util from 'util'; import * as glob from 'glob'; import * as yaml from 'js-yaml'; +import * as licenseChecker from 'license-checker'; +import * as tmp from 'tmp'; import { fa } from '../../common/build/fa'; import config from '../../conf'; import { licenseHtml } from '../../common/build/license'; const constants = require('../../const.json'); -export default function(): { [key: string]: any } { +export default async function(): Promise<{ [key: string]: any }> { const vars = {} as { [key: string]: any }; const endpoints = glob.sync('./src/web/docs/api/endpoints/**/*.yaml'); @@ -45,5 +48,17 @@ export default function(): { [key: string]: any } { vars['license'] = licenseHtml; + const tmpObj = tmp.fileSync(); + fs.writeFileSync(tmpObj.name, JSON.stringify({ + licenseText: '' + }), 'utf-8'); + const dependencies = await util.promisify(licenseChecker.init).bind(licenseChecker)({ + start: __dirname + '/../../../', + customPath: tmpObj.name + }); + tmpObj.removeCallback(); + + vars['dependencies'] = dependencies; + return vars; } -- cgit v1.2.3-freya From d8f8730a7423c2c7a3ccc0365680319c2ff57f14 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 19 Jan 2018 09:22:30 +0900 Subject: Update api.ts --- src/web/app/common/scripts/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/app/common/scripts/api.ts b/src/web/app/common/scripts/api.ts index 2008e6f5ac..bba838f56b 100644 --- a/src/web/app/common/scripts/api.ts +++ b/src/web/app/common/scripts/api.ts @@ -40,7 +40,7 @@ export default (i, endpoint, data = {}): Promise<{ [x: string]: any }> => { } else { res.json().then(err => { reject(err.error); - }); + }, reject); } }).catch(reject); }); -- cgit v1.2.3-freya From 50528955189a388ef2ad6f984e786d24c895c09a Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 19 Jan 2018 20:34:01 +0900 Subject: Refactor --- src/api/common/add-file-to-drive.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/api/common/add-file-to-drive.ts b/src/api/common/add-file-to-drive.ts index 427b54d72b..23cbc44e61 100644 --- a/src/api/common/add-file-to-drive.ts +++ b/src/api/common/add-file-to-drive.ts @@ -266,11 +266,11 @@ export default (user: any, file: string | stream.Readable, ...args) => new Promi } rej(new Error('un-compatible file.')); }) - .then(([path, remove]): Promise => new Promise((res, rej) => { + .then(([path, shouldCleanup]): Promise => new Promise((res, rej) => { addFile(user, path, ...args) .then(file => { res(file); - if (remove) { + if (shouldCleanup) { fs.unlink(path, (e) => { if (e) log(e.stack); }); -- cgit v1.2.3-freya From 1dab37bdaebf54d36085068787890c3983b86191 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 2 Feb 2018 07:34:51 +0900 Subject: Update dependencies :rocket: --- package.json | 60 +++++++++++++++++++++++++++---------------------------- src/db/mongodb.ts | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/package.json b/package.json index 69c92efdfd..bd51144807 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@prezzemolo/zip": "0.0.3", "@types/bcryptjs": "2.4.1", "@types/body-parser": "1.16.8", - "@types/chai": "4.0.10", + "@types/chai": "4.1.2", "@types/chai-http": "3.0.3", "@types/compression": "0.0.35", "@types/cookie": "0.3.1", @@ -39,7 +39,7 @@ "@types/deep-equal": "1.0.1", "@types/elasticsearch": "5.0.19", "@types/eventemitter3": "2.0.2", - "@types/express": "4.11.0", + "@types/express": "4.11.1", "@types/gm": "1.17.33", "@types/gulp": "3.8.36", "@types/gulp-htmlmin": "1.3.31", @@ -54,55 +54,55 @@ "@types/js-yaml": "3.10.1", "@types/license-checker": "^15.0.0", "@types/mkdirp": "0.5.2", - "@types/mocha": "2.2.45", - "@types/mongodb": "2.2.18", - "@types/monk": "1.0.6", + "@types/mocha": "2.2.47", + "@types/mongodb": "3.0.5", + "@types/monk": "6.0.0", "@types/morgan": "1.7.35", "@types/ms": "0.7.30", "@types/multer": "1.3.6", - "@types/node": "8.5.2", + "@types/node": "9.4.0", "@types/page": "1.5.32", "@types/proxy-addr": "2.0.0", "@types/pug": "2.0.4", "@types/qrcode": "0.8.0", "@types/ratelimiter": "2.1.28", - "@types/redis": "2.8.3", - "@types/request": "2.0.9", + "@types/redis": "2.8.5", + "@types/request": "2.47.0", "@types/rimraf": "2.0.2", "@types/riot": "3.6.1", "@types/seedrandom": "2.4.27", "@types/serve-favicon": "2.2.30", - "@types/speakeasy": "2.0.1", + "@types/speakeasy": "2.0.2", "@types/tmp": "0.0.33", "@types/uuid": "3.4.3", - "@types/webpack": "3.8.1", + "@types/webpack": "3.8.4", "@types/webpack-stream": "3.2.8", - "@types/websocket": "0.0.35", + "@types/websocket": "0.0.36", "accesses": "2.5.0", "animejs": "2.2.0", "autwh": "0.0.1", "awesome-typescript-loader": "3.4.1", "bcryptjs": "2.4.3", "body-parser": "1.18.2", - "cafy": "3.2.0", + "cafy": "3.2.1", "chai": "4.1.2", "chai-http": "3.0.0", "chalk": "2.3.0", "compression": "1.7.1", "cookie": "0.3.1", "cors": "2.8.4", - "cropperjs": "1.2.1", - "css-loader": "0.28.7", + "cropperjs": "1.2.2", + "css-loader": "0.28.9", "debug": "3.1.0", "deep-equal": "1.0.1", "deepcopy": "0.6.3", "diskusage": "0.2.4", - "elasticsearch": "14.0.0", + "elasticsearch": "14.1.0", "escape-regexp": "0.0.1", "eventemitter3": "3.0.0", "exif-js": "2.3.0", "express": "4.16.2", - "file-type": "7.4.0", + "file-type": "7.5.0", "fuckadblock": "3.2.1", "gm": "1.23.1", "gulp": "3.9.1", @@ -113,29 +113,29 @@ "gulp-pug": "3.3.0", "gulp-rename": "1.2.2", "gulp-replace": "0.6.1", - "gulp-stylus": "2.6.0", + "gulp-stylus": "2.7.0", "gulp-tslint": "8.1.2", - "gulp-typescript": "3.2.3", + "gulp-typescript": "3.2.4", "gulp-uglify": "3.0.0", "gulp-util": "3.0.8", "highlight.js": "9.12.0", - "inquirer": "4.0.1", + "inquirer": "5.0.1", "is-root": "1.0.0", "is-url": "1.2.2", "js-yaml": "3.10.0", - "license-checker": "^15.0.0", + "license-checker": "16.0.0", "mecab-async": "0.1.2", "mkdirp": "0.5.1", - "mocha": "4.1.0", + "mocha": "5.0.0", "moji": "0.5.1", - "mongodb": "3.0.1", + "mongodb": "3.0.2", "monk": "6.0.5", "morgan": "1.9.0", "ms": "2.1.1", "multer": "1.3.0", "nprogress": "0.2.0", "os-utils": "0.0.14", - "page": "1.7.1", + "page": "1.8.3", "pictograph": "2.1.5", "prominence": "0.2.0", "proxy-addr": "2.0.2", @@ -150,13 +150,13 @@ "riot": "3.8.1", "riot-tag-loader": "2.0.2", "rndstr": "1.0.0", - "s-age": "1.1.0", + "s-age": "1.1.2", "seedrandom": "2.4.3", "serve-favicon": "2.4.5", "sortablejs": "1.7.0", "speakeasy": "2.0.0", "string-replace-webpack-plugin": "0.1.3", - "style-loader": "0.19.1", + "style-loader": "0.20.1", "stylus": "0.54.5", "stylus-loader": "3.0.1", "summaly": "2.0.3", @@ -166,11 +166,11 @@ "textarea-caret": "3.0.2", "tmp": "0.0.33", "ts-node": "4.1.0", - "tslint": "5.8.0", - "typescript": "2.6.2", - "uglify-es": "3.3.4", - "uglifyjs-webpack-plugin": "1.1.5", - "uuid": "3.1.0", + "tslint": "5.9.1", + "typescript": "2.7.1", + "uglify-es": "3.3.9", + "uglifyjs-webpack-plugin": "1.1.8", + "uuid": "3.2.1", "vhost": "3.0.2", "web-push": "3.2.5", "webpack": "3.10.0", diff --git a/src/db/mongodb.ts b/src/db/mongodb.ts index bbbe70c34f..233f2f3d79 100644 --- a/src/db/mongodb.ts +++ b/src/db/mongodb.ts @@ -10,7 +10,7 @@ const uri = u && p /** * monk */ -import * as mongo from 'monk'; +import mongo from 'monk'; const db = mongo(uri); -- cgit v1.2.3-freya From 9a282e37be5ba847718d198d30eb97f31d11f2a0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 2 Feb 2018 08:06:01 +0900 Subject: wip --- src/api/models/app.ts | 95 ++++++++++++++- src/api/models/auth-session.ts | 44 ++++++- src/api/models/channel.ts | 66 ++++++++++- src/api/models/drive-file.ts | 84 ++++++++++++- src/api/models/drive-folder.ts | 67 ++++++++++- src/api/models/messaging-message.ts | 66 ++++++++++- src/api/models/notification.ts | 64 +++++++++- src/api/models/post-reaction.ts | 47 +++++++- src/api/models/post.ts | 189 ++++++++++++++++++++++++++++- src/api/models/signin.ts | 28 ++++- src/api/models/user.ts | 196 ++++++++++++++++++++++++++++++- src/api/serializers/app.ts | 83 ------------- src/api/serializers/auth-session.ts | 40 ------- src/api/serializers/channel.ts | 66 ----------- src/api/serializers/drive-file.ts | 78 ------------ src/api/serializers/drive-folder.ts | 64 ---------- src/api/serializers/drive-tag.ts | 35 ------ src/api/serializers/messaging-message.ts | 68 ----------- src/api/serializers/notification.ts | 65 ---------- src/api/serializers/post-reaction.ts | 43 ------- src/api/serializers/post.ts | 192 ------------------------------ src/api/serializers/signin.ts | 23 ---- src/api/serializers/user.ts | 190 ------------------------------ 23 files changed, 920 insertions(+), 973 deletions(-) delete mode 100644 src/api/serializers/app.ts delete mode 100644 src/api/serializers/auth-session.ts delete mode 100644 src/api/serializers/channel.ts delete mode 100644 src/api/serializers/drive-file.ts delete mode 100644 src/api/serializers/drive-folder.ts delete mode 100644 src/api/serializers/drive-tag.ts delete mode 100644 src/api/serializers/messaging-message.ts delete mode 100644 src/api/serializers/notification.ts delete mode 100644 src/api/serializers/post-reaction.ts delete mode 100644 src/api/serializers/post.ts delete mode 100644 src/api/serializers/signin.ts delete mode 100644 src/api/serializers/user.ts (limited to 'src') diff --git a/src/api/models/app.ts b/src/api/models/app.ts index 68f2f448b0..fe9d49ff67 100644 --- a/src/api/models/app.ts +++ b/src/api/models/app.ts @@ -1,13 +1,96 @@ +import * as mongo from 'mongodb'; +import deepcopy = require('deepcopy'); +import AccessToken from './access-token'; import db from '../../db/mongodb'; +import config from '../../conf'; -const collection = db.get('apps'); +const App = db.get('apps'); +App.createIndex('name_id'); +App.createIndex('name_id_lower'); +App.createIndex('secret'); +export default App; -(collection as any).createIndex('name_id'); // fuck type definition -(collection as any).createIndex('name_id_lower'); // fuck type definition -(collection as any).createIndex('secret'); // fuck type definition - -export default collection as any; // fuck type definition +export type IApp = { + _id: mongo.ObjectID; + created_at: Date; + user_id: mongo.ObjectID; +}; export function isValidNameId(nameId: string): boolean { return typeof nameId == 'string' && /^[a-zA-Z0-9\-]{3,30}$/.test(nameId); } + +/** + * Pack an app for API response + * + * @param {any} app + * @param {any} me? + * @param {any} options? + * @return {Promise} + */ +export const pack = ( + app: any, + me?: any, + options?: { + includeSecret?: boolean, + includeProfileImageIds?: boolean + } +) => new Promise(async (resolve, reject) => { + const opts = options || { + includeSecret: false, + includeProfileImageIds: false + }; + + let _app: any; + + // Populate the app if 'app' is ID + if (mongo.ObjectID.prototype.isPrototypeOf(app)) { + _app = await App.findOne({ + _id: app + }); + } else if (typeof app === 'string') { + _app = await App.findOne({ + _id: new mongo.ObjectID(app) + }); + } else { + _app = deepcopy(app); + } + + // Me + if (me && !mongo.ObjectID.prototype.isPrototypeOf(me)) { + if (typeof me === 'string') { + me = new mongo.ObjectID(me); + } else { + me = me._id; + } + } + + // Rename _id to id + _app.id = _app._id; + delete _app._id; + + delete _app.name_id_lower; + + // Visible by only owner + if (!opts.includeSecret) { + delete _app.secret; + } + + _app.icon_url = _app.icon != null + ? `${config.drive_url}/${_app.icon}` + : `${config.drive_url}/app-default.jpg`; + + if (me) { + // 既に連携しているか + const exist = await AccessToken.count({ + app_id: _app.id, + user_id: me, + }, { + limit: 1 + }); + + _app.is_authorized = exist === 1; + } + + resolve(_app); +}); diff --git a/src/api/models/auth-session.ts b/src/api/models/auth-session.ts index b264a133e9..997ec61c20 100644 --- a/src/api/models/auth-session.ts +++ b/src/api/models/auth-session.ts @@ -1,3 +1,45 @@ +import * as mongo from 'mongodb'; +import deepcopy = require('deepcopy'); import db from '../../db/mongodb'; +import { pack as packApp } from './app'; -export default db.get('auth_sessions') as any; // fuck type definition +const AuthSession = db.get('auth_sessions'); +export default AuthSession; + +export interface IAuthSession { + _id: mongo.ObjectID; +} + +/** + * Pack an auth session for API response + * + * @param {any} session + * @param {any} me? + * @return {Promise} + */ +export const pack = ( + session: any, + me?: any +) => new Promise(async (resolve, reject) => { + let _session: any; + + // TODO: Populate session if it ID + + _session = deepcopy(session); + + // Me + if (me && !mongo.ObjectID.prototype.isPrototypeOf(me)) { + if (typeof me === 'string') { + me = new mongo.ObjectID(me); + } else { + me = me._id; + } + } + + delete _session._id; + + // Populate app + _session.app = await packApp(_session.app_id, me); + + resolve(_session); +}); diff --git a/src/api/models/channel.ts b/src/api/models/channel.ts index c80e84dbc8..815d53593c 100644 --- a/src/api/models/channel.ts +++ b/src/api/models/channel.ts @@ -1,9 +1,11 @@ import * as mongo from 'mongodb'; +import deepcopy = require('deepcopy'); +import { IUser } from './user'; +import Watching from './channel-watching'; import db from '../../db/mongodb'; -const collection = db.get('channels'); - -export default collection as any; // fuck type definition +const Channel = db.get('channels'); +export default Channel; export type IChannel = { _id: mongo.ObjectID; @@ -12,3 +14,61 @@ export type IChannel = { user_id: mongo.ObjectID; index: number; }; + +/** + * Pack a channel for API response + * + * @param channel target + * @param me? serializee + * @return response + */ +export const pack = ( + channel: string | mongo.ObjectID | IChannel, + me?: string | mongo.ObjectID | IUser +) => new Promise(async (resolve, reject) => { + + let _channel: any; + + // Populate the channel if 'channel' is ID + if (mongo.ObjectID.prototype.isPrototypeOf(channel)) { + _channel = await Channel.findOne({ + _id: channel + }); + } else if (typeof channel === 'string') { + _channel = await Channel.findOne({ + _id: new mongo.ObjectID(channel) + }); + } else { + _channel = deepcopy(channel); + } + + // Rename _id to id + _channel.id = _channel._id; + delete _channel._id; + + // Remove needless properties + delete _channel.user_id; + + // Me + const meId: mongo.ObjectID = me + ? mongo.ObjectID.prototype.isPrototypeOf(me) + ? me as mongo.ObjectID + : typeof me === 'string' + ? new mongo.ObjectID(me) + : (me as IUser)._id + : null; + + if (me) { + //#region Watchしているかどうか + const watch = await Watching.findOne({ + user_id: meId, + channel_id: _channel.id, + deleted_at: { $exists: false } + }); + + _channel.is_watching = watch !== null; + //#endregion + } + + resolve(_channel); +}); diff --git a/src/api/models/drive-file.ts b/src/api/models/drive-file.ts index 802ee5a5fe..6a8db3ad42 100644 --- a/src/api/models/drive-file.ts +++ b/src/api/models/drive-file.ts @@ -1,9 +1,12 @@ import * as mongodb from 'mongodb'; +import deepcopy = require('deepcopy'); +import { pack as packFolder } from './drive-folder'; +import config from '../../conf'; import monkDb, { nativeDbConn } from '../../db/mongodb'; -const collection = monkDb.get('drive_files.files'); +const DriveFile = monkDb.get('drive_files.files'); -export default collection as any; // fuck type definition +export default DriveFile; const getGridFSBucket = async (): Promise => { const db = await nativeDbConn(); @@ -15,6 +18,12 @@ const getGridFSBucket = async (): Promise => { export { getGridFSBucket }; +export type IDriveFile = { + _id: mongodb.ObjectID; + created_at: Date; + user_id: mongodb.ObjectID; +}; + export function validateFileName(name: string): boolean { return ( (name.trim().length > 0) && @@ -24,3 +33,74 @@ export function validateFileName(name: string): boolean { (name.indexOf('..') === -1) ); } + +/** + * Pack a drive file for API response + * + * @param {any} file + * @param {any} options? + * @return {Promise} + */ +export const pack = ( + file: any, + options?: { + detail: boolean + } +) => new Promise(async (resolve, reject) => { + const opts = Object.assign({ + detail: false + }, options); + + let _file: any; + + // Populate the file if 'file' is ID + if (mongodb.ObjectID.prototype.isPrototypeOf(file)) { + _file = await DriveFile.findOne({ + _id: file + }); + } else if (typeof file === 'string') { + _file = await DriveFile.findOne({ + _id: new mongodb.ObjectID(file) + }); + } else { + _file = deepcopy(file); + } + + if (!_file) return reject('invalid file arg.'); + + // rendered target + let _target: any = {}; + + _target.id = _file._id; + _target.created_at = _file.uploadDate; + _target.name = _file.filename; + _target.type = _file.contentType; + _target.datasize = _file.length; + _target.md5 = _file.md5; + + _target = Object.assign(_target, _file.metadata); + + _target.url = `${config.drive_url}/${_target.id}/${encodeURIComponent(_target.name)}`; + + if (_target.properties == null) _target.properties = {}; + + if (opts.detail) { + if (_target.folder_id) { + // Populate folder + _target.folder = await packFolder(_target.folder_id, { + detail: true + }); + } + + /* + if (_target.tags) { + // Populate tags + _target.tags = await _target.tags.map(async (tag: any) => + await serializeDriveTag(tag) + ); + } + */ + } + + resolve(_target); +}); diff --git a/src/api/models/drive-folder.ts b/src/api/models/drive-folder.ts index f81ffe855d..48b26c2bd6 100644 --- a/src/api/models/drive-folder.ts +++ b/src/api/models/drive-folder.ts @@ -1,6 +1,16 @@ +import * as mongo from 'mongodb'; +import deepcopy = require('deepcopy'); import db from '../../db/mongodb'; +import DriveFile from './drive-file'; -export default db.get('drive_folders') as any; // fuck type definition +const DriveFolder = db.get('drive_folders'); +export default DriveFolder; + +export type IDriveFolder = { + _id: mongo.ObjectID; + created_at: Date; + user_id: mongo.ObjectID; +}; export function isValidFolderName(name: string): boolean { return ( @@ -8,3 +18,58 @@ export function isValidFolderName(name: string): boolean { (name.length <= 200) ); } + +/** + * Pack a drive folder for API response + * + * @param {any} folder + * @param {any} options? + * @return {Promise} + */ +export const pack = ( + folder: any, + options?: { + detail: boolean + } +) => new Promise(async (resolve, reject) => { + const opts = Object.assign({ + detail: false + }, options); + + let _folder: any; + + // Populate the folder if 'folder' is ID + if (mongo.ObjectID.prototype.isPrototypeOf(folder)) { + _folder = await DriveFolder.findOne({ _id: folder }); + } else if (typeof folder === 'string') { + _folder = await DriveFolder.findOne({ _id: new mongo.ObjectID(folder) }); + } else { + _folder = deepcopy(folder); + } + + // Rename _id to id + _folder.id = _folder._id; + delete _folder._id; + + if (opts.detail) { + const childFoldersCount = await DriveFolder.count({ + parent_id: _folder.id + }); + + const childFilesCount = await DriveFile.count({ + 'metadata.folder_id': _folder.id + }); + + _folder.folders_count = childFoldersCount; + _folder.files_count = childFilesCount; + } + + if (opts.detail && _folder.parent_id) { + // Populate parent folder + _folder.parent = await pack(_folder.parent_id, { + detail: true + }); + } + + resolve(_folder); +}); diff --git a/src/api/models/messaging-message.ts b/src/api/models/messaging-message.ts index 18afa57e44..ffdda1db21 100644 --- a/src/api/models/messaging-message.ts +++ b/src/api/models/messaging-message.ts @@ -1,7 +1,12 @@ import * as mongo from 'mongodb'; +import deepcopy = require('deepcopy'); +import { pack as packUser } from './user'; +import { pack as packFile } from './drive-file'; import db from '../../db/mongodb'; +import parse from '../common/text'; -export default db.get('messaging_messages') as any; // fuck type definition +const MessagingMessage = db.get('messaging_messages'); +export default MessagingMessage; export interface IMessagingMessage { _id: mongo.ObjectID; @@ -10,3 +15,62 @@ export interface IMessagingMessage { export function isValidText(text: string): boolean { return text.length <= 1000 && text.trim() != ''; } + +/** + * Pack a messaging message for API response + * + * @param {any} message + * @param {any} me? + * @param {any} options? + * @return {Promise} + */ +export const pack = ( + message: any, + me?: any, + options?: { + populateRecipient: boolean + } +) => new Promise(async (resolve, reject) => { + const opts = options || { + populateRecipient: true + }; + + let _message: any; + + // Populate the message if 'message' is ID + if (mongo.ObjectID.prototype.isPrototypeOf(message)) { + _message = await MessagingMessage.findOne({ + _id: message + }); + } else if (typeof message === 'string') { + _message = await MessagingMessage.findOne({ + _id: new mongo.ObjectID(message) + }); + } else { + _message = deepcopy(message); + } + + // Rename _id to id + _message.id = _message._id; + delete _message._id; + + // Parse text + if (_message.text) { + _message.ast = parse(_message.text); + } + + // Populate user + _message.user = await packUser(_message.user_id, me); + + if (_message.file) { + // Populate file + _message.file = await packFile(_message.file_id); + } + + if (opts.populateRecipient) { + // Populate recipient + _message.recipient = await packUser(_message.recipient_id, me); + } + + resolve(_message); +}); diff --git a/src/api/models/notification.ts b/src/api/models/notification.ts index e3dc6c70a3..fa7049d312 100644 --- a/src/api/models/notification.ts +++ b/src/api/models/notification.ts @@ -1,8 +1,11 @@ import * as mongo from 'mongodb'; +import deepcopy = require('deepcopy'); import db from '../../db/mongodb'; -import { IUser } from './user'; +import { IUser, pack as packUser } from './user'; +import { pack as packPost } from './post'; -export default db.get('notifications') as any; // fuck type definition +const Notification = db.get('notifications'); +export default Notification; export interface INotification { _id: mongo.ObjectID; @@ -45,3 +48,60 @@ export interface INotification { */ is_read: Boolean; } + +/** + * Pack a notification for API response + * + * @param {any} notification + * @return {Promise} + */ +export const pack = (notification: any) => new Promise(async (resolve, reject) => { + let _notification: any; + + // Populate the notification if 'notification' is ID + if (mongo.ObjectID.prototype.isPrototypeOf(notification)) { + _notification = await Notification.findOne({ + _id: notification + }); + } else if (typeof notification === 'string') { + _notification = await Notification.findOne({ + _id: new mongo.ObjectID(notification) + }); + } else { + _notification = deepcopy(notification); + } + + // Rename _id to id + _notification.id = _notification._id; + delete _notification._id; + + // Rename notifier_id to user_id + _notification.user_id = _notification.notifier_id; + delete _notification.notifier_id; + + const me = _notification.notifiee_id; + delete _notification.notifiee_id; + + // Populate notifier + _notification.user = await packUser(_notification.user_id, me); + + switch (_notification.type) { + case 'follow': + // nope + break; + case 'mention': + case 'reply': + case 'repost': + case 'quote': + case 'reaction': + case 'poll_vote': + // Populate post + _notification.post = await packPost(_notification.post_id, me); + break; + default: + console.error(`Unknown type: ${_notification.type}`); + break; + } + + resolve(_notification); +}); diff --git a/src/api/models/post-reaction.ts b/src/api/models/post-reaction.ts index 282ae5bd21..568bfc89a2 100644 --- a/src/api/models/post-reaction.ts +++ b/src/api/models/post-reaction.ts @@ -1,3 +1,48 @@ +import * as mongo from 'mongodb'; +import deepcopy = require('deepcopy'); import db from '../../db/mongodb'; +import Reaction from './post-reaction'; +import { pack as packUser } from './user'; -export default db.get('post_reactions') as any; // fuck type definition +const PostReaction = db.get('post_reactions'); +export default PostReaction; + +export interface IPostReaction { + _id: mongo.ObjectID; +} + +/** + * Pack a reaction for API response + * + * @param {any} reaction + * @param {any} me? + * @return {Promise} + */ +export const pack = ( + reaction: any, + me?: any +) => new Promise(async (resolve, reject) => { + let _reaction: any; + + // Populate the reaction if 'reaction' is ID + if (mongo.ObjectID.prototype.isPrototypeOf(reaction)) { + _reaction = await Reaction.findOne({ + _id: reaction + }); + } else if (typeof reaction === 'string') { + _reaction = await Reaction.findOne({ + _id: new mongo.ObjectID(reaction) + }); + } else { + _reaction = deepcopy(reaction); + } + + // Rename _id to id + _reaction.id = _reaction._id; + delete _reaction._id; + + // Populate user + _reaction.user = await packUser(_reaction.user_id, me); + + resolve(_reaction); +}); diff --git a/src/api/models/post.ts b/src/api/models/post.ts index 7584ce182d..ecc5e1a5e4 100644 --- a/src/api/models/post.ts +++ b/src/api/models/post.ts @@ -1,8 +1,18 @@ import * as mongo from 'mongodb'; - +import deepcopy = require('deepcopy'); +import rap from '@prezzemolo/rap'; import db from '../../db/mongodb'; +import { IUser, pack as packUser } from './user'; +import { pack as packApp } from './app'; +import { pack as packChannel } from './channel'; +import Vote from './poll-vote'; +import Reaction from './post-reaction'; +import { pack as packFile } from './drive-file'; +import parse from '../common/text'; + +const Post = db.get('posts'); -export default db.get('posts') as any; // fuck type definition +export default Post; export function isValidText(text: string): boolean { return text.length <= 1000 && text.trim() != ''; @@ -20,3 +30,178 @@ export type IPost = { user_id: mongo.ObjectID; app_id: mongo.ObjectID; }; + +/** + * Pack a post for API response + * + * @param post target + * @param me? serializee + * @param options? serialize options + * @return response + */ +export const pack = async ( + post: string | mongo.ObjectID | IPost, + me?: string | mongo.ObjectID | IUser, + options?: { + detail: boolean + } +) => { + const opts = options || { + detail: true, + }; + + // Me + const meId: mongo.ObjectID = me + ? mongo.ObjectID.prototype.isPrototypeOf(me) + ? me as mongo.ObjectID + : typeof me === 'string' + ? new mongo.ObjectID(me) + : (me as IUser)._id + : null; + + let _post: any; + + // Populate the post if 'post' is ID + if (mongo.ObjectID.prototype.isPrototypeOf(post)) { + _post = await Post.findOne({ + _id: post + }); + } else if (typeof post === 'string') { + _post = await Post.findOne({ + _id: new mongo.ObjectID(post) + }); + } else { + _post = deepcopy(post); + } + + if (!_post) throw 'invalid post arg.'; + + const id = _post._id; + + // Rename _id to id + _post.id = _post._id; + delete _post._id; + + delete _post.mentions; + + // Parse text + if (_post.text) { + _post.ast = parse(_post.text); + } + + // Populate user + _post.user = packUser(_post.user_id, meId); + + // Populate app + if (_post.app_id) { + _post.app = packApp(_post.app_id); + } + + // Populate channel + if (_post.channel_id) { + _post.channel = packChannel(_post.channel_id); + } + + // Populate media + if (_post.media_ids) { + _post.media = Promise.all(_post.media_ids.map(fileId => + packFile(fileId) + )); + } + + // When requested a detailed post data + if (opts.detail) { + // Get previous post info + _post.prev = (async () => { + const prev = await Post.findOne({ + user_id: _post.user_id, + _id: { + $lt: id + } + }, { + fields: { + _id: true + }, + sort: { + _id: -1 + } + }); + return prev ? prev._id : null; + })(); + + // Get next post info + _post.next = (async () => { + const next = await Post.findOne({ + user_id: _post.user_id, + _id: { + $gt: id + } + }, { + fields: { + _id: true + }, + sort: { + _id: 1 + } + }); + return next ? next._id : null; + })(); + + if (_post.reply_id) { + // Populate reply to post + _post.reply = pack(_post.reply_id, meId, { + detail: false + }); + } + + if (_post.repost_id) { + // Populate repost + _post.repost = pack(_post.repost_id, meId, { + detail: _post.text == null + }); + } + + // Poll + if (meId && _post.poll) { + _post.poll = (async (poll) => { + const vote = await Vote + .findOne({ + user_id: meId, + post_id: id + }); + + if (vote != null) { + const myChoice = poll.choices + .filter(c => c.id == vote.choice)[0]; + + myChoice.is_voted = true; + } + + return poll; + })(_post.poll); + } + + // Fetch my reaction + if (meId) { + _post.my_reaction = (async () => { + const reaction = await Reaction + .findOne({ + user_id: meId, + post_id: id, + deleted_at: { $exists: false } + }); + + if (reaction) { + return reaction.reaction; + } + + return null; + })(); + } + } + + // resolve promises in _post object + _post = await rap(_post); + + return _post; +}; diff --git a/src/api/models/signin.ts b/src/api/models/signin.ts index 385a348f2e..262c8707ed 100644 --- a/src/api/models/signin.ts +++ b/src/api/models/signin.ts @@ -1,3 +1,29 @@ +import * as mongo from 'mongodb'; +import deepcopy = require('deepcopy'); import db from '../../db/mongodb'; -export default db.get('signin') as any; // fuck type definition +const Signin = db.get('signin'); +export default Signin; + +export interface ISignin { + _id: mongo.ObjectID; +} + +/** + * Pack a signin record for API response + * + * @param {any} record + * @return {Promise} + */ +export const pack = ( + record: any +) => new Promise(async (resolve, reject) => { + + const _record = deepcopy(record); + + // Rename _id to id + _record.id = _record._id; + delete _record._id; + + resolve(_record); +}); diff --git a/src/api/models/user.ts b/src/api/models/user.ts index 018979158f..48a45ac2f7 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -1,14 +1,19 @@ import * as mongo from 'mongodb'; - +import deepcopy = require('deepcopy'); +import rap from '@prezzemolo/rap'; import db from '../../db/mongodb'; -import { IPost } from './post'; +import { IPost, pack as packPost } from './post'; +import Following from './following'; +import Mute from './mute'; +import getFriends from '../common/get-friends'; +import config from '../../conf'; -const collection = db.get('users'); +const User = db.get('users'); -(collection as any).createIndex('username'); // fuck type definition -(collection as any).createIndex('token'); // fuck type definition +User.createIndex('username'); +User.createIndex('token'); -export default collection as any; // fuck type definition +export default User; export function validateUsername(username: string): boolean { return typeof username == 'string' && /^[a-zA-Z0-9\-]{3,20}$/.test(username); @@ -83,3 +88,182 @@ export function init(user): IUser { user.pinned_post_id = new mongo.ObjectID(user.pinned_post_id); return user; } + +/** + * Pack a user for API response + * + * @param user target + * @param me? serializee + * @param options? serialize options + * @return Packed user + */ +export const pack = ( + user: string | mongo.ObjectID | IUser, + me?: string | mongo.ObjectID | IUser, + options?: { + detail?: boolean, + includeSecrets?: boolean + } +) => new Promise(async (resolve, reject) => { + + const opts = Object.assign({ + detail: false, + includeSecrets: false + }, options); + + let _user: any; + + const fields = opts.detail ? { + settings: false + } : { + settings: false, + client_settings: false, + profile: false, + keywords: false, + domains: false + }; + + // Populate the user if 'user' is ID + if (mongo.ObjectID.prototype.isPrototypeOf(user)) { + _user = await User.findOne({ + _id: user + }, { fields }); + } else if (typeof user === 'string') { + _user = await User.findOne({ + _id: new mongo.ObjectID(user) + }, { fields }); + } else { + _user = deepcopy(user); + } + + if (!_user) return reject('invalid user arg.'); + + // Me + const meId: mongo.ObjectID = me + ? mongo.ObjectID.prototype.isPrototypeOf(me) + ? me as mongo.ObjectID + : typeof me === 'string' + ? new mongo.ObjectID(me) + : (me as IUser)._id + : null; + + // Rename _id to id + _user.id = _user._id; + delete _user._id; + + // Remove needless properties + delete _user.latest_post; + + // Remove private properties + delete _user.password; + delete _user.token; + delete _user.two_factor_temp_secret; + delete _user.two_factor_secret; + delete _user.username_lower; + if (_user.twitter) { + delete _user.twitter.access_token; + delete _user.twitter.access_token_secret; + } + delete _user.line; + + // Visible via only the official client + if (!opts.includeSecrets) { + delete _user.email; + delete _user.client_settings; + } + + if (!opts.detail) { + delete _user.two_factor_enabled; + } + + _user.avatar_url = _user.avatar_id != null + ? `${config.drive_url}/${_user.avatar_id}` + : `${config.drive_url}/default-avatar.jpg`; + + _user.banner_url = _user.banner_id != null + ? `${config.drive_url}/${_user.banner_id}` + : null; + + if (!meId || !meId.equals(_user.id) || !opts.detail) { + delete _user.avatar_id; + delete _user.banner_id; + + delete _user.drive_capacity; + } + + if (meId && !meId.equals(_user.id)) { + // Whether the user is following + _user.is_following = (async () => { + const follow = await Following.findOne({ + follower_id: meId, + followee_id: _user.id, + deleted_at: { $exists: false } + }); + return follow !== null; + })(); + + // Whether the user is followed + _user.is_followed = (async () => { + const follow2 = await Following.findOne({ + follower_id: _user.id, + followee_id: meId, + deleted_at: { $exists: false } + }); + return follow2 !== null; + })(); + + // Whether the user is muted + _user.is_muted = (async () => { + const mute = await Mute.findOne({ + muter_id: meId, + mutee_id: _user.id, + deleted_at: { $exists: false } + }); + return mute !== null; + })(); + } + + if (opts.detail) { + if (_user.pinned_post_id) { + // Populate pinned post + _user.pinned_post = packPost(_user.pinned_post_id, meId, { + detail: true + }); + } + + if (meId && !meId.equals(_user.id)) { + const myFollowingIds = await getFriends(meId); + + // Get following you know count + _user.following_you_know_count = Following.count({ + followee_id: { $in: myFollowingIds }, + follower_id: _user.id, + deleted_at: { $exists: false } + }); + + // Get followers you know count + _user.followers_you_know_count = Following.count({ + followee_id: _user.id, + follower_id: { $in: myFollowingIds }, + deleted_at: { $exists: false } + }); + } + } + + // resolve promises in _user object + _user = await rap(_user); + + resolve(_user); +}); + +/* +function img(url) { + return { + thumbnail: { + large: `${url}`, + medium: '', + small: '' + } + }; +} +*/ diff --git a/src/api/serializers/app.ts b/src/api/serializers/app.ts deleted file mode 100644 index 9d1c46dca4..0000000000 --- a/src/api/serializers/app.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); -import App from '../models/app'; -import AccessToken from '../models/access-token'; -import config from '../../conf'; - -/** - * Serialize an app - * - * @param {any} app - * @param {any} me? - * @param {any} options? - * @return {Promise} - */ -export default ( - app: any, - me?: any, - options?: { - includeSecret?: boolean, - includeProfileImageIds?: boolean - } -) => new Promise(async (resolve, reject) => { - const opts = options || { - includeSecret: false, - includeProfileImageIds: false - }; - - let _app: any; - - // Populate the app if 'app' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(app)) { - _app = await App.findOne({ - _id: app - }); - } else if (typeof app === 'string') { - _app = await App.findOne({ - _id: new mongo.ObjectID(app) - }); - } else { - _app = deepcopy(app); - } - - // Me - if (me && !mongo.ObjectID.prototype.isPrototypeOf(me)) { - if (typeof me === 'string') { - me = new mongo.ObjectID(me); - } else { - me = me._id; - } - } - - // Rename _id to id - _app.id = _app._id; - delete _app._id; - - delete _app.name_id_lower; - - // Visible by only owner - if (!opts.includeSecret) { - delete _app.secret; - } - - _app.icon_url = _app.icon != null - ? `${config.drive_url}/${_app.icon}` - : `${config.drive_url}/app-default.jpg`; - - if (me) { - // 既に連携しているか - const exist = await AccessToken.count({ - app_id: _app.id, - user_id: me, - }, { - limit: 1 - }); - - _app.is_authorized = exist === 1; - } - - resolve(_app); -}); diff --git a/src/api/serializers/auth-session.ts b/src/api/serializers/auth-session.ts deleted file mode 100644 index a9acf1243a..0000000000 --- a/src/api/serializers/auth-session.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); -import serializeApp from './app'; - -/** - * Serialize an auth session - * - * @param {any} session - * @param {any} me? - * @return {Promise} - */ -export default ( - session: any, - me?: any -) => new Promise(async (resolve, reject) => { - let _session: any; - - // TODO: Populate session if it ID - - _session = deepcopy(session); - - // Me - if (me && !mongo.ObjectID.prototype.isPrototypeOf(me)) { - if (typeof me === 'string') { - me = new mongo.ObjectID(me); - } else { - me = me._id; - } - } - - delete _session._id; - - // Populate app - _session.app = await serializeApp(_session.app_id, me); - - resolve(_session); -}); diff --git a/src/api/serializers/channel.ts b/src/api/serializers/channel.ts deleted file mode 100644 index 3cba39aa16..0000000000 --- a/src/api/serializers/channel.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); -import { IUser } from '../models/user'; -import { default as Channel, IChannel } from '../models/channel'; -import Watching from '../models/channel-watching'; - -/** - * Serialize a channel - * - * @param channel target - * @param me? serializee - * @return response - */ -export default ( - channel: string | mongo.ObjectID | IChannel, - me?: string | mongo.ObjectID | IUser -) => new Promise(async (resolve, reject) => { - - let _channel: any; - - // Populate the channel if 'channel' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(channel)) { - _channel = await Channel.findOne({ - _id: channel - }); - } else if (typeof channel === 'string') { - _channel = await Channel.findOne({ - _id: new mongo.ObjectID(channel) - }); - } else { - _channel = deepcopy(channel); - } - - // Rename _id to id - _channel.id = _channel._id; - delete _channel._id; - - // Remove needless properties - delete _channel.user_id; - - // Me - const meId: mongo.ObjectID = me - ? mongo.ObjectID.prototype.isPrototypeOf(me) - ? me as mongo.ObjectID - : typeof me === 'string' - ? new mongo.ObjectID(me) - : (me as IUser)._id - : null; - - if (me) { - //#region Watchしているかどうか - const watch = await Watching.findOne({ - user_id: meId, - channel_id: _channel.id, - deleted_at: { $exists: false } - }); - - _channel.is_watching = watch !== null; - //#endregion - } - - resolve(_channel); -}); diff --git a/src/api/serializers/drive-file.ts b/src/api/serializers/drive-file.ts deleted file mode 100644 index 003e09ee77..0000000000 --- a/src/api/serializers/drive-file.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import DriveFile from '../models/drive-file'; -import serializeDriveFolder from './drive-folder'; -import serializeDriveTag from './drive-tag'; -import deepcopy = require('deepcopy'); -import config from '../../conf'; - -/** - * Serialize a drive file - * - * @param {any} file - * @param {any} options? - * @return {Promise} - */ -export default ( - file: any, - options?: { - detail: boolean - } -) => new Promise(async (resolve, reject) => { - const opts = Object.assign({ - detail: false - }, options); - - let _file: any; - - // Populate the file if 'file' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(file)) { - _file = await DriveFile.findOne({ - _id: file - }); - } else if (typeof file === 'string') { - _file = await DriveFile.findOne({ - _id: new mongo.ObjectID(file) - }); - } else { - _file = deepcopy(file); - } - - if (!_file) return reject('invalid file arg.'); - - // rendered target - let _target: any = {}; - - _target.id = _file._id; - _target.created_at = _file.uploadDate; - _target.name = _file.filename; - _target.type = _file.contentType; - _target.datasize = _file.length; - _target.md5 = _file.md5; - - _target = Object.assign(_target, _file.metadata); - - _target.url = `${config.drive_url}/${_target.id}/${encodeURIComponent(_target.name)}`; - - if (_target.properties == null) _target.properties = {}; - - if (opts.detail) { - if (_target.folder_id) { - // Populate folder - _target.folder = await serializeDriveFolder(_target.folder_id, { - detail: true - }); - } - - if (_target.tags) { - // Populate tags - _target.tags = await _target.tags.map(async (tag: any) => - await serializeDriveTag(tag) - ); - } - } - - resolve(_target); -}); diff --git a/src/api/serializers/drive-folder.ts b/src/api/serializers/drive-folder.ts deleted file mode 100644 index 6ebf454a28..0000000000 --- a/src/api/serializers/drive-folder.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import DriveFolder from '../models/drive-folder'; -import DriveFile from '../models/drive-file'; -import deepcopy = require('deepcopy'); - -/** - * Serialize a drive folder - * - * @param {any} folder - * @param {any} options? - * @return {Promise} - */ -const self = ( - folder: any, - options?: { - detail: boolean - } -) => new Promise(async (resolve, reject) => { - const opts = Object.assign({ - detail: false - }, options); - - let _folder: any; - - // Populate the folder if 'folder' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(folder)) { - _folder = await DriveFolder.findOne({ _id: folder }); - } else if (typeof folder === 'string') { - _folder = await DriveFolder.findOne({ _id: new mongo.ObjectID(folder) }); - } else { - _folder = deepcopy(folder); - } - - // Rename _id to id - _folder.id = _folder._id; - delete _folder._id; - - if (opts.detail) { - const childFoldersCount = await DriveFolder.count({ - parent_id: _folder.id - }); - - const childFilesCount = await DriveFile.count({ - 'metadata.folder_id': _folder.id - }); - - _folder.folders_count = childFoldersCount; - _folder.files_count = childFilesCount; - } - - if (opts.detail && _folder.parent_id) { - // Populate parent folder - _folder.parent = await self(_folder.parent_id, { - detail: true - }); - } - - resolve(_folder); -}); - -export default self; diff --git a/src/api/serializers/drive-tag.ts b/src/api/serializers/drive-tag.ts deleted file mode 100644 index 2f152381bd..0000000000 --- a/src/api/serializers/drive-tag.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import DriveTag from '../models/drive-tag'; -import deepcopy = require('deepcopy'); - -/** - * Serialize a drive tag - * - * @param {any} tag - * @return {Promise} - */ -const self = ( - tag: any -) => new Promise(async (resolve, reject) => { - let _tag: any; - - // Populate the tag if 'tag' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(tag)) { - _tag = await DriveTag.findOne({ _id: tag }); - } else if (typeof tag === 'string') { - _tag = await DriveTag.findOne({ _id: new mongo.ObjectID(tag) }); - } else { - _tag = deepcopy(tag); - } - - // Rename _id to id - _tag.id = _tag._id; - delete _tag._id; - - resolve(_tag); -}); - -export default self; diff --git a/src/api/serializers/messaging-message.ts b/src/api/serializers/messaging-message.ts deleted file mode 100644 index 4ab95e42a3..0000000000 --- a/src/api/serializers/messaging-message.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); -import Message from '../models/messaging-message'; -import serializeUser from './user'; -import serializeDriveFile from './drive-file'; -import parse from '../common/text'; - -/** - * Serialize a message - * - * @param {any} message - * @param {any} me? - * @param {any} options? - * @return {Promise} - */ -export default ( - message: any, - me?: any, - options?: { - populateRecipient: boolean - } -) => new Promise(async (resolve, reject) => { - const opts = options || { - populateRecipient: true - }; - - let _message: any; - - // Populate the message if 'message' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(message)) { - _message = await Message.findOne({ - _id: message - }); - } else if (typeof message === 'string') { - _message = await Message.findOne({ - _id: new mongo.ObjectID(message) - }); - } else { - _message = deepcopy(message); - } - - // Rename _id to id - _message.id = _message._id; - delete _message._id; - - // Parse text - if (_message.text) { - _message.ast = parse(_message.text); - } - - // Populate user - _message.user = await serializeUser(_message.user_id, me); - - if (_message.file) { - // Populate file - _message.file = await serializeDriveFile(_message.file_id); - } - - if (opts.populateRecipient) { - // Populate recipient - _message.recipient = await serializeUser(_message.recipient_id, me); - } - - resolve(_message); -}); diff --git a/src/api/serializers/notification.ts b/src/api/serializers/notification.ts deleted file mode 100644 index ac919dc8b0..0000000000 --- a/src/api/serializers/notification.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import Notification from '../models/notification'; -import serializeUser from './user'; -import serializePost from './post'; -import deepcopy = require('deepcopy'); - -/** - * Serialize a notification - * - * @param {any} notification - * @return {Promise} - */ -export default (notification: any) => new Promise(async (resolve, reject) => { - let _notification: any; - - // Populate the notification if 'notification' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(notification)) { - _notification = await Notification.findOne({ - _id: notification - }); - } else if (typeof notification === 'string') { - _notification = await Notification.findOne({ - _id: new mongo.ObjectID(notification) - }); - } else { - _notification = deepcopy(notification); - } - - // Rename _id to id - _notification.id = _notification._id; - delete _notification._id; - - // Rename notifier_id to user_id - _notification.user_id = _notification.notifier_id; - delete _notification.notifier_id; - - const me = _notification.notifiee_id; - delete _notification.notifiee_id; - - // Populate notifier - _notification.user = await serializeUser(_notification.user_id, me); - - switch (_notification.type) { - case 'follow': - // nope - break; - case 'mention': - case 'reply': - case 'repost': - case 'quote': - case 'reaction': - case 'poll_vote': - // Populate post - _notification.post = await serializePost(_notification.post_id, me); - break; - default: - console.error(`Unknown type: ${_notification.type}`); - break; - } - - resolve(_notification); -}); diff --git a/src/api/serializers/post-reaction.ts b/src/api/serializers/post-reaction.ts deleted file mode 100644 index b8807a741c..0000000000 --- a/src/api/serializers/post-reaction.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); -import Reaction from '../models/post-reaction'; -import serializeUser from './user'; - -/** - * Serialize a reaction - * - * @param {any} reaction - * @param {any} me? - * @return {Promise} - */ -export default ( - reaction: any, - me?: any -) => new Promise(async (resolve, reject) => { - let _reaction: any; - - // Populate the reaction if 'reaction' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(reaction)) { - _reaction = await Reaction.findOne({ - _id: reaction - }); - } else if (typeof reaction === 'string') { - _reaction = await Reaction.findOne({ - _id: new mongo.ObjectID(reaction) - }); - } else { - _reaction = deepcopy(reaction); - } - - // Rename _id to id - _reaction.id = _reaction._id; - delete _reaction._id; - - // Populate user - _reaction.user = await serializeUser(_reaction.user_id, me); - - resolve(_reaction); -}); diff --git a/src/api/serializers/post.ts b/src/api/serializers/post.ts deleted file mode 100644 index 03fd120772..0000000000 --- a/src/api/serializers/post.ts +++ /dev/null @@ -1,192 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); -import { default as Post, IPost } from '../models/post'; -import Reaction from '../models/post-reaction'; -import { IUser } from '../models/user'; -import Vote from '../models/poll-vote'; -import serializeApp from './app'; -import serializeChannel from './channel'; -import serializeUser from './user'; -import serializeDriveFile from './drive-file'; -import parse from '../common/text'; -import rap from '@prezzemolo/rap'; - -/** - * Serialize a post - * - * @param post target - * @param me? serializee - * @param options? serialize options - * @return response - */ -const self = async ( - post: string | mongo.ObjectID | IPost, - me?: string | mongo.ObjectID | IUser, - options?: { - detail: boolean - } -) => { - const opts = options || { - detail: true, - }; - - // Me - const meId: mongo.ObjectID = me - ? mongo.ObjectID.prototype.isPrototypeOf(me) - ? me as mongo.ObjectID - : typeof me === 'string' - ? new mongo.ObjectID(me) - : (me as IUser)._id - : null; - - let _post: any; - - // Populate the post if 'post' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(post)) { - _post = await Post.findOne({ - _id: post - }); - } else if (typeof post === 'string') { - _post = await Post.findOne({ - _id: new mongo.ObjectID(post) - }); - } else { - _post = deepcopy(post); - } - - if (!_post) throw 'invalid post arg.'; - - const id = _post._id; - - // Rename _id to id - _post.id = _post._id; - delete _post._id; - - delete _post.mentions; - - // Parse text - if (_post.text) { - _post.ast = parse(_post.text); - } - - // Populate user - _post.user = serializeUser(_post.user_id, meId); - - // Populate app - if (_post.app_id) { - _post.app = serializeApp(_post.app_id); - } - - // Populate channel - if (_post.channel_id) { - _post.channel = serializeChannel(_post.channel_id); - } - - // Populate media - if (_post.media_ids) { - _post.media = Promise.all(_post.media_ids.map(fileId => - serializeDriveFile(fileId) - )); - } - - // When requested a detailed post data - if (opts.detail) { - // Get previous post info - _post.prev = (async () => { - const prev = await Post.findOne({ - user_id: _post.user_id, - _id: { - $lt: id - } - }, { - fields: { - _id: true - }, - sort: { - _id: -1 - } - }); - return prev ? prev._id : null; - })(); - - // Get next post info - _post.next = (async () => { - const next = await Post.findOne({ - user_id: _post.user_id, - _id: { - $gt: id - } - }, { - fields: { - _id: true - }, - sort: { - _id: 1 - } - }); - return next ? next._id : null; - })(); - - if (_post.reply_id) { - // Populate reply to post - _post.reply = self(_post.reply_id, meId, { - detail: false - }); - } - - if (_post.repost_id) { - // Populate repost - _post.repost = self(_post.repost_id, meId, { - detail: _post.text == null - }); - } - - // Poll - if (meId && _post.poll) { - _post.poll = (async (poll) => { - const vote = await Vote - .findOne({ - user_id: meId, - post_id: id - }); - - if (vote != null) { - const myChoice = poll.choices - .filter(c => c.id == vote.choice)[0]; - - myChoice.is_voted = true; - } - - return poll; - })(_post.poll); - } - - // Fetch my reaction - if (meId) { - _post.my_reaction = (async () => { - const reaction = await Reaction - .findOne({ - user_id: meId, - post_id: id, - deleted_at: { $exists: false } - }); - - if (reaction) { - return reaction.reaction; - } - - return null; - })(); - } - } - - // resolve promises in _post object - _post = await rap(_post); - - return _post; -}; - -export default self; diff --git a/src/api/serializers/signin.ts b/src/api/serializers/signin.ts deleted file mode 100644 index 4068067678..0000000000 --- a/src/api/serializers/signin.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Module dependencies - */ -import deepcopy = require('deepcopy'); - -/** - * Serialize a signin record - * - * @param {any} record - * @return {Promise} - */ -export default ( - record: any -) => new Promise(async (resolve, reject) => { - - const _record = deepcopy(record); - - // Rename _id to id - _record.id = _record._id; - delete _record._id; - - resolve(_record); -}); diff --git a/src/api/serializers/user.ts b/src/api/serializers/user.ts deleted file mode 100644 index ac157097a8..0000000000 --- a/src/api/serializers/user.ts +++ /dev/null @@ -1,190 +0,0 @@ -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); -import { default as User, IUser } from '../models/user'; -import serializePost from './post'; -import Following from '../models/following'; -import Mute from '../models/mute'; -import getFriends from '../common/get-friends'; -import config from '../../conf'; -import rap from '@prezzemolo/rap'; - -/** - * Serialize a user - * - * @param user target - * @param me? serializee - * @param options? serialize options - * @return response - */ -export default ( - user: string | mongo.ObjectID | IUser, - me?: string | mongo.ObjectID | IUser, - options?: { - detail?: boolean, - includeSecrets?: boolean - } -) => new Promise(async (resolve, reject) => { - - const opts = Object.assign({ - detail: false, - includeSecrets: false - }, options); - - let _user: any; - - const fields = opts.detail ? { - settings: false - } : { - settings: false, - client_settings: false, - profile: false, - keywords: false, - domains: false - }; - - // Populate the user if 'user' is ID - if (mongo.ObjectID.prototype.isPrototypeOf(user)) { - _user = await User.findOne({ - _id: user - }, { fields }); - } else if (typeof user === 'string') { - _user = await User.findOne({ - _id: new mongo.ObjectID(user) - }, { fields }); - } else { - _user = deepcopy(user); - } - - if (!_user) return reject('invalid user arg.'); - - // Me - const meId: mongo.ObjectID = me - ? mongo.ObjectID.prototype.isPrototypeOf(me) - ? me as mongo.ObjectID - : typeof me === 'string' - ? new mongo.ObjectID(me) - : (me as IUser)._id - : null; - - // Rename _id to id - _user.id = _user._id; - delete _user._id; - - // Remove needless properties - delete _user.latest_post; - - // Remove private properties - delete _user.password; - delete _user.token; - delete _user.two_factor_temp_secret; - delete _user.two_factor_secret; - delete _user.username_lower; - if (_user.twitter) { - delete _user.twitter.access_token; - delete _user.twitter.access_token_secret; - } - delete _user.line; - - // Visible via only the official client - if (!opts.includeSecrets) { - delete _user.email; - delete _user.client_settings; - } - - if (!opts.detail) { - delete _user.two_factor_enabled; - } - - _user.avatar_url = _user.avatar_id != null - ? `${config.drive_url}/${_user.avatar_id}` - : `${config.drive_url}/default-avatar.jpg`; - - _user.banner_url = _user.banner_id != null - ? `${config.drive_url}/${_user.banner_id}` - : null; - - if (!meId || !meId.equals(_user.id) || !opts.detail) { - delete _user.avatar_id; - delete _user.banner_id; - - delete _user.drive_capacity; - } - - if (meId && !meId.equals(_user.id)) { - // Whether the user is following - _user.is_following = (async () => { - const follow = await Following.findOne({ - follower_id: meId, - followee_id: _user.id, - deleted_at: { $exists: false } - }); - return follow !== null; - })(); - - // Whether the user is followed - _user.is_followed = (async () => { - const follow2 = await Following.findOne({ - follower_id: _user.id, - followee_id: meId, - deleted_at: { $exists: false } - }); - return follow2 !== null; - })(); - - // Whether the user is muted - _user.is_muted = (async () => { - const mute = await Mute.findOne({ - muter_id: meId, - mutee_id: _user.id, - deleted_at: { $exists: false } - }); - return mute !== null; - })(); - } - - if (opts.detail) { - if (_user.pinned_post_id) { - // Populate pinned post - _user.pinned_post = serializePost(_user.pinned_post_id, meId, { - detail: true - }); - } - - if (meId && !meId.equals(_user.id)) { - const myFollowingIds = await getFriends(meId); - - // Get following you know count - _user.following_you_know_count = Following.count({ - followee_id: { $in: myFollowingIds }, - follower_id: _user.id, - deleted_at: { $exists: false } - }); - - // Get followers you know count - _user.followers_you_know_count = Following.count({ - followee_id: _user.id, - follower_id: { $in: myFollowingIds }, - deleted_at: { $exists: false } - }); - } - } - - // resolve promises in _user object - _user = await rap(_user); - - resolve(_user); -}); -/* -function img(url) { - return { - thumbnail: { - large: `${url}`, - medium: '', - small: '' - } - }; -} -*/ -- cgit v1.2.3-freya From 718060dc855e09f270b8e19c089ed3c3743665e0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 2 Feb 2018 08:21:30 +0900 Subject: wip --- src/api/common/add-file-to-drive.ts | 4 ++-- src/api/common/notify.ts | 6 +++--- src/api/endpoints/app/create.ts | 4 ++-- src/api/endpoints/app/show.ts | 4 ++-- src/api/endpoints/auth/session/show.ts | 4 ++-- src/api/endpoints/auth/session/userkey.ts | 4 ++-- src/api/endpoints/channels.ts | 4 ++-- src/api/endpoints/channels/create.ts | 4 ++-- src/api/endpoints/channels/posts.ts | 4 ++-- src/api/endpoints/channels/show.ts | 4 ++-- src/api/endpoints/drive/files.ts | 4 ++-- src/api/endpoints/drive/files/create.ts | 4 ++-- src/api/endpoints/drive/files/find.ts | 4 ++-- src/api/endpoints/drive/files/show.ts | 4 ++-- src/api/endpoints/drive/files/update.ts | 4 ++-- src/api/endpoints/drive/files/upload_from_url.ts | 4 ++-- src/api/endpoints/drive/folders.ts | 4 ++-- src/api/endpoints/drive/folders/create.ts | 4 ++-- src/api/endpoints/drive/folders/find.ts | 4 ++-- src/api/endpoints/drive/folders/show.ts | 4 ++-- src/api/endpoints/drive/folders/update.ts | 4 ++-- src/api/endpoints/drive/stream.ts | 4 ++-- src/api/endpoints/i.ts | 4 ++-- src/api/endpoints/i/authorized_apps.ts | 4 ++-- src/api/endpoints/i/favorites.ts | 4 ++-- src/api/endpoints/i/notifications.ts | 4 ++-- src/api/endpoints/i/pin.ts | 4 ++-- src/api/endpoints/i/signin_history.ts | 4 ++-- src/api/endpoints/i/update.ts | 4 ++-- src/api/endpoints/messaging/history.ts | 4 ++-- src/api/endpoints/messaging/messages.ts | 4 ++-- src/api/endpoints/messaging/messages/create.ts | 4 ++-- src/api/endpoints/mute/list.ts | 4 ++-- src/api/endpoints/my/apps.ts | 4 ++-- src/api/endpoints/posts.ts | 4 ++-- src/api/endpoints/posts/context.ts | 4 ++-- src/api/endpoints/posts/create.ts | 4 ++-- src/api/endpoints/posts/mentions.ts | 4 ++-- src/api/endpoints/posts/polls/recommendation.ts | 4 ++-- src/api/endpoints/posts/reactions.ts | 4 ++-- src/api/endpoints/posts/replies.ts | 4 ++-- src/api/endpoints/posts/reposts.ts | 4 ++-- src/api/endpoints/posts/search.ts | 4 ++-- src/api/endpoints/posts/show.ts | 4 ++-- src/api/endpoints/posts/timeline.ts | 4 ++-- src/api/endpoints/posts/trend.ts | 4 ++-- src/api/endpoints/users.ts | 4 ++-- src/api/endpoints/users/followers.ts | 4 ++-- src/api/endpoints/users/following.ts | 4 ++-- src/api/endpoints/users/get_frequently_replied_users.ts | 4 ++-- src/api/endpoints/users/posts.ts | 4 ++-- src/api/endpoints/users/recommendation.ts | 4 ++-- src/api/endpoints/users/search.ts | 4 ++-- src/api/endpoints/users/search_by_username.ts | 4 ++-- src/api/endpoints/users/show.ts | 4 ++-- src/api/models/drive-file.ts | 10 ++++++++-- src/api/models/drive-folder.ts | 2 ++ src/api/models/messaging-message.ts | 5 +++++ src/api/private/signin.ts | 4 ++-- src/api/private/signup.ts | 4 ++-- src/api/service/twitter.ts | 4 ++-- 61 files changed, 132 insertions(+), 119 deletions(-) (limited to 'src') diff --git a/src/api/common/add-file-to-drive.ts b/src/api/common/add-file-to-drive.ts index 23cbc44e61..1ee455c092 100644 --- a/src/api/common/add-file-to-drive.ts +++ b/src/api/common/add-file-to-drive.ts @@ -12,7 +12,7 @@ import prominence = require('prominence'); import DriveFile, { getGridFSBucket } from '../models/drive-file'; import DriveFolder from '../models/drive-folder'; -import serialize from '../serializers/drive-file'; +import { pack } from '../models/drive-file'; import event, { publishDriveStream } from '../event'; import config from '../../conf'; @@ -282,7 +282,7 @@ export default (user: any, file: string | stream.Readable, ...args) => new Promi log(`drive file has been created ${file._id}`); resolve(file); - serialize(file).then(serializedFile => { + pack(file).then(serializedFile => { // Publish drive_file_created event event(user._id, 'drive_file_created', serializedFile); publishDriveStream(user._id, 'file_created', serializedFile); diff --git a/src/api/common/notify.ts b/src/api/common/notify.ts index 2b79416a30..ae5669b84c 100644 --- a/src/api/common/notify.ts +++ b/src/api/common/notify.ts @@ -2,7 +2,7 @@ import * as mongo from 'mongodb'; import Notification from '../models/notification'; import Mute from '../models/mute'; import event from '../event'; -import serialize from '../serializers/notification'; +import { pack } from '../models/notification'; export default ( notifiee: mongo.ObjectID, @@ -27,7 +27,7 @@ export default ( // Publish notification event event(notifiee, 'notification', - await serialize(notification)); + await pack(notification)); // 3秒経っても(今回作成した)通知が既読にならなかったら「未読の通知がありますよ」イベントを発行する setTimeout(async () => { @@ -44,7 +44,7 @@ export default ( } //#endregion - event(notifiee, 'unread_notification', await serialize(notification)); + event(notifiee, 'unread_notification', await pack(notification)); } }, 3000); }); diff --git a/src/api/endpoints/app/create.ts b/src/api/endpoints/app/create.ts index ca684de02d..320163ebd9 100644 --- a/src/api/endpoints/app/create.ts +++ b/src/api/endpoints/app/create.ts @@ -5,7 +5,7 @@ import rndstr from 'rndstr'; import $ from 'cafy'; import App from '../../models/app'; import { isValidNameId } from '../../models/app'; -import serialize from '../../serializers/app'; +import { pack } from '../../models/app'; /** * @swagger @@ -106,5 +106,5 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { }); // Response - res(await serialize(app)); + res(await pack(app)); }); diff --git a/src/api/endpoints/app/show.ts b/src/api/endpoints/app/show.ts index 054aab8596..a3ef24717d 100644 --- a/src/api/endpoints/app/show.ts +++ b/src/api/endpoints/app/show.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import App from '../../models/app'; -import serialize from '../../serializers/app'; +import { pack } from '../../models/app'; /** * @swagger @@ -67,7 +67,7 @@ module.exports = (params, user, _, isSecure) => new Promise(async (res, rej) => } // Send response - res(await serialize(app, user, { + res(await pack(app, user, { includeSecret: isSecure && app.user_id.equals(user._id) })); }); diff --git a/src/api/endpoints/auth/session/show.ts b/src/api/endpoints/auth/session/show.ts index ede8a67634..1fe3b873fe 100644 --- a/src/api/endpoints/auth/session/show.ts +++ b/src/api/endpoints/auth/session/show.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import AuthSess from '../../../models/auth-session'; -import serialize from '../../../serializers/auth-session'; +import { pack } from '../../../models/auth-session'; /** * @swagger @@ -67,5 +67,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } // Response - res(await serialize(session, user)); + res(await pack(session, user)); }); diff --git a/src/api/endpoints/auth/session/userkey.ts b/src/api/endpoints/auth/session/userkey.ts index afd3250b04..fc989bf8c2 100644 --- a/src/api/endpoints/auth/session/userkey.ts +++ b/src/api/endpoints/auth/session/userkey.ts @@ -5,7 +5,7 @@ import $ from 'cafy'; import App from '../../../models/app'; import AuthSess from '../../../models/auth-session'; import AccessToken from '../../../models/access-token'; -import serialize from '../../../serializers/user'; +import { pack } from '../../../models/user'; /** * @swagger @@ -102,7 +102,7 @@ module.exports = (params) => new Promise(async (res, rej) => { // Response res({ access_token: accessToken.token, - user: await serialize(session.user_id, null, { + user: await pack(session.user_id, null, { detail: true }) }); diff --git a/src/api/endpoints/channels.ts b/src/api/endpoints/channels.ts index 14817d9bd8..92dcee83db 100644 --- a/src/api/endpoints/channels.ts +++ b/src/api/endpoints/channels.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Channel from '../models/channel'; -import serialize from '../serializers/channel'; +import { pack } from '../models/channel'; /** * Get all channels @@ -55,5 +55,5 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(channels.map(async channel => - await serialize(channel, me)))); + await pack(channel, me)))); }); diff --git a/src/api/endpoints/channels/create.ts b/src/api/endpoints/channels/create.ts index a8d7c29dc1..695b4515b3 100644 --- a/src/api/endpoints/channels/create.ts +++ b/src/api/endpoints/channels/create.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Channel from '../../models/channel'; import Watching from '../../models/channel-watching'; -import serialize from '../../serializers/channel'; +import { pack } from '../../models/channel'; /** * Create a channel @@ -28,7 +28,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { }); // Response - res(await serialize(channel)); + res(await pack(channel)); // Create Watching await Watching.insert({ diff --git a/src/api/endpoints/channels/posts.ts b/src/api/endpoints/channels/posts.ts index 9c2d607edb..3feee51f76 100644 --- a/src/api/endpoints/channels/posts.ts +++ b/src/api/endpoints/channels/posts.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import { default as Channel, IChannel } from '../../models/channel'; import Post from '../../models/post'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Show a posts of a channel @@ -74,6 +74,6 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(posts.map(async (post) => - await serialize(post, user) + await pack(post, user) ))); }); diff --git a/src/api/endpoints/channels/show.ts b/src/api/endpoints/channels/show.ts index 8861e54594..89c48379a4 100644 --- a/src/api/endpoints/channels/show.ts +++ b/src/api/endpoints/channels/show.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import { default as Channel, IChannel } from '../../models/channel'; -import serialize from '../../serializers/channel'; +import { pack } from '../../models/channel'; /** * Show a channel @@ -27,5 +27,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } // Serialize - res(await serialize(channel, user)); + res(await pack(channel, user)); }); diff --git a/src/api/endpoints/drive/files.ts b/src/api/endpoints/drive/files.ts index 3d5f81339a..3bd80e7282 100644 --- a/src/api/endpoints/drive/files.ts +++ b/src/api/endpoints/drive/files.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFile from '../../models/drive-file'; -import serialize from '../../serializers/drive-file'; +import { pack } from '../../models/drive-file'; /** * Get drive files @@ -69,6 +69,6 @@ module.exports = async (params, user, app) => { }); // Serialize - const _files = await Promise.all(files.map(file => serialize(file))); + const _files = await Promise.all(files.map(file => pack(file))); return _files; }; diff --git a/src/api/endpoints/drive/files/create.ts b/src/api/endpoints/drive/files/create.ts index 437348a1ef..6fa76d7e95 100644 --- a/src/api/endpoints/drive/files/create.ts +++ b/src/api/endpoints/drive/files/create.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import { validateFileName } from '../../../models/drive-file'; -import serialize from '../../../serializers/drive-file'; +import { pack } from '../../../models/drive-file'; import create from '../../../common/add-file-to-drive'; /** @@ -43,7 +43,7 @@ module.exports = async (file, params, user): Promise => { const driveFile = await create(user, file.path, name, null, folderId); // Serialize - return serialize(driveFile); + return pack(driveFile); } catch (e) { console.error(e); diff --git a/src/api/endpoints/drive/files/find.ts b/src/api/endpoints/drive/files/find.ts index a1cdf1643e..571aba81f4 100644 --- a/src/api/endpoints/drive/files/find.ts +++ b/src/api/endpoints/drive/files/find.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFile from '../../../models/drive-file'; -import serialize from '../../../serializers/drive-file'; +import { pack } from '../../../models/drive-file'; /** * Find a file(s) @@ -31,5 +31,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(files.map(async file => - await serialize(file)))); + await pack(file)))); }); diff --git a/src/api/endpoints/drive/files/show.ts b/src/api/endpoints/drive/files/show.ts index 3c7cf774f9..00f69f1415 100644 --- a/src/api/endpoints/drive/files/show.ts +++ b/src/api/endpoints/drive/files/show.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFile from '../../../models/drive-file'; -import serialize from '../../../serializers/drive-file'; +import { pack } from '../../../models/drive-file'; /** * Show a file @@ -29,7 +29,7 @@ module.exports = async (params, user) => { } // Serialize - const _file = await serialize(file, { + const _file = await pack(file, { detail: true }); diff --git a/src/api/endpoints/drive/files/update.ts b/src/api/endpoints/drive/files/update.ts index f39a420d6e..9ef8215b1a 100644 --- a/src/api/endpoints/drive/files/update.ts +++ b/src/api/endpoints/drive/files/update.ts @@ -5,7 +5,7 @@ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; import DriveFile from '../../../models/drive-file'; import { validateFileName } from '../../../models/drive-file'; -import serialize from '../../../serializers/drive-file'; +import { pack } from '../../../models/drive-file'; import { publishDriveStream } from '../../../event'; /** @@ -67,7 +67,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); // Serialize - const fileObj = await serialize(file); + const fileObj = await pack(file); // Response res(fileObj); diff --git a/src/api/endpoints/drive/files/upload_from_url.ts b/src/api/endpoints/drive/files/upload_from_url.ts index 519e0bdf65..f0398bfc5d 100644 --- a/src/api/endpoints/drive/files/upload_from_url.ts +++ b/src/api/endpoints/drive/files/upload_from_url.ts @@ -4,7 +4,7 @@ import * as URL from 'url'; import $ from 'cafy'; import { validateFileName } from '../../../models/drive-file'; -import serialize from '../../../serializers/drive-file'; +import { pack } from '../../../models/drive-file'; import create from '../../../common/add-file-to-drive'; import * as debug from 'debug'; import * as tmp from 'tmp'; @@ -63,5 +63,5 @@ module.exports = async (params, user): Promise => { if (e) log(e.stack); }); - return serialize(driveFile); + return pack(driveFile); }; diff --git a/src/api/endpoints/drive/folders.ts b/src/api/endpoints/drive/folders.ts index 7944e2c6a6..e650fb74aa 100644 --- a/src/api/endpoints/drive/folders.ts +++ b/src/api/endpoints/drive/folders.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFolder from '../../models/drive-folder'; -import serialize from '../../serializers/drive-folder'; +import { pack } from '../../models/drive-folder'; /** * Get drive folders @@ -63,5 +63,5 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(folders.map(async folder => - await serialize(folder)))); + await pack(folder)))); }); diff --git a/src/api/endpoints/drive/folders/create.ts b/src/api/endpoints/drive/folders/create.ts index be847b2153..1953c09ee0 100644 --- a/src/api/endpoints/drive/folders/create.ts +++ b/src/api/endpoints/drive/folders/create.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; import { isValidFolderName } from '../../../models/drive-folder'; -import serialize from '../../../serializers/drive-folder'; +import { pack } from '../../../models/drive-folder'; import { publishDriveStream } from '../../../event'; /** @@ -47,7 +47,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); // Serialize - const folderObj = await serialize(folder); + const folderObj = await pack(folder); // Response res(folderObj); diff --git a/src/api/endpoints/drive/folders/find.ts b/src/api/endpoints/drive/folders/find.ts index a5eb8e015d..caad45d740 100644 --- a/src/api/endpoints/drive/folders/find.ts +++ b/src/api/endpoints/drive/folders/find.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; -import serialize from '../../../serializers/drive-folder'; +import { pack } from '../../../models/drive-folder'; /** * Find a folder(s) @@ -30,5 +30,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); // Serialize - res(await Promise.all(folders.map(folder => serialize(folder)))); + res(await Promise.all(folders.map(folder => pack(folder)))); }); diff --git a/src/api/endpoints/drive/folders/show.ts b/src/api/endpoints/drive/folders/show.ts index 9b1c04ca3c..fd3061ca54 100644 --- a/src/api/endpoints/drive/folders/show.ts +++ b/src/api/endpoints/drive/folders/show.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; -import serialize from '../../../serializers/drive-folder'; +import { pack } from '../../../models/drive-folder'; /** * Show a folder @@ -29,7 +29,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } // Serialize - res(await serialize(folder, { + res(await pack(folder, { detail: true })); }); diff --git a/src/api/endpoints/drive/folders/update.ts b/src/api/endpoints/drive/folders/update.ts index ff673402ab..8f50a9d009 100644 --- a/src/api/endpoints/drive/folders/update.ts +++ b/src/api/endpoints/drive/folders/update.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; import { isValidFolderName } from '../../../models/drive-folder'; -import serialize from '../../../serializers/drive-folder'; +import { pack } from '../../../models/drive-folder'; import { publishDriveStream } from '../../../event'; /** @@ -91,7 +91,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); // Serialize - const folderObj = await serialize(folder); + const folderObj = await pack(folder); // Response res(folderObj); diff --git a/src/api/endpoints/drive/stream.ts b/src/api/endpoints/drive/stream.ts index 5b0eb0a0d8..3527d70500 100644 --- a/src/api/endpoints/drive/stream.ts +++ b/src/api/endpoints/drive/stream.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import DriveFile from '../../models/drive-file'; -import serialize from '../../serializers/drive-file'; +import { pack } from '../../models/drive-file'; /** * Get drive stream @@ -64,5 +64,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(files.map(async file => - await serialize(file)))); + await pack(file)))); }); diff --git a/src/api/endpoints/i.ts b/src/api/endpoints/i.ts index ae75f11d54..1b6c1e58de 100644 --- a/src/api/endpoints/i.ts +++ b/src/api/endpoints/i.ts @@ -2,7 +2,7 @@ * Module dependencies */ import User from '../models/user'; -import serialize from '../serializers/user'; +import { pack } from '../models/user'; /** * Show myself @@ -15,7 +15,7 @@ import serialize from '../serializers/user'; */ module.exports = (params, user, _, isSecure) => new Promise(async (res, rej) => { // Serialize - res(await serialize(user, user, { + res(await pack(user, user, { detail: true, includeSecrets: isSecure })); diff --git a/src/api/endpoints/i/authorized_apps.ts b/src/api/endpoints/i/authorized_apps.ts index 807ca5b1e7..40ce7a68c8 100644 --- a/src/api/endpoints/i/authorized_apps.ts +++ b/src/api/endpoints/i/authorized_apps.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import AccessToken from '../../models/access-token'; -import serialize from '../../serializers/app'; +import { pack } from '../../models/app'; /** * Get authorized apps of my account @@ -39,5 +39,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(tokens.map(async token => - await serialize(token.app_id)))); + await pack(token.app_id)))); }); diff --git a/src/api/endpoints/i/favorites.ts b/src/api/endpoints/i/favorites.ts index a66eaa7546..eb464cf0f0 100644 --- a/src/api/endpoints/i/favorites.ts +++ b/src/api/endpoints/i/favorites.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Favorite from '../../models/favorite'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Get followers of a user @@ -39,6 +39,6 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(favorites.map(async favorite => - await serialize(favorite.post) + await pack(favorite.post) ))); }); diff --git a/src/api/endpoints/i/notifications.ts b/src/api/endpoints/i/notifications.ts index fb9be7f61b..688039a0dd 100644 --- a/src/api/endpoints/i/notifications.ts +++ b/src/api/endpoints/i/notifications.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Notification from '../../models/notification'; import Mute from '../../models/mute'; -import serialize from '../../serializers/notification'; +import { pack } from '../../models/notification'; import getFriends from '../../common/get-friends'; import read from '../../common/read-notification'; @@ -101,7 +101,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(notifications.map(async notification => - await serialize(notification)))); + await pack(notification)))); // Mark as read all if (notifications.length > 0 && markAsRead) { diff --git a/src/api/endpoints/i/pin.ts b/src/api/endpoints/i/pin.ts index a94950d22b..ff546fc2bd 100644 --- a/src/api/endpoints/i/pin.ts +++ b/src/api/endpoints/i/pin.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import User from '../../models/user'; import Post from '../../models/post'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; /** * Pin post @@ -35,7 +35,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { }); // Serialize - const iObj = await serialize(user, user, { + const iObj = await pack(user, user, { detail: true }); diff --git a/src/api/endpoints/i/signin_history.ts b/src/api/endpoints/i/signin_history.ts index e38bfa4d98..3ab59b694d 100644 --- a/src/api/endpoints/i/signin_history.ts +++ b/src/api/endpoints/i/signin_history.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Signin from '../../models/signin'; -import serialize from '../../serializers/signin'; +import { pack } from '../../models/signin'; /** * Get signin history of my account @@ -58,5 +58,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(history.map(async record => - await serialize(record)))); + await pack(record)))); }); diff --git a/src/api/endpoints/i/update.ts b/src/api/endpoints/i/update.ts index c484c51a96..a138832e54 100644 --- a/src/api/endpoints/i/update.ts +++ b/src/api/endpoints/i/update.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import User from '../../models/user'; import { isValidName, isValidDescription, isValidLocation, isValidBirthday } from '../../models/user'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; import event from '../../event'; import config from '../../../conf'; @@ -65,7 +65,7 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re }); // Serialize - const iObj = await serialize(user, user, { + const iObj = await pack(user, user, { detail: true, includeSecrets: isSecure }); diff --git a/src/api/endpoints/messaging/history.ts b/src/api/endpoints/messaging/history.ts index f14740dff5..1683ca7a89 100644 --- a/src/api/endpoints/messaging/history.ts +++ b/src/api/endpoints/messaging/history.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import History from '../../models/messaging-history'; import Mute from '../../models/mute'; -import serialize from '../../serializers/messaging-message'; +import { pack } from '../../models/messaging-message'; /** * Show messaging history @@ -39,5 +39,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(history.map(async h => - await serialize(h.message, user)))); + await pack(h.message, user)))); }); diff --git a/src/api/endpoints/messaging/messages.ts b/src/api/endpoints/messaging/messages.ts index 3d3c6950a1..67ba5e9d6d 100644 --- a/src/api/endpoints/messaging/messages.ts +++ b/src/api/endpoints/messaging/messages.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Message from '../../models/messaging-message'; import User from '../../models/user'; -import serialize from '../../serializers/messaging-message'; +import { pack } from '../../models/messaging-message'; import read from '../../common/read-messaging-message'; /** @@ -87,7 +87,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(messages.map(async message => - await serialize(message, user, { + await pack(message, user, { populateRecipient: false })))); diff --git a/src/api/endpoints/messaging/messages/create.ts b/src/api/endpoints/messaging/messages/create.ts index 4e9d10197c..1b8a5f59e6 100644 --- a/src/api/endpoints/messaging/messages/create.ts +++ b/src/api/endpoints/messaging/messages/create.ts @@ -8,7 +8,7 @@ import History from '../../../models/messaging-history'; import User from '../../../models/user'; import Mute from '../../../models/mute'; import DriveFile from '../../../models/drive-file'; -import serialize from '../../../serializers/messaging-message'; +import { pack } from '../../../models/messaging-message'; import publishUserStream from '../../../event'; import { publishMessagingStream, publishMessagingIndexStream, pushSw } from '../../../event'; import config from '../../../../conf'; @@ -79,7 +79,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); // Serialize - const messageObj = await serialize(message); + const messageObj = await pack(message); // Reponse res(messageObj); diff --git a/src/api/endpoints/mute/list.ts b/src/api/endpoints/mute/list.ts index 740e19f0bb..19e3b157e6 100644 --- a/src/api/endpoints/mute/list.ts +++ b/src/api/endpoints/mute/list.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Mute from '../../models/mute'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; import getFriends from '../../common/get-friends'; /** @@ -63,7 +63,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Serialize const users = await Promise.all(mutes.map(async m => - await serialize(m.mutee_id, me, { detail: true }))); + await pack(m.mutee_id, me, { detail: true }))); // Response res({ diff --git a/src/api/endpoints/my/apps.ts b/src/api/endpoints/my/apps.ts index eb9c758768..fe583db86a 100644 --- a/src/api/endpoints/my/apps.ts +++ b/src/api/endpoints/my/apps.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import App from '../../models/app'; -import serialize from '../../serializers/app'; +import { pack } from '../../models/app'; /** * Get my apps @@ -37,5 +37,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Reply res(await Promise.all(apps.map(async app => - await serialize(app)))); + await pack(app)))); }); diff --git a/src/api/endpoints/posts.ts b/src/api/endpoints/posts.ts index db166cd67a..d10c6ab408 100644 --- a/src/api/endpoints/posts.ts +++ b/src/api/endpoints/posts.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Post from '../models/post'; -import serialize from '../serializers/post'; +import { pack } from '../models/post'; /** * Lists all posts @@ -85,5 +85,5 @@ module.exports = (params) => new Promise(async (res, rej) => { }); // Serialize - res(await Promise.all(posts.map(async post => await serialize(post)))); + res(await Promise.all(posts.map(async post => await pack(post)))); }); diff --git a/src/api/endpoints/posts/context.ts b/src/api/endpoints/posts/context.ts index bad59a6bee..3051e7af17 100644 --- a/src/api/endpoints/posts/context.ts +++ b/src/api/endpoints/posts/context.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Post from '../../models/post'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Show a context of a post @@ -60,5 +60,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(context.map(async post => - await serialize(post, user)))); + await pack(post, user)))); }); diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index a1d05c67c6..0fa52221f9 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -12,7 +12,7 @@ import Mute from '../../models/mute'; import DriveFile from '../../models/drive-file'; import Watching from '../../models/post-watching'; import ChannelWatching from '../../models/channel-watching'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; import notify from '../../common/notify'; import watch from '../../common/watch-post'; import event, { pushSw, publishChannelStream } from '../../event'; @@ -224,7 +224,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { }); // Serialize - const postObj = await serialize(post); + const postObj = await pack(post); // Reponse res({ diff --git a/src/api/endpoints/posts/mentions.ts b/src/api/endpoints/posts/mentions.ts index 3bb4ec3fa0..7127db0ad1 100644 --- a/src/api/endpoints/posts/mentions.ts +++ b/src/api/endpoints/posts/mentions.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Post from '../../models/post'; import getFriends from '../../common/get-friends'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Get mentions of myself @@ -73,6 +73,6 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(mentions.map(async mention => - await serialize(mention, user) + await pack(mention, user) ))); }); diff --git a/src/api/endpoints/posts/polls/recommendation.ts b/src/api/endpoints/posts/polls/recommendation.ts index 9c92d6cac4..5ccb754496 100644 --- a/src/api/endpoints/posts/polls/recommendation.ts +++ b/src/api/endpoints/posts/polls/recommendation.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Vote from '../../../models/poll-vote'; import Post from '../../../models/post'; -import serialize from '../../../serializers/post'; +import { pack } from '../../../models/post'; /** * Get recommended polls @@ -56,5 +56,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(posts.map(async post => - await serialize(post, user, { detail: true })))); + await pack(post, user, { detail: true })))); }); diff --git a/src/api/endpoints/posts/reactions.ts b/src/api/endpoints/posts/reactions.ts index eab5d9b258..f60334df8a 100644 --- a/src/api/endpoints/posts/reactions.ts +++ b/src/api/endpoints/posts/reactions.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Post from '../../models/post'; import Reaction from '../../models/post-reaction'; -import serialize from '../../serializers/post-reaction'; +import { pack } from '../../models/post-reaction'; /** * Show reactions of a post @@ -54,5 +54,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(reactions.map(async reaction => - await serialize(reaction, user)))); + await pack(reaction, user)))); }); diff --git a/src/api/endpoints/posts/replies.ts b/src/api/endpoints/posts/replies.ts index 3fd6a46769..1442b8a4c5 100644 --- a/src/api/endpoints/posts/replies.ts +++ b/src/api/endpoints/posts/replies.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Post from '../../models/post'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Show a replies of a post @@ -50,5 +50,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(replies.map(async post => - await serialize(post, user)))); + await pack(post, user)))); }); diff --git a/src/api/endpoints/posts/reposts.ts b/src/api/endpoints/posts/reposts.ts index bcc6163a11..0fbb0687b9 100644 --- a/src/api/endpoints/posts/reposts.ts +++ b/src/api/endpoints/posts/reposts.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Post from '../../models/post'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Show a reposts of a post @@ -70,5 +70,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(reposts.map(async post => - await serialize(post, user)))); + await pack(post, user)))); }); diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 31c9a8d3c8..6e26f55390 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -7,7 +7,7 @@ import Post from '../../models/post'; import User from '../../models/user'; import Mute from '../../models/mute'; import getFriends from '../../common/get-friends'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Search a post @@ -351,5 +351,5 @@ async function search( // Serialize res(await Promise.all(posts.map(async post => - await serialize(post, me)))); + await pack(post, me)))); } diff --git a/src/api/endpoints/posts/show.ts b/src/api/endpoints/posts/show.ts index 5bfe4f6605..c312449710 100644 --- a/src/api/endpoints/posts/show.ts +++ b/src/api/endpoints/posts/show.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import Post from '../../models/post'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Show a post @@ -27,7 +27,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } // Serialize - res(await serialize(post, user, { + res(await pack(post, user, { detail: true })); }); diff --git a/src/api/endpoints/posts/timeline.ts b/src/api/endpoints/posts/timeline.ts index da7ffd0c14..c41cfdb8bd 100644 --- a/src/api/endpoints/posts/timeline.ts +++ b/src/api/endpoints/posts/timeline.ts @@ -7,7 +7,7 @@ import Post from '../../models/post'; import Mute from '../../models/mute'; import ChannelWatching from '../../models/channel-watching'; import getFriends from '../../common/get-friends'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Get timeline of myself @@ -128,5 +128,5 @@ module.exports = async (params, user, app) => { }); // Serialize - return await Promise.all(timeline.map(post => serialize(post, user))); + return await Promise.all(timeline.map(post => pack(post, user))); }; diff --git a/src/api/endpoints/posts/trend.ts b/src/api/endpoints/posts/trend.ts index 64a195dff1..b2b1d327a8 100644 --- a/src/api/endpoints/posts/trend.ts +++ b/src/api/endpoints/posts/trend.ts @@ -4,7 +4,7 @@ const ms = require('ms'); import $ from 'cafy'; import Post from '../../models/post'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Get trend posts @@ -76,5 +76,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(posts.map(async post => - await serialize(post, user, { detail: true })))); + await pack(post, user, { detail: true })))); }); diff --git a/src/api/endpoints/users.ts b/src/api/endpoints/users.ts index f3c9b66a5e..ba33b1aeb7 100644 --- a/src/api/endpoints/users.ts +++ b/src/api/endpoints/users.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import User from '../models/user'; -import serialize from '../serializers/user'; +import { pack } from '../models/user'; /** * Lists all users @@ -55,5 +55,5 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(users.map(async user => - await serialize(user, me)))); + await pack(user, me)))); }); diff --git a/src/api/endpoints/users/followers.ts b/src/api/endpoints/users/followers.ts index 4905323ba5..b0fb83c683 100644 --- a/src/api/endpoints/users/followers.ts +++ b/src/api/endpoints/users/followers.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import User from '../../models/user'; import Following from '../../models/following'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; import getFriends from '../../common/get-friends'; /** @@ -82,7 +82,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Serialize const users = await Promise.all(following.map(async f => - await serialize(f.follower_id, me, { detail: true }))); + await pack(f.follower_id, me, { detail: true }))); // Response res({ diff --git a/src/api/endpoints/users/following.ts b/src/api/endpoints/users/following.ts index dc2ff49bbe..8e88431e92 100644 --- a/src/api/endpoints/users/following.ts +++ b/src/api/endpoints/users/following.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import User from '../../models/user'; import Following from '../../models/following'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; import getFriends from '../../common/get-friends'; /** @@ -82,7 +82,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Serialize const users = await Promise.all(following.map(async f => - await serialize(f.followee_id, me, { detail: true }))); + await pack(f.followee_id, me, { detail: true }))); // Response res({ diff --git a/src/api/endpoints/users/get_frequently_replied_users.ts b/src/api/endpoints/users/get_frequently_replied_users.ts index a8add623d4..3cbc761322 100644 --- a/src/api/endpoints/users/get_frequently_replied_users.ts +++ b/src/api/endpoints/users/get_frequently_replied_users.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Post from '../../models/post'; import User from '../../models/user'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; module.exports = (params, me) => new Promise(async (res, rej) => { // Get 'user_id' parameter @@ -91,7 +91,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Make replies object (includes weights) const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({ - user: await serialize(user, me, { detail: true }), + user: await pack(user, me, { detail: true }), weight: repliedUsers[user] / peak }))); diff --git a/src/api/endpoints/users/posts.ts b/src/api/endpoints/users/posts.ts index 0d8384a43d..1f3db3cf79 100644 --- a/src/api/endpoints/users/posts.ts +++ b/src/api/endpoints/users/posts.ts @@ -4,7 +4,7 @@ import $ from 'cafy'; import Post from '../../models/post'; import User from '../../models/user'; -import serialize from '../../serializers/post'; +import { pack } from '../../models/post'; /** * Get posts of a user @@ -124,6 +124,6 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(posts.map(async (post) => - await serialize(post, me) + await pack(post, me) ))); }); diff --git a/src/api/endpoints/users/recommendation.ts b/src/api/endpoints/users/recommendation.ts index 731d68a7b1..b80fd63ce7 100644 --- a/src/api/endpoints/users/recommendation.ts +++ b/src/api/endpoints/users/recommendation.ts @@ -4,7 +4,7 @@ const ms = require('ms'); import $ from 'cafy'; import User from '../../models/user'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; import getFriends from '../../common/get-friends'; /** @@ -44,5 +44,5 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(users.map(async user => - await serialize(user, me, { detail: true })))); + await pack(user, me, { detail: true })))); }); diff --git a/src/api/endpoints/users/search.ts b/src/api/endpoints/users/search.ts index 73a5db47e2..213038403b 100644 --- a/src/api/endpoints/users/search.ts +++ b/src/api/endpoints/users/search.ts @@ -4,7 +4,7 @@ import * as mongo from 'mongodb'; import $ from 'cafy'; import User from '../../models/user'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; import config from '../../../conf'; const escapeRegexp = require('escape-regexp'); @@ -94,6 +94,6 @@ async function byElasticsearch(res, rej, me, query, offset, max) { // Serialize res(await Promise.all(users.map(async user => - await serialize(user, me, { detail: true })))); + await pack(user, me, { detail: true })))); }); } diff --git a/src/api/endpoints/users/search_by_username.ts b/src/api/endpoints/users/search_by_username.ts index 7f2f42f0a6..63e206b1f2 100644 --- a/src/api/endpoints/users/search_by_username.ts +++ b/src/api/endpoints/users/search_by_username.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import User from '../../models/user'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; /** * Search a user by username @@ -35,5 +35,5 @@ module.exports = (params, me) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(users.map(async user => - await serialize(user, me, { detail: true })))); + await pack(user, me, { detail: true })))); }); diff --git a/src/api/endpoints/users/show.ts b/src/api/endpoints/users/show.ts index 8e74b0fe3f..a51cb619d4 100644 --- a/src/api/endpoints/users/show.ts +++ b/src/api/endpoints/users/show.ts @@ -3,7 +3,7 @@ */ import $ from 'cafy'; import User from '../../models/user'; -import serialize from '../../serializers/user'; +import { pack } from '../../models/user'; /** * Show a user @@ -41,7 +41,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => { } // Send response - res(await serialize(user, me, { + res(await pack(user, me, { detail: true })); }); diff --git a/src/api/models/drive-file.ts b/src/api/models/drive-file.ts index 6a8db3ad42..9b9df1dac6 100644 --- a/src/api/models/drive-file.ts +++ b/src/api/models/drive-file.ts @@ -20,8 +20,14 @@ export { getGridFSBucket }; export type IDriveFile = { _id: mongodb.ObjectID; - created_at: Date; - user_id: mongodb.ObjectID; + uploadDate: Date; + md5: string; + filename: string; + metadata: { + properties: any; + user_id: mongodb.ObjectID; + folder_id: mongodb.ObjectID; + } }; export function validateFileName(name: string): boolean { diff --git a/src/api/models/drive-folder.ts b/src/api/models/drive-folder.ts index 48b26c2bd6..54b45049b9 100644 --- a/src/api/models/drive-folder.ts +++ b/src/api/models/drive-folder.ts @@ -9,7 +9,9 @@ export default DriveFolder; export type IDriveFolder = { _id: mongo.ObjectID; created_at: Date; + name: string; user_id: mongo.ObjectID; + parent_id: mongo.ObjectID; }; export function isValidFolderName(name: string): boolean { diff --git a/src/api/models/messaging-message.ts b/src/api/models/messaging-message.ts index ffdda1db21..90cf1cd71c 100644 --- a/src/api/models/messaging-message.ts +++ b/src/api/models/messaging-message.ts @@ -10,6 +10,11 @@ export default MessagingMessage; export interface IMessagingMessage { _id: mongo.ObjectID; + created_at: Date; + text: string; + user_id: mongo.ObjectID; + recipient_id: mongo.ObjectID; + is_read: boolean; } export function isValidText(text: string): boolean { diff --git a/src/api/private/signin.ts b/src/api/private/signin.ts index a26c8f6c5a..ab6e93562c 100644 --- a/src/api/private/signin.ts +++ b/src/api/private/signin.ts @@ -3,7 +3,7 @@ import * as bcrypt from 'bcryptjs'; import * as speakeasy from 'speakeasy'; import { default as User, IUser } from '../models/user'; import Signin from '../models/signin'; -import serialize from '../serializers/signin'; +import { pack } from '../models/signin'; import event from '../event'; import signin from '../common/signin'; import config from '../../conf'; @@ -85,5 +85,5 @@ export default async (req: express.Request, res: express.Response) => { }); // Publish signin event - event(user._id, 'signin', await serialize(record)); + event(user._id, 'signin', await pack(record)); }; diff --git a/src/api/private/signup.ts b/src/api/private/signup.ts index 466c6a489f..105fe319a5 100644 --- a/src/api/private/signup.ts +++ b/src/api/private/signup.ts @@ -4,7 +4,7 @@ import * as bcrypt from 'bcryptjs'; import recaptcha = require('recaptcha-promise'); import { default as User, IUser } from '../models/user'; import { validateUsername, validatePassword } from '../models/user'; -import serialize from '../serializers/user'; +import { pack } from '../models/user'; import generateUserToken from '../common/generate-native-user-token'; import config from '../../conf'; @@ -142,7 +142,7 @@ export default async (req: express.Request, res: express.Response) => { }); // Response - res.send(await serialize(account)); + res.send(await pack(account)); // Create search index if (config.elasticsearch.enable) { diff --git a/src/api/service/twitter.ts b/src/api/service/twitter.ts index 0e75ee0bdb..ca4f8abcca 100644 --- a/src/api/service/twitter.ts +++ b/src/api/service/twitter.ts @@ -6,7 +6,7 @@ import * as uuid from 'uuid'; import autwh from 'autwh'; import redis from '../../db/redis'; import User from '../models/user'; -import serialize from '../serializers/user'; +import { pack } from '../models/user'; import event from '../event'; import config from '../../conf'; import signin from '../common/signin'; @@ -50,7 +50,7 @@ module.exports = (app: express.Application) => { res.send(`Twitterの連携を解除しました :v:`); // Publish i updated event - event(user._id, 'i_updated', await serialize(user, user, { + event(user._id, 'i_updated', await pack(user, user, { detail: true, includeSecrets: true })); -- cgit v1.2.3-freya From 2cb0511dba7463ad50725fd2dfd1966f0a108a45 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Fri, 2 Feb 2018 10:31:17 +0900 Subject: wip --- src/api/endpoints/app/create.ts | 3 +-- src/api/endpoints/app/show.ts | 3 +-- src/api/endpoints/auth/session/show.ts | 3 +-- src/api/endpoints/channels.ts | 3 +-- src/api/endpoints/channels/posts.ts | 3 +-- src/api/endpoints/channels/show.ts | 3 +-- src/api/endpoints/drive/files.ts | 3 +-- src/api/endpoints/drive/files/create.ts | 3 +-- src/api/endpoints/drive/files/find.ts | 3 +-- src/api/endpoints/drive/files/show.ts | 3 +-- src/api/endpoints/drive/files/update.ts | 3 +-- src/api/endpoints/drive/files/upload_from_url.ts | 3 +-- src/api/endpoints/drive/folders.ts | 3 +-- src/api/endpoints/drive/folders/create.ts | 3 +-- src/api/endpoints/drive/folders/find.ts | 3 +-- src/api/endpoints/drive/folders/show.ts | 3 +-- src/api/endpoints/drive/folders/update.ts | 3 +-- src/api/endpoints/drive/stream.ts | 3 +-- src/api/endpoints/i.ts | 3 +-- src/api/endpoints/i/signin_history.ts | 3 +-- src/api/endpoints/i/update.ts | 3 +-- src/api/endpoints/my/apps.ts | 3 +-- src/api/endpoints/posts.ts | 3 +-- src/api/endpoints/posts/context.ts | 3 +-- src/api/endpoints/posts/polls/recommendation.ts | 3 +-- src/api/endpoints/posts/reactions.ts | 3 +-- src/api/endpoints/posts/replies.ts | 3 +-- src/api/endpoints/posts/reposts.ts | 3 +-- src/api/endpoints/posts/show.ts | 3 +-- src/api/endpoints/posts/trend.ts | 3 +-- src/api/endpoints/users.ts | 3 +-- src/api/endpoints/users/get_frequently_replied_users.ts | 3 +-- src/api/endpoints/users/posts.ts | 3 +-- src/api/endpoints/users/recommendation.ts | 3 +-- src/api/endpoints/users/search.ts | 3 +-- src/api/endpoints/users/search_by_username.ts | 3 +-- src/api/endpoints/users/show.ts | 3 +-- src/api/private/signin.ts | 3 +-- src/api/private/signup.ts | 3 +-- src/api/service/twitter.ts | 3 +-- 40 files changed, 40 insertions(+), 80 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/app/create.ts b/src/api/endpoints/app/create.ts index 320163ebd9..71633f7def 100644 --- a/src/api/endpoints/app/create.ts +++ b/src/api/endpoints/app/create.ts @@ -4,8 +4,7 @@ import rndstr from 'rndstr'; import $ from 'cafy'; import App from '../../models/app'; -import { isValidNameId } from '../../models/app'; -import { pack } from '../../models/app'; +import { isValidNameId }, { pack } from '../../models/app'; /** * @swagger diff --git a/src/api/endpoints/app/show.ts b/src/api/endpoints/app/show.ts index a3ef24717d..8bc3dda42c 100644 --- a/src/api/endpoints/app/show.ts +++ b/src/api/endpoints/app/show.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import App from '../../models/app'; -import { pack } from '../../models/app'; +import App, { pack } from '../../models/app'; /** * @swagger diff --git a/src/api/endpoints/auth/session/show.ts b/src/api/endpoints/auth/session/show.ts index 1fe3b873fe..73ac3185f6 100644 --- a/src/api/endpoints/auth/session/show.ts +++ b/src/api/endpoints/auth/session/show.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import AuthSess from '../../../models/auth-session'; -import { pack } from '../../../models/auth-session'; +import AuthSess, { pack } from '../../../models/auth-session'; /** * @swagger diff --git a/src/api/endpoints/channels.ts b/src/api/endpoints/channels.ts index 92dcee83db..b9a7d1b788 100644 --- a/src/api/endpoints/channels.ts +++ b/src/api/endpoints/channels.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import Channel from '../models/channel'; -import { pack } from '../models/channel'; +import Channel, { pack } from '../models/channel'; /** * Get all channels diff --git a/src/api/endpoints/channels/posts.ts b/src/api/endpoints/channels/posts.ts index 3feee51f76..d722589c20 100644 --- a/src/api/endpoints/channels/posts.ts +++ b/src/api/endpoints/channels/posts.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import { default as Channel, IChannel } from '../../models/channel'; -import Post from '../../models/post'; -import { pack } from '../../models/post'; +import Post, { pack } from '../../models/post'; /** * Show a posts of a channel diff --git a/src/api/endpoints/channels/show.ts b/src/api/endpoints/channels/show.ts index 89c48379a4..3238616fa5 100644 --- a/src/api/endpoints/channels/show.ts +++ b/src/api/endpoints/channels/show.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import { default as Channel, IChannel } from '../../models/channel'; -import { pack } from '../../models/channel'; +import { default as Channel, IChannel }, { pack } from '../../models/channel'; /** * Show a channel diff --git a/src/api/endpoints/drive/files.ts b/src/api/endpoints/drive/files.ts index 3bd80e7282..89915331ea 100644 --- a/src/api/endpoints/drive/files.ts +++ b/src/api/endpoints/drive/files.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFile from '../../models/drive-file'; -import { pack } from '../../models/drive-file'; +import DriveFile, { pack } from '../../models/drive-file'; /** * Get drive files diff --git a/src/api/endpoints/drive/files/create.ts b/src/api/endpoints/drive/files/create.ts index 6fa76d7e95..7b424f3f5a 100644 --- a/src/api/endpoints/drive/files/create.ts +++ b/src/api/endpoints/drive/files/create.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import { validateFileName } from '../../../models/drive-file'; -import { pack } from '../../../models/drive-file'; +import { validateFileName }, { pack } from '../../../models/drive-file'; import create from '../../../common/add-file-to-drive'; /** diff --git a/src/api/endpoints/drive/files/find.ts b/src/api/endpoints/drive/files/find.ts index 571aba81f4..e026afe936 100644 --- a/src/api/endpoints/drive/files/find.ts +++ b/src/api/endpoints/drive/files/find.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFile from '../../../models/drive-file'; -import { pack } from '../../../models/drive-file'; +import DriveFile, { pack } from '../../../models/drive-file'; /** * Find a file(s) diff --git a/src/api/endpoints/drive/files/show.ts b/src/api/endpoints/drive/files/show.ts index 00f69f1415..21664f7ba4 100644 --- a/src/api/endpoints/drive/files/show.ts +++ b/src/api/endpoints/drive/files/show.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFile from '../../../models/drive-file'; -import { pack } from '../../../models/drive-file'; +import DriveFile, { pack } from '../../../models/drive-file'; /** * Show a file diff --git a/src/api/endpoints/drive/files/update.ts b/src/api/endpoints/drive/files/update.ts index 9ef8215b1a..ff65a48f71 100644 --- a/src/api/endpoints/drive/files/update.ts +++ b/src/api/endpoints/drive/files/update.ts @@ -4,8 +4,7 @@ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; import DriveFile from '../../../models/drive-file'; -import { validateFileName } from '../../../models/drive-file'; -import { pack } from '../../../models/drive-file'; +import { validateFileName }, { pack } from '../../../models/drive-file'; import { publishDriveStream } from '../../../event'; /** diff --git a/src/api/endpoints/drive/files/upload_from_url.ts b/src/api/endpoints/drive/files/upload_from_url.ts index f0398bfc5d..009f06aaaf 100644 --- a/src/api/endpoints/drive/files/upload_from_url.ts +++ b/src/api/endpoints/drive/files/upload_from_url.ts @@ -3,8 +3,7 @@ */ import * as URL from 'url'; import $ from 'cafy'; -import { validateFileName } from '../../../models/drive-file'; -import { pack } from '../../../models/drive-file'; +import { validateFileName }, { pack } from '../../../models/drive-file'; import create from '../../../common/add-file-to-drive'; import * as debug from 'debug'; import * as tmp from 'tmp'; diff --git a/src/api/endpoints/drive/folders.ts b/src/api/endpoints/drive/folders.ts index e650fb74aa..428bde3507 100644 --- a/src/api/endpoints/drive/folders.ts +++ b/src/api/endpoints/drive/folders.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFolder from '../../models/drive-folder'; -import { pack } from '../../models/drive-folder'; +import DriveFolder, { pack } from '../../models/drive-folder'; /** * Get drive folders diff --git a/src/api/endpoints/drive/folders/create.ts b/src/api/endpoints/drive/folders/create.ts index 1953c09ee0..6543b11274 100644 --- a/src/api/endpoints/drive/folders/create.ts +++ b/src/api/endpoints/drive/folders/create.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; -import { isValidFolderName } from '../../../models/drive-folder'; -import { pack } from '../../../models/drive-folder'; +import { isValidFolderName }, { pack } from '../../../models/drive-folder'; import { publishDriveStream } from '../../../event'; /** diff --git a/src/api/endpoints/drive/folders/find.ts b/src/api/endpoints/drive/folders/find.ts index caad45d740..fc84766bc8 100644 --- a/src/api/endpoints/drive/folders/find.ts +++ b/src/api/endpoints/drive/folders/find.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFolder from '../../../models/drive-folder'; -import { pack } from '../../../models/drive-folder'; +import DriveFolder, { pack } from '../../../models/drive-folder'; /** * Find a folder(s) diff --git a/src/api/endpoints/drive/folders/show.ts b/src/api/endpoints/drive/folders/show.ts index fd3061ca54..e07d14d20d 100644 --- a/src/api/endpoints/drive/folders/show.ts +++ b/src/api/endpoints/drive/folders/show.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFolder from '../../../models/drive-folder'; -import { pack } from '../../../models/drive-folder'; +import DriveFolder, { pack } from '../../../models/drive-folder'; /** * Show a folder diff --git a/src/api/endpoints/drive/folders/update.ts b/src/api/endpoints/drive/folders/update.ts index 8f50a9d009..2adcadcb08 100644 --- a/src/api/endpoints/drive/folders/update.ts +++ b/src/api/endpoints/drive/folders/update.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; -import { isValidFolderName } from '../../../models/drive-folder'; -import { pack } from '../../../models/drive-folder'; +import { isValidFolderName }, { pack } from '../../../models/drive-folder'; import { publishDriveStream } from '../../../event'; /** diff --git a/src/api/endpoints/drive/stream.ts b/src/api/endpoints/drive/stream.ts index 3527d70500..8352c7dd4c 100644 --- a/src/api/endpoints/drive/stream.ts +++ b/src/api/endpoints/drive/stream.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFile from '../../models/drive-file'; -import { pack } from '../../models/drive-file'; +import DriveFile, { pack } from '../../models/drive-file'; /** * Get drive stream diff --git a/src/api/endpoints/i.ts b/src/api/endpoints/i.ts index 1b6c1e58de..7efdbcd7c9 100644 --- a/src/api/endpoints/i.ts +++ b/src/api/endpoints/i.ts @@ -1,8 +1,7 @@ /** * Module dependencies */ -import User from '../models/user'; -import { pack } from '../models/user'; +import User, { pack } from '../models/user'; /** * Show myself diff --git a/src/api/endpoints/i/signin_history.ts b/src/api/endpoints/i/signin_history.ts index 3ab59b694d..859e81653d 100644 --- a/src/api/endpoints/i/signin_history.ts +++ b/src/api/endpoints/i/signin_history.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import Signin from '../../models/signin'; -import { pack } from '../../models/signin'; +import Signin, { pack } from '../../models/signin'; /** * Get signin history of my account diff --git a/src/api/endpoints/i/update.ts b/src/api/endpoints/i/update.ts index a138832e54..cd4b1a13f5 100644 --- a/src/api/endpoints/i/update.ts +++ b/src/api/endpoints/i/update.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import User from '../../models/user'; -import { isValidName, isValidDescription, isValidLocation, isValidBirthday } from '../../models/user'; -import { pack } from '../../models/user'; +import { isValidName, isValidDescription, isValidLocation, isValidBirthday }, { pack } from '../../models/user'; import event from '../../event'; import config from '../../../conf'; diff --git a/src/api/endpoints/my/apps.ts b/src/api/endpoints/my/apps.ts index fe583db86a..b236190506 100644 --- a/src/api/endpoints/my/apps.ts +++ b/src/api/endpoints/my/apps.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import App from '../../models/app'; -import { pack } from '../../models/app'; +import App, { pack } from '../../models/app'; /** * Get my apps diff --git a/src/api/endpoints/posts.ts b/src/api/endpoints/posts.ts index d10c6ab408..3b29425927 100644 --- a/src/api/endpoints/posts.ts +++ b/src/api/endpoints/posts.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import Post from '../models/post'; -import { pack } from '../models/post'; +import Post, { pack } from '../models/post'; /** * Lists all posts diff --git a/src/api/endpoints/posts/context.ts b/src/api/endpoints/posts/context.ts index 3051e7af17..5ba3758975 100644 --- a/src/api/endpoints/posts/context.ts +++ b/src/api/endpoints/posts/context.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import Post from '../../models/post'; -import { pack } from '../../models/post'; +import Post, { pack } from '../../models/post'; /** * Show a context of a post diff --git a/src/api/endpoints/posts/polls/recommendation.ts b/src/api/endpoints/posts/polls/recommendation.ts index 5ccb754496..4a3fa3f55e 100644 --- a/src/api/endpoints/posts/polls/recommendation.ts +++ b/src/api/endpoints/posts/polls/recommendation.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import Vote from '../../../models/poll-vote'; -import Post from '../../../models/post'; -import { pack } from '../../../models/post'; +import Post, { pack } from '../../../models/post'; /** * Get recommended polls diff --git a/src/api/endpoints/posts/reactions.ts b/src/api/endpoints/posts/reactions.ts index f60334df8a..feb140ab41 100644 --- a/src/api/endpoints/posts/reactions.ts +++ b/src/api/endpoints/posts/reactions.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import Post from '../../models/post'; -import Reaction from '../../models/post-reaction'; -import { pack } from '../../models/post-reaction'; +import Reaction, { pack } from '../../models/post-reaction'; /** * Show reactions of a post diff --git a/src/api/endpoints/posts/replies.ts b/src/api/endpoints/posts/replies.ts index 1442b8a4c5..613c4fa24c 100644 --- a/src/api/endpoints/posts/replies.ts +++ b/src/api/endpoints/posts/replies.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import Post from '../../models/post'; -import { pack } from '../../models/post'; +import Post, { pack } from '../../models/post'; /** * Show a replies of a post diff --git a/src/api/endpoints/posts/reposts.ts b/src/api/endpoints/posts/reposts.ts index 0fbb0687b9..89ab0e3d55 100644 --- a/src/api/endpoints/posts/reposts.ts +++ b/src/api/endpoints/posts/reposts.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import Post from '../../models/post'; -import { pack } from '../../models/post'; +import Post, { pack } from '../../models/post'; /** * Show a reposts of a post diff --git a/src/api/endpoints/posts/show.ts b/src/api/endpoints/posts/show.ts index c312449710..3839490597 100644 --- a/src/api/endpoints/posts/show.ts +++ b/src/api/endpoints/posts/show.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import Post from '../../models/post'; -import { pack } from '../../models/post'; +import Post, { pack } from '../../models/post'; /** * Show a post diff --git a/src/api/endpoints/posts/trend.ts b/src/api/endpoints/posts/trend.ts index b2b1d327a8..caded92bf5 100644 --- a/src/api/endpoints/posts/trend.ts +++ b/src/api/endpoints/posts/trend.ts @@ -3,8 +3,7 @@ */ const ms = require('ms'); import $ from 'cafy'; -import Post from '../../models/post'; -import { pack } from '../../models/post'; +import Post, { pack } from '../../models/post'; /** * Get trend posts diff --git a/src/api/endpoints/users.ts b/src/api/endpoints/users.ts index ba33b1aeb7..095b9fe40d 100644 --- a/src/api/endpoints/users.ts +++ b/src/api/endpoints/users.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import User from '../models/user'; -import { pack } from '../models/user'; +import User, { pack } from '../models/user'; /** * Lists all users diff --git a/src/api/endpoints/users/get_frequently_replied_users.ts b/src/api/endpoints/users/get_frequently_replied_users.ts index 3cbc761322..87f4f77a5b 100644 --- a/src/api/endpoints/users/get_frequently_replied_users.ts +++ b/src/api/endpoints/users/get_frequently_replied_users.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import Post from '../../models/post'; -import User from '../../models/user'; -import { pack } from '../../models/user'; +import User, { pack } from '../../models/user'; module.exports = (params, me) => new Promise(async (res, rej) => { // Get 'user_id' parameter diff --git a/src/api/endpoints/users/posts.ts b/src/api/endpoints/users/posts.ts index 1f3db3cf79..285e5bc46c 100644 --- a/src/api/endpoints/users/posts.ts +++ b/src/api/endpoints/users/posts.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import Post from '../../models/post'; -import User from '../../models/user'; -import { pack } from '../../models/post'; +import User, { pack } from '../../models/user'; /** * Get posts of a user diff --git a/src/api/endpoints/users/recommendation.ts b/src/api/endpoints/users/recommendation.ts index b80fd63ce7..736233b340 100644 --- a/src/api/endpoints/users/recommendation.ts +++ b/src/api/endpoints/users/recommendation.ts @@ -3,8 +3,7 @@ */ const ms = require('ms'); import $ from 'cafy'; -import User from '../../models/user'; -import { pack } from '../../models/user'; +import User, { pack } from '../../models/user'; import getFriends from '../../common/get-friends'; /** diff --git a/src/api/endpoints/users/search.ts b/src/api/endpoints/users/search.ts index 213038403b..1142db9e9b 100644 --- a/src/api/endpoints/users/search.ts +++ b/src/api/endpoints/users/search.ts @@ -3,8 +3,7 @@ */ import * as mongo from 'mongodb'; import $ from 'cafy'; -import User from '../../models/user'; -import { pack } from '../../models/user'; +import User, { pack } from '../../models/user'; import config from '../../../conf'; const escapeRegexp = require('escape-regexp'); diff --git a/src/api/endpoints/users/search_by_username.ts b/src/api/endpoints/users/search_by_username.ts index 63e206b1f2..9c5e1905aa 100644 --- a/src/api/endpoints/users/search_by_username.ts +++ b/src/api/endpoints/users/search_by_username.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import User from '../../models/user'; -import { pack } from '../../models/user'; +import User, { pack } from '../../models/user'; /** * Search a user by username diff --git a/src/api/endpoints/users/show.ts b/src/api/endpoints/users/show.ts index a51cb619d4..7aea59296a 100644 --- a/src/api/endpoints/users/show.ts +++ b/src/api/endpoints/users/show.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import User from '../../models/user'; -import { pack } from '../../models/user'; +import User, { pack } from '../../models/user'; /** * Show a user diff --git a/src/api/private/signin.ts b/src/api/private/signin.ts index ab6e93562c..b49d25d99a 100644 --- a/src/api/private/signin.ts +++ b/src/api/private/signin.ts @@ -2,8 +2,7 @@ import * as express from 'express'; import * as bcrypt from 'bcryptjs'; import * as speakeasy from 'speakeasy'; import { default as User, IUser } from '../models/user'; -import Signin from '../models/signin'; -import { pack } from '../models/signin'; +import Signin, { pack } from '../models/signin'; import event from '../event'; import signin from '../common/signin'; import config from '../../conf'; diff --git a/src/api/private/signup.ts b/src/api/private/signup.ts index 105fe319a5..392f3b1fc7 100644 --- a/src/api/private/signup.ts +++ b/src/api/private/signup.ts @@ -3,8 +3,7 @@ import * as express from 'express'; import * as bcrypt from 'bcryptjs'; import recaptcha = require('recaptcha-promise'); import { default as User, IUser } from '../models/user'; -import { validateUsername, validatePassword } from '../models/user'; -import { pack } from '../models/user'; +import { validateUsername, validatePassword }, { pack } from '../models/user'; import generateUserToken from '../common/generate-native-user-token'; import config from '../../conf'; diff --git a/src/api/service/twitter.ts b/src/api/service/twitter.ts index ca4f8abcca..7d4964eba6 100644 --- a/src/api/service/twitter.ts +++ b/src/api/service/twitter.ts @@ -5,8 +5,7 @@ import * as uuid from 'uuid'; // const Twitter = require('twitter'); import autwh from 'autwh'; import redis from '../../db/redis'; -import User from '../models/user'; -import { pack } from '../models/user'; +import User, { pack } from '../models/user'; import event from '../event'; import config from '../../conf'; import signin from '../common/signin'; -- cgit v1.2.3-freya From bcd65d290d25219631bb47570478378a698d0fa0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 4 Feb 2018 14:52:33 +0900 Subject: wip --- src/api/endpoints/aggregation/posts/reactions.ts | 11 +++++++---- src/api/endpoints/aggregation/users.ts | 13 ++++++++----- src/api/endpoints/app/create.ts | 3 +-- src/api/endpoints/channels/show.ts | 2 +- src/api/endpoints/drive/files/create.ts | 2 +- src/api/endpoints/drive/files/update.ts | 3 +-- src/api/endpoints/drive/files/upload_from_url.ts | 2 +- src/api/endpoints/drive/folders/create.ts | 3 +-- src/api/endpoints/drive/folders/update.ts | 3 +-- src/api/endpoints/following/create.ts | 7 +++---- src/api/endpoints/following/delete.ts | 5 ++--- src/api/endpoints/i/update.ts | 3 +-- src/api/endpoints/posts/reactions/create.ts | 9 ++++----- src/api/endpoints/users/posts.ts | 4 ++-- src/api/endpoints/users/search.ts | 2 +- src/api/models/app.ts | 1 + src/api/models/drive-file.ts | 1 + src/api/models/post-reaction.ts | 3 +++ src/api/models/post.ts | 4 +++- src/api/models/user.ts | 1 + src/api/private/signup.ts | 3 +-- src/api/service/twitter.ts | 2 +- src/api/stream/home.ts | 4 ++-- 23 files changed, 48 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/api/endpoints/aggregation/posts/reactions.ts b/src/api/endpoints/aggregation/posts/reactions.ts index 2cd4588ae1..790b523be9 100644 --- a/src/api/endpoints/aggregation/posts/reactions.ts +++ b/src/api/endpoints/aggregation/posts/reactions.ts @@ -35,10 +35,13 @@ module.exports = (params) => new Promise(async (res, rej) => { { deleted_at: { $gt: startTime } } ] }, { - _id: false, - post_id: false - }, { - sort: { created_at: -1 } + sort: { + _id: -1 + }, + fields: { + _id: false, + post_id: false + } }); const graph = []; diff --git a/src/api/endpoints/aggregation/users.ts b/src/api/endpoints/aggregation/users.ts index 9eb2d035ec..e38ce92ff9 100644 --- a/src/api/endpoints/aggregation/users.ts +++ b/src/api/endpoints/aggregation/users.ts @@ -17,11 +17,14 @@ module.exports = params => new Promise(async (res, rej) => { const users = await User .find({}, { - _id: false, - created_at: true, - deleted_at: true - }, { - sort: { created_at: -1 } + sort: { + _id: -1 + }, + fields: { + _id: false, + created_at: true, + deleted_at: true + } }); const graph = []; diff --git a/src/api/endpoints/app/create.ts b/src/api/endpoints/app/create.ts index 71633f7def..0f688792a7 100644 --- a/src/api/endpoints/app/create.ts +++ b/src/api/endpoints/app/create.ts @@ -3,8 +3,7 @@ */ import rndstr from 'rndstr'; import $ from 'cafy'; -import App from '../../models/app'; -import { isValidNameId }, { pack } from '../../models/app'; +import App, { isValidNameId, pack } from '../../models/app'; /** * @swagger diff --git a/src/api/endpoints/channels/show.ts b/src/api/endpoints/channels/show.ts index 3238616fa5..332da64675 100644 --- a/src/api/endpoints/channels/show.ts +++ b/src/api/endpoints/channels/show.ts @@ -2,7 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import { default as Channel, IChannel }, { pack } from '../../models/channel'; +import Channel, { IChannel, pack } from '../../models/channel'; /** * Show a channel diff --git a/src/api/endpoints/drive/files/create.ts b/src/api/endpoints/drive/files/create.ts index 7b424f3f5a..96bcace886 100644 --- a/src/api/endpoints/drive/files/create.ts +++ b/src/api/endpoints/drive/files/create.ts @@ -2,7 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import { validateFileName }, { pack } from '../../../models/drive-file'; +import { validateFileName, pack } from '../../../models/drive-file'; import create from '../../../common/add-file-to-drive'; /** diff --git a/src/api/endpoints/drive/files/update.ts b/src/api/endpoints/drive/files/update.ts index ff65a48f71..83da462113 100644 --- a/src/api/endpoints/drive/files/update.ts +++ b/src/api/endpoints/drive/files/update.ts @@ -3,8 +3,7 @@ */ import $ from 'cafy'; import DriveFolder from '../../../models/drive-folder'; -import DriveFile from '../../../models/drive-file'; -import { validateFileName }, { pack } from '../../../models/drive-file'; +import DriveFile, { validateFileName, pack } from '../../../models/drive-file'; import { publishDriveStream } from '../../../event'; /** diff --git a/src/api/endpoints/drive/files/upload_from_url.ts b/src/api/endpoints/drive/files/upload_from_url.ts index 009f06aaaf..68428747ef 100644 --- a/src/api/endpoints/drive/files/upload_from_url.ts +++ b/src/api/endpoints/drive/files/upload_from_url.ts @@ -3,7 +3,7 @@ */ import * as URL from 'url'; import $ from 'cafy'; -import { validateFileName }, { pack } from '../../../models/drive-file'; +import { validateFileName, pack } from '../../../models/drive-file'; import create from '../../../common/add-file-to-drive'; import * as debug from 'debug'; import * as tmp from 'tmp'; diff --git a/src/api/endpoints/drive/folders/create.ts b/src/api/endpoints/drive/folders/create.ts index 6543b11274..03f396ddc9 100644 --- a/src/api/endpoints/drive/folders/create.ts +++ b/src/api/endpoints/drive/folders/create.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFolder from '../../../models/drive-folder'; -import { isValidFolderName }, { pack } from '../../../models/drive-folder'; +import DriveFolder, { isValidFolderName, pack } from '../../../models/drive-folder'; import { publishDriveStream } from '../../../event'; /** diff --git a/src/api/endpoints/drive/folders/update.ts b/src/api/endpoints/drive/folders/update.ts index 2adcadcb08..d3df8bdae5 100644 --- a/src/api/endpoints/drive/folders/update.ts +++ b/src/api/endpoints/drive/folders/update.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import DriveFolder from '../../../models/drive-folder'; -import { isValidFolderName }, { pack } from '../../../models/drive-folder'; +import DriveFolder, { isValidFolderName, pack } from '../../../models/drive-folder'; import { publishDriveStream } from '../../../event'; /** diff --git a/src/api/endpoints/following/create.ts b/src/api/endpoints/following/create.ts index b4a2217b16..8e1aa34713 100644 --- a/src/api/endpoints/following/create.ts +++ b/src/api/endpoints/following/create.ts @@ -2,11 +2,10 @@ * Module dependencies */ import $ from 'cafy'; -import User from '../../models/user'; +import User, { pack as packUser } from '../../models/user'; import Following from '../../models/following'; import notify from '../../common/notify'; import event from '../../event'; -import serializeUser from '../../serializers/user'; /** * Follow a user @@ -77,8 +76,8 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); // Publish follow event - event(follower._id, 'follow', await serializeUser(followee, follower)); - event(followee._id, 'followed', await serializeUser(follower, followee)); + event(follower._id, 'follow', await packUser(followee, follower)); + event(followee._id, 'followed', await packUser(follower, followee)); // Notify notify(followee._id, follower._id, 'follow'); diff --git a/src/api/endpoints/following/delete.ts b/src/api/endpoints/following/delete.ts index aa1639ef6c..b68cec09dd 100644 --- a/src/api/endpoints/following/delete.ts +++ b/src/api/endpoints/following/delete.ts @@ -2,10 +2,9 @@ * Module dependencies */ import $ from 'cafy'; -import User from '../../models/user'; +import User, { pack as packUser } from '../../models/user'; import Following from '../../models/following'; import event from '../../event'; -import serializeUser from '../../serializers/user'; /** * Unfollow a user @@ -78,5 +77,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); // Publish follow event - event(follower._id, 'unfollow', await serializeUser(followee, follower)); + event(follower._id, 'unfollow', await packUser(followee, follower)); }); diff --git a/src/api/endpoints/i/update.ts b/src/api/endpoints/i/update.ts index cd4b1a13f5..7bbbf95900 100644 --- a/src/api/endpoints/i/update.ts +++ b/src/api/endpoints/i/update.ts @@ -2,8 +2,7 @@ * Module dependencies */ import $ from 'cafy'; -import User from '../../models/user'; -import { isValidName, isValidDescription, isValidLocation, isValidBirthday }, { pack } from '../../models/user'; +import User, { isValidName, isValidDescription, isValidLocation, isValidBirthday, pack } from '../../models/user'; import event from '../../event'; import config from '../../../conf'; diff --git a/src/api/endpoints/posts/reactions/create.ts b/src/api/endpoints/posts/reactions/create.ts index d537463dfe..0b0e0e294d 100644 --- a/src/api/endpoints/posts/reactions/create.ts +++ b/src/api/endpoints/posts/reactions/create.ts @@ -3,13 +3,12 @@ */ import $ from 'cafy'; import Reaction from '../../../models/post-reaction'; -import Post from '../../../models/post'; +import Post, { pack as packPost } from '../../../models/post'; +import { pack as packUser } from '../../../models/user'; import Watching from '../../../models/post-watching'; import notify from '../../../common/notify'; import watch from '../../../common/watch-post'; import { publishPostStream, pushSw } from '../../../event'; -import serializePost from '../../../serializers/post'; -import serializeUser from '../../../serializers/user'; /** * React to a post @@ -90,8 +89,8 @@ module.exports = (params, user) => new Promise(async (res, rej) => { }); pushSw(post.user_id, 'reaction', { - user: await serializeUser(user, post.user_id), - post: await serializePost(post, post.user_id), + user: await packUser(user, post.user_id), + post: await packPost(post, post.user_id), reaction: reaction }); diff --git a/src/api/endpoints/users/posts.ts b/src/api/endpoints/users/posts.ts index 285e5bc46c..0c8bceee3d 100644 --- a/src/api/endpoints/users/posts.ts +++ b/src/api/endpoints/users/posts.ts @@ -2,8 +2,8 @@ * Module dependencies */ import $ from 'cafy'; -import Post from '../../models/post'; -import User, { pack } from '../../models/user'; +import Post, { pack } from '../../models/post'; +import User from '../../models/user'; /** * Get posts of a user diff --git a/src/api/endpoints/users/search.ts b/src/api/endpoints/users/search.ts index 1142db9e9b..39e2ff9890 100644 --- a/src/api/endpoints/users/search.ts +++ b/src/api/endpoints/users/search.ts @@ -51,7 +51,7 @@ async function byNative(res, rej, me, query, offset, max) { // Serialize res(await Promise.all(users.map(async user => - await serialize(user, me, { detail: true })))); + await pack(user, me, { detail: true })))); } // Search by Elasticsearch diff --git a/src/api/models/app.ts b/src/api/models/app.ts index fe9d49ff67..34e9867db7 100644 --- a/src/api/models/app.ts +++ b/src/api/models/app.ts @@ -14,6 +14,7 @@ export type IApp = { _id: mongo.ObjectID; created_at: Date; user_id: mongo.ObjectID; + secret: string; }; export function isValidNameId(nameId: string): boolean { diff --git a/src/api/models/drive-file.ts b/src/api/models/drive-file.ts index 9b9df1dac6..2a46d8dc4d 100644 --- a/src/api/models/drive-file.ts +++ b/src/api/models/drive-file.ts @@ -23,6 +23,7 @@ export type IDriveFile = { uploadDate: Date; md5: string; filename: string; + contentType: string; metadata: { properties: any; user_id: mongodb.ObjectID; diff --git a/src/api/models/post-reaction.ts b/src/api/models/post-reaction.ts index 568bfc89a2..639a70e006 100644 --- a/src/api/models/post-reaction.ts +++ b/src/api/models/post-reaction.ts @@ -9,6 +9,9 @@ export default PostReaction; export interface IPostReaction { _id: mongo.ObjectID; + created_at: Date; + deleted_at: Date; + reaction: string; } /** diff --git a/src/api/models/post.ts b/src/api/models/post.ts index ecc5e1a5e4..0bbacebf66 100644 --- a/src/api/models/post.ts +++ b/src/api/models/post.ts @@ -25,10 +25,12 @@ export type IPost = { media_ids: mongo.ObjectID[]; reply_id: mongo.ObjectID; repost_id: mongo.ObjectID; - poll: {}; // todo + poll: any; // todo text: string; user_id: mongo.ObjectID; app_id: mongo.ObjectID; + category: string; + is_category_verified: boolean; }; /** diff --git a/src/api/models/user.ts b/src/api/models/user.ts index 48a45ac2f7..e92f244dd0 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -42,6 +42,7 @@ export function isValidBirthday(birthday: string): boolean { export type IUser = { _id: mongo.ObjectID; created_at: Date; + deleted_at: Date; email: string; followers_count: number; following_count: number; diff --git a/src/api/private/signup.ts b/src/api/private/signup.ts index 392f3b1fc7..8efdb6db47 100644 --- a/src/api/private/signup.ts +++ b/src/api/private/signup.ts @@ -2,8 +2,7 @@ import * as uuid from 'uuid'; import * as express from 'express'; import * as bcrypt from 'bcryptjs'; import recaptcha = require('recaptcha-promise'); -import { default as User, IUser } from '../models/user'; -import { validateUsername, validatePassword }, { pack } from '../models/user'; +import User, { IUser, validateUsername, validatePassword, pack } from '../models/user'; import generateUserToken from '../common/generate-native-user-token'; import config from '../../conf'; diff --git a/src/api/service/twitter.ts b/src/api/service/twitter.ts index 7d4964eba6..adcd5ac49b 100644 --- a/src/api/service/twitter.ts +++ b/src/api/service/twitter.ts @@ -163,7 +163,7 @@ module.exports = (app: express.Application) => { res.send(`Twitter: @${result.screenName} を、Misskey: @${user.username} に接続しました!`); // Publish i updated event - event(user._id, 'i_updated', await serialize(user, user, { + event(user._id, 'i_updated', await pack(user, user, { detail: true, includeSecrets: true })); diff --git a/src/api/stream/home.ts b/src/api/stream/home.ts index 7dcdb5ed73..10078337c3 100644 --- a/src/api/stream/home.ts +++ b/src/api/stream/home.ts @@ -4,7 +4,7 @@ import * as debug from 'debug'; import User from '../models/user'; import Mute from '../models/mute'; -import serializePost from '../serializers/post'; +import { pack as packPost } from '../models/post'; import readNotification from '../common/read-notification'; const log = debug('misskey'); @@ -49,7 +49,7 @@ export default async function(request: websocket.request, connection: websocket. case 'post-stream': const postId = channel.split(':')[2]; log(`RECEIVED: ${postId} ${data} by @${user.username}`); - const post = await serializePost(postId, user, { + const post = await packPost(postId, user, { detail: true }); connection.send(JSON.stringify({ -- cgit v1.2.3-freya From d14a7922b99c4e7f0399acd8000126020d4a3b0f Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 5 Feb 2018 04:29:09 +0900 Subject: wip --- src/web/app/common/tags/url.tag | 54 ----------------------------------- src/web/app/common/tags/url.vue | 63 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 54 deletions(-) delete mode 100644 src/web/app/common/tags/url.tag create mode 100644 src/web/app/common/tags/url.vue (limited to 'src') diff --git a/src/web/app/common/tags/url.tag b/src/web/app/common/tags/url.tag deleted file mode 100644 index 2690afc5da..0000000000 --- a/src/web/app/common/tags/url.tag +++ /dev/null @@ -1,54 +0,0 @@ - - - { schema }// - { hostname } - :{ port } - { pathname } - { query } - { hash } - %fa:external-link-square-alt% - - - - diff --git a/src/web/app/common/tags/url.vue b/src/web/app/common/tags/url.vue new file mode 100644 index 0000000000..fdc8a1cb2a --- /dev/null +++ b/src/web/app/common/tags/url.vue @@ -0,0 +1,63 @@ + + + + + -- cgit v1.2.3-freya From 18e1628e2ab0a5537773c4192ebd5625fce961ff Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 5 Feb 2018 14:25:19 +0900 Subject: wip --- src/web/app/common/tags/time.tag | 50 ------------- src/web/app/common/tags/time.vue | 51 +++++++++++++ src/web/app/common/tags/url-preview.tag | 117 ------------------------------ src/web/app/common/tags/url-preview.vue | 124 ++++++++++++++++++++++++++++++++ 4 files changed, 175 insertions(+), 167 deletions(-) delete mode 100644 src/web/app/common/tags/time.tag create mode 100644 src/web/app/common/tags/time.vue delete mode 100644 src/web/app/common/tags/url-preview.tag create mode 100644 src/web/app/common/tags/url-preview.vue (limited to 'src') diff --git a/src/web/app/common/tags/time.tag b/src/web/app/common/tags/time.tag deleted file mode 100644 index b0d7d24533..0000000000 --- a/src/web/app/common/tags/time.tag +++ /dev/null @@ -1,50 +0,0 @@ - - - - diff --git a/src/web/app/common/tags/time.vue b/src/web/app/common/tags/time.vue new file mode 100644 index 0000000000..14f38eb2db --- /dev/null +++ b/src/web/app/common/tags/time.vue @@ -0,0 +1,51 @@ + + + diff --git a/src/web/app/common/tags/url-preview.tag b/src/web/app/common/tags/url-preview.tag deleted file mode 100644 index 7dbdd8fea2..0000000000 --- a/src/web/app/common/tags/url-preview.tag +++ /dev/null @@ -1,117 +0,0 @@ - - -
-
-
-

{ title }

-
-

{ description }

-
- -

{ sitename }

-
-
-
- - -
diff --git a/src/web/app/common/tags/url-preview.vue b/src/web/app/common/tags/url-preview.vue new file mode 100644 index 0000000000..45a718d3ec --- /dev/null +++ b/src/web/app/common/tags/url-preview.vue @@ -0,0 +1,124 @@ + + + + + -- cgit v1.2.3-freya From 0c2b79acedc08fa0702b52d612aa0b92f67f1573 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Feb 2018 15:16:01 +0900 Subject: wip --- src/web/app/auth/tags/form.tag | 4 +- src/web/app/ch/tags/channel.tag | 14 +- src/web/app/ch/tags/index.tag | 2 +- src/web/app/common/tags/error.tag | 4 +- src/web/app/common/tags/messaging/form.tag | 2 +- src/web/app/common/tags/messaging/index.tag | 4 +- src/web/app/common/tags/messaging/room.tag | 2 +- src/web/app/common/tags/poll-editor.tag | 6 +- src/web/app/common/tags/poll.tag | 4 +- src/web/app/common/tags/post-menu.tag | 6 +- src/web/app/common/tags/reaction-picker.tag | 184 ------------------- src/web/app/common/tags/reaction-picker.vue | 202 +++++++++++++++++++++ src/web/app/common/tags/signin-history.tag | 2 +- src/web/app/common/tags/signup.tag | 2 +- src/web/app/common/tags/stream-indicator.tag | 78 -------- src/web/app/common/tags/stream-indicator.vue | 74 ++++++++ src/web/app/common/tags/twitter-setting.tag | 4 +- .../app/desktop/tags/autocomplete-suggestion.tag | 2 +- src/web/app/desktop/tags/big-follow-button.tag | 2 +- src/web/app/desktop/tags/crop-window.tag | 6 +- src/web/app/desktop/tags/detailed-post-window.tag | 2 +- src/web/app/desktop/tags/dialog.tag | 4 +- src/web/app/desktop/tags/donation.tag | 2 +- .../app/desktop/tags/drive/base-contextmenu.tag | 6 +- src/web/app/desktop/tags/drive/browser.tag | 2 +- .../app/desktop/tags/drive/file-contextmenu.tag | 14 +- src/web/app/desktop/tags/drive/file.tag | 2 +- .../app/desktop/tags/drive/folder-contextmenu.tag | 8 +- src/web/app/desktop/tags/drive/folder.tag | 2 +- src/web/app/desktop/tags/drive/nav-folder.tag | 2 +- src/web/app/desktop/tags/follow-button.tag | 2 +- src/web/app/desktop/tags/following-setuper.tag | 4 +- .../app/desktop/tags/home-widgets/broadcast.tag | 2 +- src/web/app/desktop/tags/home-widgets/channel.tag | 4 +- src/web/app/desktop/tags/home-widgets/mentions.tag | 2 +- .../desktop/tags/home-widgets/notifications.tag | 2 +- .../app/desktop/tags/home-widgets/post-form.tag | 2 +- src/web/app/desktop/tags/home-widgets/profile.tag | 4 +- .../tags/home-widgets/recommended-polls.tag | 2 +- .../app/desktop/tags/home-widgets/rss-reader.tag | 2 +- src/web/app/desktop/tags/home-widgets/server.tag | 2 +- .../app/desktop/tags/home-widgets/slideshow.tag | 4 +- src/web/app/desktop/tags/home-widgets/trends.tag | 2 +- .../tags/home-widgets/user-recommendation.tag | 2 +- src/web/app/desktop/tags/home.tag | 2 +- src/web/app/desktop/tags/images.tag | 4 +- src/web/app/desktop/tags/input-dialog.tag | 4 +- src/web/app/desktop/tags/notifications.tag | 2 +- src/web/app/desktop/tags/pages/entrance.tag | 6 +- src/web/app/desktop/tags/pages/selectdrive.tag | 6 +- src/web/app/desktop/tags/post-detail.tag | 10 +- src/web/app/desktop/tags/post-form.tag | 12 +- src/web/app/desktop/tags/repost-form.tag | 6 +- .../desktop/tags/select-file-from-drive-window.tag | 6 +- .../tags/select-folder-from-drive-window.tag | 4 +- src/web/app/desktop/tags/set-avatar-suggestion.tag | 4 +- src/web/app/desktop/tags/set-banner-suggestion.tag | 4 +- src/web/app/desktop/tags/settings.tag | 14 +- src/web/app/desktop/tags/timeline.tag | 10 +- src/web/app/desktop/tags/ui.tag | 14 +- src/web/app/desktop/tags/user-timeline.tag | 2 +- src/web/app/desktop/tags/user.tag | 10 +- src/web/app/desktop/tags/users-list.tag | 6 +- src/web/app/desktop/tags/widgets/activity.tag | 2 +- src/web/app/desktop/tags/widgets/calendar.tag | 6 +- src/web/app/desktop/tags/window.tag | 6 +- src/web/app/dev/tags/new-app-form.tag | 2 +- src/web/app/mobile/tags/drive-folder-selector.tag | 4 +- src/web/app/mobile/tags/drive-selector.tag | 4 +- src/web/app/mobile/tags/drive.tag | 6 +- src/web/app/mobile/tags/drive/file-viewer.tag | 6 +- src/web/app/mobile/tags/drive/file.tag | 2 +- src/web/app/mobile/tags/drive/folder.tag | 2 +- src/web/app/mobile/tags/follow-button.tag | 2 +- src/web/app/mobile/tags/init-following.tag | 4 +- src/web/app/mobile/tags/notifications.tag | 2 +- src/web/app/mobile/tags/page/entrance.tag | 2 +- src/web/app/mobile/tags/page/entrance/signin.tag | 2 +- src/web/app/mobile/tags/page/entrance/signup.tag | 2 +- src/web/app/mobile/tags/page/selectdrive.tag | 4 +- src/web/app/mobile/tags/page/settings.tag | 2 +- src/web/app/mobile/tags/page/settings/profile.tag | 10 +- src/web/app/mobile/tags/post-detail.tag | 10 +- src/web/app/mobile/tags/post-form.tag | 14 +- src/web/app/mobile/tags/timeline.tag | 10 +- src/web/app/mobile/tags/ui.tag | 8 +- src/web/app/mobile/tags/user.tag | 6 +- src/web/app/mobile/tags/users-list.tag | 6 +- 88 files changed, 474 insertions(+), 460 deletions(-) delete mode 100644 src/web/app/common/tags/reaction-picker.tag create mode 100644 src/web/app/common/tags/reaction-picker.vue delete mode 100644 src/web/app/common/tags/stream-indicator.tag create mode 100644 src/web/app/common/tags/stream-indicator.vue (limited to 'src') diff --git a/src/web/app/auth/tags/form.tag b/src/web/app/auth/tags/form.tag index 4a236f7594..5bb27c269e 100644 --- a/src/web/app/auth/tags/form.tag +++ b/src/web/app/auth/tags/form.tag @@ -26,8 +26,8 @@
- - + +
- - diff --git a/src/web/app/common/tags/reaction-picker.vue b/src/web/app/common/tags/reaction-picker.vue new file mode 100644 index 0000000000..2430390301 --- /dev/null +++ b/src/web/app/common/tags/reaction-picker.vue @@ -0,0 +1,202 @@ + + + + + + + + + diff --git a/src/web/app/common/tags/signin-history.tag b/src/web/app/common/tags/signin-history.tag index cdd58c4c67..10729789c6 100644 --- a/src/web/app/common/tags/signin-history.tag +++ b/src/web/app/common/tags/signin-history.tag @@ -42,7 +42,7 @@ -
+
%fa:check% %fa:times% { rec.ip } diff --git a/src/web/app/common/tags/signup.tag b/src/web/app/common/tags/signup.tag index b488efb927..d0bd769074 100644 --- a/src/web/app/common/tags/signup.tag +++ b/src/web/app/common/tags/signup.tag @@ -36,7 +36,7 @@

利用規約に同意する

- + - - diff --git a/src/web/app/common/tags/stream-indicator.vue b/src/web/app/common/tags/stream-indicator.vue new file mode 100644 index 0000000000..619237193a --- /dev/null +++ b/src/web/app/common/tags/stream-indicator.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/src/web/app/common/tags/twitter-setting.tag b/src/web/app/common/tags/twitter-setting.tag index 4d57cfa55a..8419f8b62a 100644 --- a/src/web/app/common/tags/twitter-setting.tag +++ b/src/web/app/common/tags/twitter-setting.tag @@ -2,9 +2,9 @@

%i18n:common.tags.mk-twitter-setting.description%%i18n:common.tags.mk-twitter-setting.detail%

- { I.twitter ? '%i18n:common.tags.mk-twitter-setting.reconnect%' : '%i18n:common.tags.mk-twitter-setting.connect%' } + { I.twitter ? '%i18n:common.tags.mk-twitter-setting.reconnect%' : '%i18n:common.tags.mk-twitter-setting.connect%' } or - %i18n:common.tags.mk-twitter-setting.disconnect% + %i18n:common.tags.mk-twitter-setting.disconnect%

Twitter ID: { I.twitter.user_id }

diff --git a/src/web/app/desktop/tags/repost-form-window.tag b/src/web/app/desktop/tags/repost-form-window.tag index dbc3f5a3c5..939ff4e383 100644 --- a/src/web/app/desktop/tags/repost-form-window.tag +++ b/src/web/app/desktop/tags/repost-form-window.tag @@ -19,23 +19,23 @@ this.onDocumentKeydown = e => { if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') { if (e.which == 27) { // Esc - this.refs.window.close(); + this.$refs.window.close(); } } }; this.on('mount', () => { - this.refs.window.refs.form.on('cancel', () => { - this.refs.window.close(); + this.$refs.window.refs.form.on('cancel', () => { + this.$refs.window.close(); }); - this.refs.window.refs.form.on('posted', () => { - this.refs.window.close(); + this.$refs.window.refs.form.on('posted', () => { + this.$refs.window.close(); }); document.addEventListener('keydown', this.onDocumentKeydown); - this.refs.window.on('closed', () => { + this.$refs.window.on('closed', () => { this.unmount(); }); }); diff --git a/src/web/app/desktop/tags/repost-form.tag b/src/web/app/desktop/tags/repost-form.tag index 946871765b..b2ebbf4c46 100644 --- a/src/web/app/desktop/tags/repost-form.tag +++ b/src/web/app/desktop/tags/repost-form.tag @@ -117,11 +117,11 @@ quote: true }); - this.refs.form.on('post', () => { + this.$refs.form.on('post', () => { this.trigger('posted'); }); - this.refs.form.focus(); + this.$refs.form.focus(); }; diff --git a/src/web/app/desktop/tags/search-posts.tag b/src/web/app/desktop/tags/search-posts.tag index f7ec85a4fe..0c8dbcbf63 100644 --- a/src/web/app/desktop/tags/search-posts.tag +++ b/src/web/app/desktop/tags/search-posts.tag @@ -53,7 +53,7 @@ isLoading: false, isEmpty: posts.length == 0 }); - this.refs.timeline.setPosts(posts); + this.$refs.timeline.setPosts(posts); this.trigger('loaded'); }); }); @@ -66,7 +66,7 @@ this.onDocumentKeydown = e => { if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') { if (e.which == 84) { // t - this.refs.timeline.focus(); + this.$refs.timeline.focus(); } } }; @@ -84,7 +84,7 @@ this.update({ moreLoading: false }); - this.refs.timeline.prependPosts(posts); + this.$refs.timeline.prependPosts(posts); }); }; diff --git a/src/web/app/desktop/tags/search.tag b/src/web/app/desktop/tags/search.tag index d5159fe4e9..e29a2b2737 100644 --- a/src/web/app/desktop/tags/search.tag +++ b/src/web/app/desktop/tags/search.tag @@ -26,7 +26,7 @@ this.query = this.opts.query; this.on('mount', () => { - this.refs.posts.on('loaded', () => { + this.$refs.posts.on('loaded', () => { this.trigger('loaded'); }); }); diff --git a/src/web/app/desktop/tags/select-file-from-drive-window.tag b/src/web/app/desktop/tags/select-file-from-drive-window.tag index 6225145589..6d1e59413d 100644 --- a/src/web/app/desktop/tags/select-file-from-drive-window.tag +++ b/src/web/app/desktop/tags/select-file-from-drive-window.tag @@ -141,33 +141,33 @@ this.title = this.opts.title || '%fa:R file%ファイルを選択'; this.on('mount', () => { - this.refs.window.refs.browser.on('selected', file => { + this.$refs.window.refs.browser.on('selected', file => { this.files = [file]; this.ok(); }); - this.refs.window.refs.browser.on('change-selection', files => { + this.$refs.window.refs.browser.on('change-selection', files => { this.update({ files: files }); }); - this.refs.window.on('closed', () => { + this.$refs.window.on('closed', () => { this.unmount(); }); }); this.close = () => { - this.refs.window.close(); + this.$refs.window.close(); }; this.upload = () => { - this.refs.window.refs.browser.selectLocalFile(); + this.$refs.window.refs.browser.selectLocalFile(); }; this.ok = () => { this.trigger('selected', this.multiple ? this.files : this.files[0]); - this.refs.window.close(); + this.$refs.window.close(); }; diff --git a/src/web/app/desktop/tags/select-folder-from-drive-window.tag b/src/web/app/desktop/tags/select-folder-from-drive-window.tag index 45700420cc..7bfe5af357 100644 --- a/src/web/app/desktop/tags/select-folder-from-drive-window.tag +++ b/src/web/app/desktop/tags/select-folder-from-drive-window.tag @@ -95,18 +95,18 @@ this.title = this.opts.title || '%fa:R folder%フォルダを選択'; this.on('mount', () => { - this.refs.window.on('closed', () => { + this.$refs.window.on('closed', () => { this.unmount(); }); }); this.close = () => { - this.refs.window.close(); + this.$refs.window.close(); }; this.ok = () => { - this.trigger('selected', this.refs.window.refs.browser.folder); - this.refs.window.close(); + this.trigger('selected', this.$refs.window.refs.browser.folder); + this.$refs.window.close(); }; diff --git a/src/web/app/desktop/tags/settings-window.tag b/src/web/app/desktop/tags/settings-window.tag index 5a725af51e..e68a44a4f6 100644 --- a/src/web/app/desktop/tags/settings-window.tag +++ b/src/web/app/desktop/tags/settings-window.tag @@ -18,13 +18,13 @@ diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag index efc5da83f1..084bde0095 100644 --- a/src/web/app/desktop/tags/settings.tag +++ b/src/web/app/desktop/tags/settings.tag @@ -179,10 +179,10 @@ this.updateAccount = () => { this.api('i/update', { - name: this.refs.accountName.value, - location: this.refs.accountLocation.value || null, - description: this.refs.accountDescription.value || null, - birthday: this.refs.accountBirthday.value || null + name: this.$refs.accountName.value, + location: this.$refs.accountLocation.value || null, + description: this.$refs.accountDescription.value || null, + birthday: this.$refs.accountBirthday.value || null }).then(() => { notify('プロフィールを更新しました'); }); @@ -320,7 +320,7 @@ this.submit = () => { this.api('i/2fa/done', { - token: this.refs.token.value + token: this.$refs.token.value }).then(() => { notify('%i18n:desktop.tags.mk-2fa-setting.success%'); this.I.two_factor_enabled = true; diff --git a/src/web/app/desktop/tags/sub-post-content.tag b/src/web/app/desktop/tags/sub-post-content.tag index 1a81b545b6..01e1fdb31e 100644 --- a/src/web/app/desktop/tags/sub-post-content.tag +++ b/src/web/app/desktop/tags/sub-post-content.tag @@ -43,9 +43,9 @@ this.on('mount', () => { if (this.post.text) { const tokens = this.post.ast; - this.refs.text.innerHTML = compile(tokens, false); + this.$refs.text.innerHTML = compile(tokens, false); - Array.from(this.refs.text.children).forEach(e => { + Array.from(this.$refs.text.children).forEach(e => { if (e.tagName == 'MK-URL') riot.mount(e); }); } diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag index 0616a95f99..115b22c862 100644 --- a/src/web/app/desktop/tags/timeline.tag +++ b/src/web/app/desktop/tags/timeline.tag @@ -437,10 +437,10 @@ this.refresh = post => { this.set(post); this.update(); - if (this.refs.reactionsViewer) this.refs.reactionsViewer.update({ + if (this.$refs.reactionsViewer) this.$refs.reactionsViewer.update({ post }); - if (this.refs.pollViewer) this.refs.pollViewer.init(post); + if (this.$refs.pollViewer) this.$refs.pollViewer.init(post); }; this.onStreamPostUpdated = data => { @@ -484,9 +484,9 @@ if (this.p.text) { const tokens = this.p.ast; - this.refs.text.innerHTML = this.refs.text.innerHTML.replace('

', compile(tokens)); + this.$refs.text.innerHTML = this.$refs.text.innerHTML.replace('

', compile(tokens)); - Array.from(this.refs.text.children).forEach(e => { + Array.from(this.$refs.text.children).forEach(e => { if (e.tagName == 'MK-URL') riot.mount(e); }); @@ -494,7 +494,7 @@ tokens .filter(t => (t.type == 'url' || t.type == 'link') && !t.silent) .map(t => { - riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), { + riot.mount(this.$refs.text.appendChild(document.createElement('mk-url-preview')), { url: t.url }); }); @@ -521,14 +521,14 @@ this.react = () => { riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), { - source: this.refs.reactButton, + source: this.$refs.reactButton, post: this.p }); }; this.menu = () => { riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), { - source: this.refs.menuButton, + source: this.$refs.menuButton, post: this.p }); }; diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag index 3e7b5c2eca..777624d7ba 100644 --- a/src/web/app/desktop/tags/ui.tag +++ b/src/web/app/desktop/tags/ui.tag @@ -180,7 +180,7 @@ this.onsubmit = e => { e.preventDefault(); - this.page('/search?q=' + encodeURIComponent(this.refs.q.value)); + this.page('/search?q=' + encodeURIComponent(this.$refs.q.value)); }; diff --git a/src/web/app/desktop/tags/user-timeline.tag b/src/web/app/desktop/tags/user-timeline.tag index 19ee2f3284..0bfad05c27 100644 --- a/src/web/app/desktop/tags/user-timeline.tag +++ b/src/web/app/desktop/tags/user-timeline.tag @@ -88,7 +88,7 @@ this.onDocumentKeydown = e => { if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') { if (e.which == 84) { // [t] - this.refs.timeline.focus(); + this.$refs.timeline.focus(); } } }; @@ -103,25 +103,25 @@ isLoading: false, isEmpty: posts.length == 0 }); - this.refs.timeline.setPosts(posts); + this.$refs.timeline.setPosts(posts); if (cb) cb(); }); }; this.more = () => { - if (this.moreLoading || this.isLoading || this.refs.timeline.posts.length == 0) return; + if (this.moreLoading || this.isLoading || this.$refs.timeline.posts.length == 0) return; this.update({ moreLoading: true }); this.api('users/posts', { user_id: this.user.id, with_replies: this.mode == 'with-replies', - until_id: this.refs.timeline.tail().id + until_id: this.$refs.timeline.tail().id }).then(posts => { this.update({ moreLoading: false }); - this.refs.timeline.prependPosts(posts); + this.$refs.timeline.prependPosts(posts); }); }; diff --git a/src/web/app/desktop/tags/user.tag b/src/web/app/desktop/tags/user.tag index 5dc4175cf9..8eca3caaa3 100644 --- a/src/web/app/desktop/tags/user.tag +++ b/src/web/app/desktop/tags/user.tag @@ -206,10 +206,10 @@ const z = 1.25; // 奥行き(小さいほど奥) const pos = -(top / z); - this.refs.banner.style.backgroundPosition = `center calc(50% - ${pos}px)`; + this.$refs.banner.style.backgroundPosition = `center calc(50% - ${pos}px)`; const blur = top / 32 - if (blur <= 10) this.refs.banner.style.filter = `blur(${blur}px)`; + if (blur <= 10) this.$refs.banner.style.filter = `blur(${blur}px)`; }; this.onUpdateBanner = () => { @@ -715,12 +715,12 @@ this.user = this.opts.user; this.on('mount', () => { - this.refs.tl.on('loaded', () => { + this.$refs.tl.on('loaded', () => { this.trigger('loaded'); }); - this.scrollFollowerLeft = new ScrollFollower(this.refs.left, this.parent.root.getBoundingClientRect().top); - this.scrollFollowerRight = new ScrollFollower(this.refs.right, this.parent.root.getBoundingClientRect().top); + this.scrollFollowerLeft = new ScrollFollower(this.$refs.left, this.parent.root.getBoundingClientRect().top); + this.scrollFollowerRight = new ScrollFollower(this.$refs.right, this.parent.root.getBoundingClientRect().top); }); this.on('unmount', () => { @@ -729,7 +729,7 @@ }); this.warp = date => { - this.refs.tl.warp(date); + this.$refs.tl.warp(date); }; diff --git a/src/web/app/desktop/tags/window.tag b/src/web/app/desktop/tags/window.tag index ebc7382d5a..31830d9078 100644 --- a/src/web/app/desktop/tags/window.tag +++ b/src/web/app/desktop/tags/window.tag @@ -199,13 +199,13 @@ this.canResize = !this.isFlexible; this.on('mount', () => { - this.refs.main.style.width = this.opts.width || '530px'; - this.refs.main.style.height = this.opts.height || 'auto'; + this.$refs.main.style.width = this.opts.width || '530px'; + this.$refs.main.style.height = this.opts.height || 'auto'; - this.refs.main.style.top = '15%'; - this.refs.main.style.left = (window.innerWidth / 2) - (this.refs.main.offsetWidth / 2) + 'px'; + this.$refs.main.style.top = '15%'; + this.$refs.main.style.left = (window.innerWidth / 2) - (this.$refs.main.offsetWidth / 2) + 'px'; - this.refs.header.addEventListener('contextmenu', e => { + this.$refs.header.addEventListener('contextmenu', e => { e.preventDefault(); }); @@ -219,15 +219,15 @@ }); this.onBrowserResize = () => { - const position = this.refs.main.getBoundingClientRect(); + const position = this.$refs.main.getBoundingClientRect(); const browserWidth = window.innerWidth; const browserHeight = window.innerHeight; - const windowWidth = this.refs.main.offsetWidth; - const windowHeight = this.refs.main.offsetHeight; - if (position.left < 0) this.refs.main.style.left = 0; - if (position.top < 0) this.refs.main.style.top = 0; - if (position.left + windowWidth > browserWidth) this.refs.main.style.left = browserWidth - windowWidth + 'px'; - if (position.top + windowHeight > browserHeight) this.refs.main.style.top = browserHeight - windowHeight + 'px'; + const windowWidth = this.$refs.main.offsetWidth; + const windowHeight = this.$refs.main.offsetHeight; + if (position.left < 0) this.$refs.main.style.left = 0; + if (position.top < 0) this.$refs.main.style.top = 0; + if (position.left + windowWidth > browserWidth) this.$refs.main.style.left = browserWidth - windowWidth + 'px'; + if (position.top + windowHeight > browserHeight) this.$refs.main.style.top = browserHeight - windowHeight + 'px'; }; this.open = () => { @@ -236,25 +236,25 @@ this.top(); if (this.isModal) { - this.refs.bg.style.pointerEvents = 'auto'; + this.$refs.bg.style.pointerEvents = 'auto'; anime({ - targets: this.refs.bg, + targets: this.$refs.bg, opacity: 1, duration: 100, easing: 'linear' }); } - this.refs.main.style.pointerEvents = 'auto'; + this.$refs.main.style.pointerEvents = 'auto'; anime({ - targets: this.refs.main, + targets: this.$refs.main, opacity: 1, scale: [1.1, 1], duration: 200, easing: 'easeOutQuad' }); - //this.refs.main.focus(); + //this.$refs.main.focus(); setTimeout(() => { this.trigger('opened'); @@ -262,10 +262,10 @@ }; this.popout = () => { - const position = this.refs.main.getBoundingClientRect(); + const position = this.$refs.main.getBoundingClientRect(); - const width = parseInt(getComputedStyle(this.refs.main, '').width, 10); - const height = parseInt(getComputedStyle(this.refs.main, '').height, 10); + const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10); + const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10); const x = window.screenX + position.left; const y = window.screenY + position.top; @@ -281,19 +281,19 @@ this.trigger('closing'); if (this.isModal) { - this.refs.bg.style.pointerEvents = 'none'; + this.$refs.bg.style.pointerEvents = 'none'; anime({ - targets: this.refs.bg, + targets: this.$refs.bg, opacity: 0, duration: 300, easing: 'linear' }); } - this.refs.main.style.pointerEvents = 'none'; + this.$refs.main.style.pointerEvents = 'none'; anime({ - targets: this.refs.main, + targets: this.$refs.main, opacity: 0, scale: 0.8, duration: 300, @@ -318,8 +318,8 @@ }); if (z > 0) { - this.refs.main.style.zIndex = z + 1; - if (this.isModal) this.refs.bg.style.zIndex = z + 1; + this.$refs.main.style.zIndex = z + 1; + if (this.isModal) this.$refs.bg.style.zIndex = z + 1; } }; @@ -340,9 +340,9 @@ this.onHeaderMousedown = e => { e.preventDefault(); - if (!contains(this.refs.main, document.activeElement)) this.refs.main.focus(); + if (!contains(this.$refs.main, document.activeElement)) this.$refs.main.focus(); - const position = this.refs.main.getBoundingClientRect(); + const position = this.$refs.main.getBoundingClientRect(); const clickX = e.clientX; const clickY = e.clientY; @@ -350,8 +350,8 @@ const moveBaseY = clickY - position.top; const browserWidth = window.innerWidth; const browserHeight = window.innerHeight; - const windowWidth = this.refs.main.offsetWidth; - const windowHeight = this.refs.main.offsetHeight; + const windowWidth = this.$refs.main.offsetWidth; + const windowHeight = this.$refs.main.offsetHeight; // 動かした時 dragListen(me => { @@ -370,8 +370,8 @@ // 右はみ出し if (moveLeft + windowWidth > browserWidth) moveLeft = browserWidth - windowWidth; - this.refs.main.style.left = moveLeft + 'px'; - this.refs.main.style.top = moveTop + 'px'; + this.$refs.main.style.left = moveLeft + 'px'; + this.$refs.main.style.top = moveTop + 'px'; }); }; @@ -380,8 +380,8 @@ e.preventDefault(); const base = e.clientY; - const height = parseInt(getComputedStyle(this.refs.main, '').height, 10); - const top = parseInt(getComputedStyle(this.refs.main, '').top, 10); + const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10); + const top = parseInt(getComputedStyle(this.$refs.main, '').top, 10); // 動かした時 dragListen(me => { @@ -406,8 +406,8 @@ e.preventDefault(); const base = e.clientX; - const width = parseInt(getComputedStyle(this.refs.main, '').width, 10); - const left = parseInt(getComputedStyle(this.refs.main, '').left, 10); + const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10); + const left = parseInt(getComputedStyle(this.$refs.main, '').left, 10); const browserWidth = window.innerWidth; // 動かした時 @@ -430,8 +430,8 @@ e.preventDefault(); const base = e.clientY; - const height = parseInt(getComputedStyle(this.refs.main, '').height, 10); - const top = parseInt(getComputedStyle(this.refs.main, '').top, 10); + const height = parseInt(getComputedStyle(this.$refs.main, '').height, 10); + const top = parseInt(getComputedStyle(this.$refs.main, '').top, 10); const browserHeight = window.innerHeight; // 動かした時 @@ -454,8 +454,8 @@ e.preventDefault(); const base = e.clientX; - const width = parseInt(getComputedStyle(this.refs.main, '').width, 10); - const left = parseInt(getComputedStyle(this.refs.main, '').left, 10); + const width = parseInt(getComputedStyle(this.$refs.main, '').width, 10); + const left = parseInt(getComputedStyle(this.$refs.main, '').left, 10); // 動かした時 dragListen(me => { @@ -501,22 +501,22 @@ // 高さを適用 this.applyTransformHeight = height => { - this.refs.main.style.height = height + 'px'; + this.$refs.main.style.height = height + 'px'; }; // 幅を適用 this.applyTransformWidth = width => { - this.refs.main.style.width = width + 'px'; + this.$refs.main.style.width = width + 'px'; }; // Y座標を適用 this.applyTransformTop = top => { - this.refs.main.style.top = top + 'px'; + this.$refs.main.style.top = top + 'px'; }; // X座標を適用 this.applyTransformLeft = left => { - this.refs.main.style.left = left + 'px'; + this.$refs.main.style.left = left + 'px'; }; function dragListen(fn) { diff --git a/src/web/app/dev/tags/new-app-form.tag b/src/web/app/dev/tags/new-app-form.tag index c9518d8deb..aba6b1524f 100644 --- a/src/web/app/dev/tags/new-app-form.tag +++ b/src/web/app/dev/tags/new-app-form.tag @@ -183,7 +183,7 @@ this.nidState = null; this.onChangeNid = () => { - const nid = this.refs.nid.value; + const nid = this.$refs.nid.value; if (nid == '') { this.update({ @@ -223,13 +223,13 @@ }; this.onsubmit = () => { - const name = this.refs.name.value; - const nid = this.refs.nid.value; - const description = this.refs.description.value; - const cb = this.refs.cb.value; + const name = this.$refs.name.value; + const nid = this.$refs.nid.value; + const description = this.$refs.description.value; + const cb = this.$refs.cb.value; const permission = []; - this.refs.permission.querySelectorAll('input').forEach(el => { + this.$refs.permission.querySelectorAll('input').forEach(el => { if (el.checked) permission.push(el.value); }); diff --git a/src/web/app/mobile/tags/drive-folder-selector.tag b/src/web/app/mobile/tags/drive-folder-selector.tag index 82e22fed29..37d571d731 100644 --- a/src/web/app/mobile/tags/drive-folder-selector.tag +++ b/src/web/app/mobile/tags/drive-folder-selector.tag @@ -62,7 +62,7 @@ }; this.ok = () => { - this.trigger('selected', this.refs.browser.folder); + this.trigger('selected', this.$refs.browser.folder); this.unmount(); }; diff --git a/src/web/app/mobile/tags/drive-selector.tag b/src/web/app/mobile/tags/drive-selector.tag index 36fed8c327..ab67cc80c0 100644 --- a/src/web/app/mobile/tags/drive-selector.tag +++ b/src/web/app/mobile/tags/drive-selector.tag @@ -63,13 +63,13 @@ this.files = []; this.on('mount', () => { - this.refs.browser.on('change-selection', files => { + this.$refs.browser.on('change-selection', files => { this.update({ files: files }); }); - this.refs.browser.on('selected', file => { + this.$refs.browser.on('selected', file => { this.trigger('selected', file); this.unmount(); }); diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag index d3ca1aff90..3d0396692d 100644 --- a/src/web/app/mobile/tags/drive.tag +++ b/src/web/app/mobile/tags/drive.tag @@ -209,7 +209,7 @@ } if (this.opts.isNaked) { - this.refs.nav.style.top = `${this.opts.top}px`; + this.$refs.nav.style.top = `${this.opts.top}px`; } }); @@ -517,7 +517,7 @@ }; this.selectLocalFile = () => { - this.refs.file.click(); + this.$refs.file.click(); }; this.createFolder = () => { @@ -574,7 +574,7 @@ }; this.changeLocalFile = () => { - Array.from(this.refs.file.files).forEach(f => this.refs.uploader.upload(f, this.folder)); + Array.from(this.$refs.file.files).forEach(f => this.$refs.uploader.upload(f, this.folder)); }; diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag index 2d9338fd35..82fbb6609e 100644 --- a/src/web/app/mobile/tags/drive/file-viewer.tag +++ b/src/web/app/mobile/tags/drive/file-viewer.tag @@ -243,7 +243,7 @@ this.onImageLoaded = () => { const self = this; - EXIF.getData(this.refs.img, function() { + EXIF.getData(this.$refs.img, function() { const allMetaData = EXIF.getAllTags(this); self.update({ exif: allMetaData diff --git a/src/web/app/mobile/tags/home-timeline.tag b/src/web/app/mobile/tags/home-timeline.tag index 397d2b3980..aa3818007b 100644 --- a/src/web/app/mobile/tags/home-timeline.tag +++ b/src/web/app/mobile/tags/home-timeline.tag @@ -28,7 +28,7 @@ this.fetch = () => { this.api('posts/timeline').then(posts => { - this.refs.timeline.setPosts(posts); + this.$refs.timeline.setPosts(posts); }); }; @@ -47,7 +47,7 @@ this.more = () => { return this.api('posts/timeline', { - until_id: this.refs.timeline.tail().id + until_id: this.$refs.timeline.tail().id }); }; @@ -55,7 +55,7 @@ this.update({ isEmpty: false }); - this.refs.timeline.addPost(post); + this.$refs.timeline.addPost(post); }; this.onStreamFollow = () => { diff --git a/src/web/app/mobile/tags/home.tag b/src/web/app/mobile/tags/home.tag index d92e3ae4e5..2c07c286d2 100644 --- a/src/web/app/mobile/tags/home.tag +++ b/src/web/app/mobile/tags/home.tag @@ -15,7 +15,7 @@ diff --git a/src/web/app/mobile/tags/search.tag b/src/web/app/mobile/tags/search.tag index 2d299e0a77..15a861d7a5 100644 --- a/src/web/app/mobile/tags/search.tag +++ b/src/web/app/mobile/tags/search.tag @@ -8,7 +8,7 @@ this.query = this.opts.query; this.on('mount', () => { - this.refs.posts.on('loaded', () => { + this.$refs.posts.on('loaded', () => { this.trigger('loaded'); }); }); diff --git a/src/web/app/mobile/tags/sub-post-content.tag b/src/web/app/mobile/tags/sub-post-content.tag index adeb84dea0..7192cd0130 100644 --- a/src/web/app/mobile/tags/sub-post-content.tag +++ b/src/web/app/mobile/tags/sub-post-content.tag @@ -35,9 +35,9 @@ this.on('mount', () => { if (this.post.text) { const tokens = this.post.ast; - this.refs.text.innerHTML = compile(tokens, false); + this.$refs.text.innerHTML = compile(tokens, false); - Array.from(this.refs.text.children).forEach(e => { + Array.from(this.$refs.text.children).forEach(e => { if (e.tagName == 'MK-URL') riot.mount(e); }); } diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag index 400fa5d85f..66f58ff0af 100644 --- a/src/web/app/mobile/tags/timeline.tag +++ b/src/web/app/mobile/tags/timeline.tag @@ -482,10 +482,10 @@ this.refresh = post => { this.set(post); this.update(); - if (this.refs.reactionsViewer) this.refs.reactionsViewer.update({ + if (this.$refs.reactionsViewer) this.$refs.reactionsViewer.update({ post }); - if (this.refs.pollViewer) this.refs.pollViewer.init(post); + if (this.$refs.pollViewer) this.$refs.pollViewer.init(post); }; this.onStreamPostUpdated = data => { @@ -529,9 +529,9 @@ if (this.p.text) { const tokens = this.p.ast; - this.refs.text.innerHTML = this.refs.text.innerHTML.replace('

', compile(tokens)); + this.$refs.text.innerHTML = this.$refs.text.innerHTML.replace('

', compile(tokens)); - Array.from(this.refs.text.children).forEach(e => { + Array.from(this.$refs.text.children).forEach(e => { if (e.tagName == 'MK-URL') riot.mount(e); }); @@ -539,7 +539,7 @@ tokens .filter(t => (t.type == 'url' || t.type == 'link') && !t.silent) .map(t => { - riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), { + riot.mount(this.$refs.text.appendChild(document.createElement('mk-url-preview')), { url: t.url }); }); @@ -569,7 +569,7 @@ this.react = () => { riot.mount(document.body.appendChild(document.createElement('mk-reaction-picker')), { - source: this.refs.reactButton, + source: this.$refs.reactButton, post: this.p, compact: true }); @@ -577,7 +577,7 @@ this.menu = () => { riot.mount(document.body.appendChild(document.createElement('mk-post-menu')), { - source: this.refs.menuButton, + source: this.$refs.menuButton, post: this.p, compact: true }); diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag index b03534f925..c5dc4b2e4e 100644 --- a/src/web/app/mobile/tags/ui.tag +++ b/src/web/app/mobile/tags/ui.tag @@ -30,7 +30,7 @@ this.toggleDrawer = () => { this.isDrawerOpening = !this.isDrawerOpening; - this.refs.nav.root.style.display = this.isDrawerOpening ? 'block' : 'none'; + this.$refs.nav.root.style.display = this.isDrawerOpening ? 'block' : 'none'; }; this.onStreamNotification = notification => { @@ -209,7 +209,7 @@ }; this.setTitle = title => { - this.refs.title.innerHTML = title; + this.$refs.title.innerHTML = title; }; this.setFunc = (fn, icon) => { diff --git a/src/web/app/mobile/tags/user-followers.tag b/src/web/app/mobile/tags/user-followers.tag index b710e376c6..c4cdedba81 100644 --- a/src/web/app/mobile/tags/user-followers.tag +++ b/src/web/app/mobile/tags/user-followers.tag @@ -20,7 +20,7 @@ }; this.on('mount', () => { - this.refs.list.on('loaded', () => { + this.$refs.list.on('loaded', () => { this.trigger('loaded'); }); }); diff --git a/src/web/app/mobile/tags/user-following.tag b/src/web/app/mobile/tags/user-following.tag index 62ca091812..3a6a54dd76 100644 --- a/src/web/app/mobile/tags/user-following.tag +++ b/src/web/app/mobile/tags/user-following.tag @@ -20,7 +20,7 @@ }; this.on('mount', () => { - this.refs.list.on('loaded', () => { + this.$refs.list.on('loaded', () => { this.trigger('loaded'); }); }); diff --git a/src/web/app/mobile/tags/user-timeline.tag b/src/web/app/mobile/tags/user-timeline.tag index 86ead5971f..65203fec4b 100644 --- a/src/web/app/mobile/tags/user-timeline.tag +++ b/src/web/app/mobile/tags/user-timeline.tag @@ -26,7 +26,7 @@ return this.api('users/posts', { user_id: this.user.id, with_media: this.withMedia, - until_id: this.refs.timeline.tail().id + until_id: this.$refs.timeline.tail().id }); }; diff --git a/src/web/app/status/tags/index.tag b/src/web/app/status/tags/index.tag index dcadc66172..198aa89e38 100644 --- a/src/web/app/status/tags/index.tag +++ b/src/web/app/status/tags/index.tag @@ -93,7 +93,7 @@ }); this.onStats = stats => { - this.refs.chart.addData(1 - stats.cpu_usage); + this.$refs.chart.addData(1 - stats.cpu_usage); const percentage = (stats.cpu_usage * 100).toFixed(0); @@ -124,7 +124,7 @@ this.onStats = stats => { stats.mem.used = stats.mem.total - stats.mem.free; - this.refs.chart.addData(1 - (stats.mem.used / stats.mem.total)); + this.$refs.chart.addData(1 - (stats.mem.used / stats.mem.total)); const percentage = (stats.mem.used / stats.mem.total * 100).toFixed(0); -- cgit v1.2.3-freya From 1a6a72591fc57a71e675062d8906b9c4095dbb33 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Wed, 7 Feb 2018 18:21:37 +0900 Subject: wip --- src/web/app/common/tags/post-menu.tag | 6 +-- src/web/app/common/tags/reaction-picker.vue | 51 ++++++++-------------- src/web/app/desktop/tags/contextmenu.tag | 2 +- src/web/app/desktop/tags/detailed-post-window.tag | 2 +- src/web/app/desktop/tags/dialog.tag | 2 +- src/web/app/desktop/tags/donation.tag | 2 +- .../app/desktop/tags/drive/base-contextmenu.tag | 2 +- src/web/app/desktop/tags/drive/browser-window.tag | 2 +- .../app/desktop/tags/drive/file-contextmenu.tag | 2 +- .../app/desktop/tags/drive/folder-contextmenu.tag | 2 +- src/web/app/desktop/tags/following-setuper.tag | 2 +- src/web/app/desktop/tags/images.tag | 2 +- src/web/app/desktop/tags/input-dialog.tag | 2 +- src/web/app/desktop/tags/messaging/room-window.tag | 2 +- src/web/app/desktop/tags/messaging/window.tag | 2 +- src/web/app/desktop/tags/post-form-window.tag | 2 +- src/web/app/desktop/tags/progress-dialog.tag | 2 +- src/web/app/desktop/tags/repost-form-window.tag | 2 +- .../desktop/tags/select-file-from-drive-window.tag | 2 +- .../tags/select-folder-from-drive-window.tag | 2 +- src/web/app/desktop/tags/set-avatar-suggestion.tag | 2 +- src/web/app/desktop/tags/set-banner-suggestion.tag | 2 +- src/web/app/desktop/tags/settings-window.tag | 2 +- src/web/app/desktop/tags/ui.tag | 2 +- src/web/app/desktop/tags/user-preview.tag | 2 +- src/web/app/mobile/tags/drive-folder-selector.tag | 4 +- src/web/app/mobile/tags/drive-selector.tag | 6 +-- src/web/app/mobile/tags/init-following.tag | 2 +- src/web/app/mobile/tags/notify.tag | 2 +- src/web/app/mobile/tags/post-form.tag | 4 +- 30 files changed, 54 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/web/app/common/tags/post-menu.tag b/src/web/app/common/tags/post-menu.tag index 92b2801f59..2ca8c9602f 100644 --- a/src/web/app/common/tags/post-menu.tag +++ b/src/web/app/common/tags/post-menu.tag @@ -119,7 +119,7 @@ post_id: this.post.id }).then(() => { if (this.opts.cb) this.opts.cb('pinned', '%i18n:common.tags.mk-post-menu.pinned%'); - this.unmount(); + this.$destroy(); }); }; @@ -130,7 +130,7 @@ category: category }).then(() => { if (this.opts.cb) this.opts.cb('categorized', '%i18n:common.tags.mk-post-menu.categorized%'); - this.unmount(); + this.$destroy(); }); }; @@ -150,7 +150,7 @@ scale: 0.5, duration: 200, easing: 'easeInBack', - complete: () => this.unmount() + complete: () => this.$destroy() }); }; diff --git a/src/web/app/common/tags/reaction-picker.vue b/src/web/app/common/tags/reaction-picker.vue index 4157372088..496144d886 100644 --- a/src/web/app/common/tags/reaction-picker.vue +++ b/src/web/app/common/tags/reaction-picker.vue @@ -74,41 +74,28 @@ }, onMouseout: function(e) { this.title = placeholder; + }, + close: function() { + this.$refs.backdrop.style.pointerEvents = 'none'; + anime({ + targets: this.$refs.backdrop, + opacity: 0, + duration: 200, + easing: 'linear' + }); + + this.$refs.popover.style.pointerEvents = 'none'; + anime({ + targets: this.$refs.popover, + opacity: 0, + scale: 0.5, + duration: 200, + easing: 'easeInBack', + complete: () => this.$destroy() + }); } } }; - - this.mixin('api'); - - this.post = this.opts.post; - this.source = this.opts.source; - - this.on('mount', () => { - }); - - this.react = reaction => { - - }; - - this.close = () => { - this.$refs.backdrop.style.pointerEvents = 'none'; - anime({ - targets: this.$refs.backdrop, - opacity: 0, - duration: 200, - easing: 'linear' - }); - - this.$refs.popover.style.pointerEvents = 'none'; - anime({ - targets: this.$refs.popover, - opacity: 0, - scale: 0.5, - duration: 200, - easing: 'easeInBack', - complete: () => this.unmount() - }); - }; diff --git a/src/web/app/desktop/tags/contextmenu.tag b/src/web/app/desktop/tags/contextmenu.tag index 2a3b2a7726..ade44fce25 100644 --- a/src/web/app/desktop/tags/contextmenu.tag +++ b/src/web/app/desktop/tags/contextmenu.tag @@ -132,7 +132,7 @@ }); this.trigger('closed'); - this.unmount(); + this.$destroy(); }; diff --git a/src/web/app/desktop/tags/detailed-post-window.tag b/src/web/app/desktop/tags/detailed-post-window.tag index 93df377c4f..6d6f23ac35 100644 --- a/src/web/app/desktop/tags/detailed-post-window.tag +++ b/src/web/app/desktop/tags/detailed-post-window.tag @@ -69,7 +69,7 @@ opacity: 0, duration: 300, easing: 'linear', - complete: () => this.unmount() + complete: () => this.$destroy() }); }; diff --git a/src/web/app/desktop/tags/dialog.tag b/src/web/app/desktop/tags/dialog.tag index 9299e97334..aff855251e 100644 --- a/src/web/app/desktop/tags/dialog.tag +++ b/src/web/app/desktop/tags/dialog.tag @@ -130,7 +130,7 @@ scale: 0.8, duration: 300, easing: [ 0.5, -0.5, 1, 0.5 ], - complete: () => this.unmount() + complete: () => this.$destroy() }); }; diff --git a/src/web/app/desktop/tags/donation.tag b/src/web/app/desktop/tags/donation.tag index b2d18d4450..73ee9d0032 100644 --- a/src/web/app/desktop/tags/donation.tag +++ b/src/web/app/desktop/tags/donation.tag @@ -60,7 +60,7 @@ show_donation: false }); - this.unmount(); + this.$destroy(); }; diff --git a/src/web/app/desktop/tags/drive/base-contextmenu.tag b/src/web/app/desktop/tags/drive/base-contextmenu.tag index eb97ccccc1..d2381cc471 100644 --- a/src/web/app/desktop/tags/drive/base-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/base-contextmenu.tag @@ -18,7 +18,7 @@ this.on('mount', () => { this.$refs.ctx.on('closed', () => { this.trigger('closed'); - this.unmount(); + this.$destroy(); }); }); diff --git a/src/web/app/desktop/tags/drive/browser-window.tag b/src/web/app/desktop/tags/drive/browser-window.tag index 01cb4b1af8..f49921eb65 100644 --- a/src/web/app/desktop/tags/drive/browser-window.tag +++ b/src/web/app/desktop/tags/drive/browser-window.tag @@ -43,7 +43,7 @@ this.on('mount', () => { this.$refs.window.on('closed', () => { - this.unmount(); + this.$destroy(); }); this.api('drive').then(info => { diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag index 25721372b7..bb934d35e5 100644 --- a/src/web/app/desktop/tags/drive/file-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag @@ -50,7 +50,7 @@ this.on('mount', () => { this.$refs.ctx.on('closed', () => { this.trigger('closed'); - this.unmount(); + this.$destroy(); }); }); diff --git a/src/web/app/desktop/tags/drive/folder-contextmenu.tag b/src/web/app/desktop/tags/drive/folder-contextmenu.tag index d424482faa..43cad3da55 100644 --- a/src/web/app/desktop/tags/drive/folder-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/folder-contextmenu.tag @@ -30,7 +30,7 @@ this.$refs.ctx.on('closed', () => { this.trigger('closed'); - this.unmount(); + this.$destroy(); }); }; diff --git a/src/web/app/desktop/tags/following-setuper.tag b/src/web/app/desktop/tags/following-setuper.tag index 8280986298..d8cd32a208 100644 --- a/src/web/app/desktop/tags/following-setuper.tag +++ b/src/web/app/desktop/tags/following-setuper.tag @@ -163,7 +163,7 @@ }; this.close = () => { - this.unmount(); + this.$destroy(); }; diff --git a/src/web/app/desktop/tags/images.tag b/src/web/app/desktop/tags/images.tag index dcd664e722..8c4234a0f6 100644 --- a/src/web/app/desktop/tags/images.tag +++ b/src/web/app/desktop/tags/images.tag @@ -165,7 +165,7 @@ opacity: 0, duration: 100, easing: 'linear', - complete: () => this.unmount() + complete: () => this.$destroy() }); }; diff --git a/src/web/app/desktop/tags/input-dialog.tag b/src/web/app/desktop/tags/input-dialog.tag index bea8c2c22b..1eef25db12 100644 --- a/src/web/app/desktop/tags/input-dialog.tag +++ b/src/web/app/desktop/tags/input-dialog.tag @@ -142,7 +142,7 @@ }); this.$refs.window.on('closed', () => { - this.unmount(); + this.$destroy(); }); }); diff --git a/src/web/app/desktop/tags/messaging/room-window.tag b/src/web/app/desktop/tags/messaging/room-window.tag index bae456200e..39afbe6ddd 100644 --- a/src/web/app/desktop/tags/messaging/room-window.tag +++ b/src/web/app/desktop/tags/messaging/room-window.tag @@ -25,7 +25,7 @@ this.on('mount', () => { this.$refs.window.on('closed', () => { - this.unmount(); + this.$destroy(); }); }); diff --git a/src/web/app/desktop/tags/messaging/window.tag b/src/web/app/desktop/tags/messaging/window.tag index afe01c53e1..cd756daa04 100644 --- a/src/web/app/desktop/tags/messaging/window.tag +++ b/src/web/app/desktop/tags/messaging/window.tag @@ -21,7 +21,7 @@ diff --git a/src/web/app/desktop/tags/set-banner-suggestion.tag b/src/web/app/desktop/tags/set-banner-suggestion.tag index cbf0f1b68f..c5c5c70190 100644 --- a/src/web/app/desktop/tags/set-banner-suggestion.tag +++ b/src/web/app/desktop/tags/set-banner-suggestion.tag @@ -42,7 +42,7 @@ this.close = e => { e.preventDefault(); e.stopPropagation(); - this.unmount(); + this.$destroy(); }; diff --git a/src/web/app/desktop/tags/settings-window.tag b/src/web/app/desktop/tags/settings-window.tag index e68a44a4f6..09566b898a 100644 --- a/src/web/app/desktop/tags/settings-window.tag +++ b/src/web/app/desktop/tags/settings-window.tag @@ -19,7 +19,7 @@ diff --git a/src/web/app/mobile/tags/drive-folder-selector.tag b/src/web/app/mobile/tags/drive-folder-selector.tag index 37d571d731..6a0cb5cea6 100644 --- a/src/web/app/mobile/tags/drive-folder-selector.tag +++ b/src/web/app/mobile/tags/drive-folder-selector.tag @@ -58,12 +58,12 @@ diff --git a/src/web/app/mobile/tags/drive-selector.tag b/src/web/app/mobile/tags/drive-selector.tag index ab67cc80c0..9e6f6a0457 100644 --- a/src/web/app/mobile/tags/drive-selector.tag +++ b/src/web/app/mobile/tags/drive-selector.tag @@ -71,18 +71,18 @@ this.$refs.browser.on('selected', file => { this.trigger('selected', file); - this.unmount(); + this.$destroy(); }); }); this.cancel = () => { this.trigger('canceled'); - this.unmount(); + this.$destroy(); }; this.ok = () => { this.trigger('selected', this.files); - this.unmount(); + this.$destroy(); }; diff --git a/src/web/app/mobile/tags/init-following.tag b/src/web/app/mobile/tags/init-following.tag index d2d19a8876..d7e31b460f 100644 --- a/src/web/app/mobile/tags/init-following.tag +++ b/src/web/app/mobile/tags/init-following.tag @@ -124,7 +124,7 @@ }; this.close = () => { - this.unmount(); + this.$destroy(); }; diff --git a/src/web/app/mobile/tags/notify.tag b/src/web/app/mobile/tags/notify.tag index 2dfc2dddb8..386166f7f6 100644 --- a/src/web/app/mobile/tags/notify.tag +++ b/src/web/app/mobile/tags/notify.tag @@ -32,7 +32,7 @@ bottom: '-64px', duration: 500, easing: 'easeOutQuad', - complete: () => this.unmount() + complete: () => this.$destroy() }); }, 6000); }); diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag index 442919100d..6f07947536 100644 --- a/src/web/app/mobile/tags/post-form.tag +++ b/src/web/app/mobile/tags/post-form.tag @@ -255,7 +255,7 @@ poll: this.poll ? this.$refs.poll.get() : undefined }).then(data => { this.trigger('post'); - this.unmount(); + this.$destroy(); }).catch(err => { this.update({ wait: false @@ -265,7 +265,7 @@ this.cancel = () => { this.trigger('cancel'); - this.unmount(); + this.$destroy(); }; this.kao = () => { -- cgit v1.2.3-freya From 063193f429f5a8a9843fe1f13696c9d22a261b9e Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Wed, 7 Feb 2018 18:30:17 +0900 Subject: wip --- src/web/app/auth/tags/form.tag | 2 +- src/web/app/auth/tags/index.tag | 2 +- src/web/app/ch/tags/channel.tag | 6 +- src/web/app/ch/tags/header.tag | 2 +- src/web/app/ch/tags/index.tag | 2 +- src/web/app/common/tags/activity-table.tag | 2 +- src/web/app/common/tags/authorized-apps.tag | 2 +- src/web/app/common/tags/ellipsis.tag | 2 +- src/web/app/common/tags/error.tag | 4 +- src/web/app/common/tags/file-type-icon.tag | 2 +- src/web/app/common/tags/forkit.tag | 2 +- src/web/app/common/tags/introduction.tag | 2 +- src/web/app/common/tags/messaging/form.tag | 2 +- src/web/app/common/tags/messaging/index.tag | 2 +- src/web/app/common/tags/messaging/message.tag | 2 +- src/web/app/common/tags/messaging/room.tag | 2 +- src/web/app/common/tags/nav-links.tag | 2 +- src/web/app/common/tags/number.tag | 2 +- src/web/app/common/tags/poll-editor.tag | 2 +- src/web/app/common/tags/poll.tag | 2 +- src/web/app/common/tags/post-menu.tag | 2 +- src/web/app/common/tags/raw.tag | 2 +- src/web/app/common/tags/reaction-icon.tag | 2 +- src/web/app/common/tags/reaction-picker.vue | 168 ++++++++++----------- src/web/app/common/tags/reactions-viewer.tag | 2 +- src/web/app/common/tags/signin-history.tag | 4 +- src/web/app/common/tags/signin.tag | 2 +- src/web/app/common/tags/signup.tag | 2 +- src/web/app/common/tags/special-message.tag | 2 +- src/web/app/common/tags/stream-indicator.vue | 2 +- src/web/app/common/tags/twitter-setting.tag | 2 +- src/web/app/common/tags/uploader.tag | 2 +- src/web/app/desktop/tags/analog-clock.tag | 2 +- .../app/desktop/tags/autocomplete-suggestion.tag | 2 +- src/web/app/desktop/tags/big-follow-button.tag | 2 +- src/web/app/desktop/tags/contextmenu.tag | 2 +- src/web/app/desktop/tags/crop-window.tag | 2 +- src/web/app/desktop/tags/detailed-post-window.tag | 2 +- src/web/app/desktop/tags/dialog.tag | 2 +- src/web/app/desktop/tags/donation.tag | 2 +- src/web/app/desktop/tags/drive/browser-window.tag | 2 +- src/web/app/desktop/tags/drive/browser.tag | 2 +- src/web/app/desktop/tags/drive/file.tag | 2 +- src/web/app/desktop/tags/drive/folder.tag | 2 +- src/web/app/desktop/tags/drive/nav-folder.tag | 2 +- src/web/app/desktop/tags/ellipsis-icon.tag | 2 +- src/web/app/desktop/tags/follow-button.tag | 2 +- src/web/app/desktop/tags/following-setuper.tag | 2 +- .../app/desktop/tags/home-widgets/access-log.tag | 2 +- src/web/app/desktop/tags/home-widgets/activity.tag | 2 +- .../app/desktop/tags/home-widgets/broadcast.tag | 2 +- src/web/app/desktop/tags/home-widgets/calendar.tag | 2 +- src/web/app/desktop/tags/home-widgets/channel.tag | 8 +- src/web/app/desktop/tags/home-widgets/donation.tag | 2 +- src/web/app/desktop/tags/home-widgets/mentions.tag | 2 +- .../app/desktop/tags/home-widgets/messaging.tag | 2 +- src/web/app/desktop/tags/home-widgets/nav.tag | 2 +- .../desktop/tags/home-widgets/notifications.tag | 2 +- .../app/desktop/tags/home-widgets/photo-stream.tag | 2 +- .../app/desktop/tags/home-widgets/post-form.tag | 2 +- src/web/app/desktop/tags/home-widgets/profile.tag | 2 +- .../tags/home-widgets/recommended-polls.tag | 2 +- .../app/desktop/tags/home-widgets/rss-reader.tag | 2 +- src/web/app/desktop/tags/home-widgets/server.tag | 16 +- .../app/desktop/tags/home-widgets/slideshow.tag | 2 +- src/web/app/desktop/tags/home-widgets/timeline.tag | 2 +- .../app/desktop/tags/home-widgets/timemachine.tag | 2 +- src/web/app/desktop/tags/home-widgets/tips.tag | 2 +- src/web/app/desktop/tags/home-widgets/trends.tag | 2 +- .../tags/home-widgets/user-recommendation.tag | 2 +- src/web/app/desktop/tags/home-widgets/version.tag | 2 +- src/web/app/desktop/tags/home.tag | 2 +- src/web/app/desktop/tags/images.tag | 6 +- src/web/app/desktop/tags/input-dialog.tag | 2 +- src/web/app/desktop/tags/list-user.tag | 2 +- src/web/app/desktop/tags/messaging/room-window.tag | 2 +- src/web/app/desktop/tags/messaging/window.tag | 2 +- src/web/app/desktop/tags/notifications.tag | 2 +- src/web/app/desktop/tags/pages/drive.tag | 2 +- src/web/app/desktop/tags/pages/entrance.tag | 6 +- src/web/app/desktop/tags/pages/home-customize.tag | 2 +- src/web/app/desktop/tags/pages/home.tag | 2 +- src/web/app/desktop/tags/pages/messaging-room.tag | 2 +- src/web/app/desktop/tags/pages/not-found.tag | 2 +- src/web/app/desktop/tags/pages/post.tag | 2 +- src/web/app/desktop/tags/pages/search.tag | 2 +- src/web/app/desktop/tags/pages/selectdrive.tag | 2 +- src/web/app/desktop/tags/pages/user.tag | 2 +- src/web/app/desktop/tags/post-detail-sub.tag | 2 +- src/web/app/desktop/tags/post-detail.tag | 2 +- src/web/app/desktop/tags/post-form-window.tag | 2 +- src/web/app/desktop/tags/post-form.tag | 2 +- src/web/app/desktop/tags/post-preview.tag | 2 +- src/web/app/desktop/tags/progress-dialog.tag | 2 +- src/web/app/desktop/tags/repost-form-window.tag | 2 +- src/web/app/desktop/tags/repost-form.tag | 2 +- src/web/app/desktop/tags/search-posts.tag | 2 +- src/web/app/desktop/tags/search.tag | 2 +- .../desktop/tags/select-file-from-drive-window.tag | 2 +- .../tags/select-folder-from-drive-window.tag | 2 +- src/web/app/desktop/tags/set-avatar-suggestion.tag | 2 +- src/web/app/desktop/tags/set-banner-suggestion.tag | 2 +- src/web/app/desktop/tags/settings-window.tag | 2 +- src/web/app/desktop/tags/settings.tag | 14 +- src/web/app/desktop/tags/sub-post-content.tag | 2 +- src/web/app/desktop/tags/timeline.tag | 6 +- src/web/app/desktop/tags/ui.tag | 18 +-- src/web/app/desktop/tags/user-followers-window.tag | 2 +- src/web/app/desktop/tags/user-followers.tag | 2 +- src/web/app/desktop/tags/user-following-window.tag | 2 +- src/web/app/desktop/tags/user-following.tag | 2 +- src/web/app/desktop/tags/user-preview.tag | 2 +- src/web/app/desktop/tags/user-timeline.tag | 2 +- src/web/app/desktop/tags/user.tag | 18 +-- src/web/app/desktop/tags/users-list.tag | 2 +- src/web/app/desktop/tags/widgets/activity.tag | 6 +- src/web/app/desktop/tags/widgets/calendar.tag | 2 +- src/web/app/desktop/tags/window.tag | 2 +- src/web/app/dev/tags/new-app-form.tag | 2 +- src/web/app/dev/tags/pages/app.tag | 2 +- src/web/app/dev/tags/pages/apps.tag | 2 +- src/web/app/dev/tags/pages/index.tag | 2 +- src/web/app/dev/tags/pages/new-app.tag | 2 +- src/web/app/mobile/tags/drive-folder-selector.tag | 2 +- src/web/app/mobile/tags/drive-selector.tag | 2 +- src/web/app/mobile/tags/drive.tag | 2 +- src/web/app/mobile/tags/drive/file-viewer.tag | 2 +- src/web/app/mobile/tags/drive/file.tag | 2 +- src/web/app/mobile/tags/drive/folder.tag | 2 +- src/web/app/mobile/tags/follow-button.tag | 2 +- src/web/app/mobile/tags/home-timeline.tag | 2 +- src/web/app/mobile/tags/home.tag | 2 +- src/web/app/mobile/tags/images.tag | 4 +- src/web/app/mobile/tags/init-following.tag | 2 +- src/web/app/mobile/tags/notification-preview.tag | 2 +- src/web/app/mobile/tags/notification.tag | 2 +- src/web/app/mobile/tags/notifications.tag | 2 +- src/web/app/mobile/tags/notify.tag | 2 +- src/web/app/mobile/tags/page/drive.tag | 2 +- src/web/app/mobile/tags/page/entrance.tag | 2 +- src/web/app/mobile/tags/page/entrance/signin.tag | 2 +- src/web/app/mobile/tags/page/entrance/signup.tag | 2 +- src/web/app/mobile/tags/page/home.tag | 2 +- src/web/app/mobile/tags/page/messaging-room.tag | 2 +- src/web/app/mobile/tags/page/messaging.tag | 2 +- src/web/app/mobile/tags/page/new-post.tag | 2 +- src/web/app/mobile/tags/page/notifications.tag | 2 +- src/web/app/mobile/tags/page/post.tag | 2 +- src/web/app/mobile/tags/page/search.tag | 2 +- src/web/app/mobile/tags/page/selectdrive.tag | 2 +- src/web/app/mobile/tags/page/settings.tag | 4 +- .../mobile/tags/page/settings/authorized-apps.tag | 2 +- src/web/app/mobile/tags/page/settings/profile.tag | 4 +- src/web/app/mobile/tags/page/settings/signin.tag | 2 +- src/web/app/mobile/tags/page/settings/twitter.tag | 2 +- src/web/app/mobile/tags/page/user-followers.tag | 2 +- src/web/app/mobile/tags/page/user-following.tag | 2 +- src/web/app/mobile/tags/page/user.tag | 2 +- src/web/app/mobile/tags/post-detail.tag | 4 +- src/web/app/mobile/tags/post-form.tag | 2 +- src/web/app/mobile/tags/post-preview.tag | 2 +- src/web/app/mobile/tags/search-posts.tag | 2 +- src/web/app/mobile/tags/search.tag | 2 +- src/web/app/mobile/tags/sub-post-content.tag | 2 +- src/web/app/mobile/tags/timeline.tag | 6 +- src/web/app/mobile/tags/ui.tag | 6 +- src/web/app/mobile/tags/user-card.tag | 2 +- src/web/app/mobile/tags/user-followers.tag | 2 +- src/web/app/mobile/tags/user-following.tag | 2 +- src/web/app/mobile/tags/user-preview.tag | 2 +- src/web/app/mobile/tags/user-timeline.tag | 2 +- src/web/app/mobile/tags/user.tag | 20 +-- src/web/app/mobile/tags/users-list.tag | 2 +- src/web/app/stats/tags/index.tag | 10 +- src/web/app/status/tags/index.tag | 8 +- 175 files changed, 324 insertions(+), 328 deletions(-) (limited to 'src') diff --git a/src/web/app/auth/tags/form.tag b/src/web/app/auth/tags/form.tag index 5bb27c269e..8f60aadb54 100644 --- a/src/web/app/auth/tags/form.tag +++ b/src/web/app/auth/tags/form.tag @@ -29,7 +29,7 @@ - diff --git a/src/web/app/common/tags/forkit.tag b/src/web/app/common/tags/forkit.tag index 55d5731081..6a8d06e564 100644 --- a/src/web/app/common/tags/forkit.tag +++ b/src/web/app/common/tags/forkit.tag @@ -4,7 +4,7 @@ - diff --git a/src/web/app/common/tags/number.tag b/src/web/app/common/tags/number.tag index 7afb8b3983..4b1081a87c 100644 --- a/src/web/app/common/tags/number.tag +++ b/src/web/app/common/tags/number.tag @@ -1,5 +1,5 @@ - diff --git a/src/web/app/common/tags/poll-editor.tag b/src/web/app/common/tags/poll-editor.tag index f660032c92..28e059e877 100644 --- a/src/web/app/common/tags/poll-editor.tag +++ b/src/web/app/common/tags/poll-editor.tag @@ -14,7 +14,7 @@ - diff --git a/src/web/app/common/tags/reaction-icon.tag b/src/web/app/common/tags/reaction-icon.tag index 0127293917..50d62cfba1 100644 --- a/src/web/app/common/tags/reaction-icon.tag +++ b/src/web/app/common/tags/reaction-icon.tag @@ -9,7 +9,7 @@ %i18n:common.reactions.confused% %i18n:common.reactions.pudding% - - - + position absolute + top -($balloon-size * 2) + left s('calc(50% - %s)', $balloon-size) + border-top solid $balloon-size transparent + border-left solid $balloon-size transparent + border-right solid $balloon-size transparent + border-bottom solid $balloon-size $border-color + + &:after + content "" + display block + position absolute + top -($balloon-size * 2) + 1.5px + left s('calc(50% - %s)', $balloon-size) + border-top solid $balloon-size transparent + border-left solid $balloon-size transparent + border-right solid $balloon-size transparent + border-bottom solid $balloon-size #fff + + > p + display block + margin 0 + padding 8px 10px + font-size 14px + color #586069 + border-bottom solid 1px #e1e4e8 + + > div + padding 4px + width 240px + text-align center + + > button + width 40px + height 40px + font-size 24px + border-radius 2px + + &:hover + background #eee + + &:active + background $theme-color + box-shadow inset 0 0.15em 0.3em rgba(27, 31, 35, 0.15) + + diff --git a/src/web/app/common/tags/reactions-viewer.tag b/src/web/app/common/tags/reactions-viewer.tag index 50fb023f70..8ec14a12f8 100644 --- a/src/web/app/common/tags/reactions-viewer.tag +++ b/src/web/app/common/tags/reactions-viewer.tag @@ -10,7 +10,7 @@ { reactions.confused } { reactions.pudding } - diff --git a/src/web/app/desktop/tags/home-widgets/broadcast.tag b/src/web/app/desktop/tags/home-widgets/broadcast.tag index 157c429634..a1bd2175d8 100644 --- a/src/web/app/desktop/tags/home-widgets/broadcast.tag +++ b/src/web/app/desktop/tags/home-widgets/broadcast.tag @@ -14,7 +14,7 @@ }

%i18n:desktop.tags.mk-broadcast-home-widget.have-a-nice-day%

1 } @click="next">%i18n:desktop.tags.mk-broadcast-home-widget.next% >> - diff --git a/src/web/app/desktop/tags/home-widgets/tips.tag b/src/web/app/desktop/tags/home-widgets/tips.tag index 9246d0e10c..2135a836c9 100644 --- a/src/web/app/desktop/tags/home-widgets/tips.tag +++ b/src/web/app/desktop/tags/home-widgets/tips.tag @@ -1,6 +1,6 @@

%fa:R lightbulb%

- - diff --git a/src/web/app/desktop/tags/pages/home.tag b/src/web/app/desktop/tags/pages/home.tag index 62df62a484..206592518b 100644 --- a/src/web/app/desktop/tags/pages/home.tag +++ b/src/web/app/desktop/tags/pages/home.tag @@ -2,7 +2,7 @@ - diff --git a/src/web/app/desktop/tags/pages/messaging-room.tag b/src/web/app/desktop/tags/pages/messaging-room.tag index 3c21b97501..48096ec803 100644 --- a/src/web/app/desktop/tags/pages/messaging-room.tag +++ b/src/web/app/desktop/tags/pages/messaging-room.tag @@ -1,7 +1,7 @@ - diff --git a/src/web/app/desktop/tags/pages/post.tag b/src/web/app/desktop/tags/pages/post.tag index 6d3b030e05..43f040ed20 100644 --- a/src/web/app/desktop/tags/pages/post.tag +++ b/src/web/app/desktop/tags/pages/post.tag @@ -6,7 +6,7 @@ %fa:angle-down%%i18n:desktop.tags.mk-post-page.prev% - diff --git a/src/web/app/desktop/tags/pages/selectdrive.tag b/src/web/app/desktop/tags/pages/selectdrive.tag index d497a47c00..723a1dd5aa 100644 --- a/src/web/app/desktop/tags/pages/selectdrive.tag +++ b/src/web/app/desktop/tags/pages/selectdrive.tag @@ -6,7 +6,7 @@ - diff --git a/src/web/app/desktop/tags/post-detail-sub.tag b/src/web/app/desktop/tags/post-detail-sub.tag index 2d79ddd1e7..62f09d4e29 100644 --- a/src/web/app/desktop/tags/post-detail-sub.tag +++ b/src/web/app/desktop/tags/post-detail-sub.tag @@ -21,7 +21,7 @@ - @@ -56,7 +56,7 @@ - diff --git a/src/web/app/dev/tags/pages/apps.tag b/src/web/app/dev/tags/pages/apps.tag index 43db70fcf2..fbacee1376 100644 --- a/src/web/app/dev/tags/pages/apps.tag +++ b/src/web/app/dev/tags/pages/apps.tag @@ -10,7 +10,7 @@ - diff --git a/src/web/app/dev/tags/pages/index.tag b/src/web/app/dev/tags/pages/index.tag index f863876fa7..ca270b3774 100644 --- a/src/web/app/dev/tags/pages/index.tag +++ b/src/web/app/dev/tags/pages/index.tag @@ -1,5 +1,5 @@ アプリ - diff --git a/src/web/app/dev/tags/pages/new-app.tag b/src/web/app/dev/tags/pages/new-app.tag index 238b6865e1..26185f278b 100644 --- a/src/web/app/dev/tags/pages/new-app.tag +++ b/src/web/app/dev/tags/pages/new-app.tag @@ -6,7 +6,7 @@
- diff --git a/src/web/app/mobile/tags/page/entrance.tag b/src/web/app/mobile/tags/page/entrance.tag index b5da3c947b..ebcf30f80a 100644 --- a/src/web/app/mobile/tags/page/entrance.tag +++ b/src/web/app/mobile/tags/page/entrance.tag @@ -10,7 +10,7 @@

{ _COPYRIGHT_ }

- diff --git a/src/web/app/mobile/tags/page/messaging-room.tag b/src/web/app/mobile/tags/page/messaging-room.tag index 00ee265120..075ea8e83e 100644 --- a/src/web/app/mobile/tags/page/messaging-room.tag +++ b/src/web/app/mobile/tags/page/messaging-room.tag @@ -2,7 +2,7 @@ - diff --git a/src/web/app/mobile/tags/page/messaging.tag b/src/web/app/mobile/tags/page/messaging.tag index 76d6103777..acde6f2693 100644 --- a/src/web/app/mobile/tags/page/messaging.tag +++ b/src/web/app/mobile/tags/page/messaging.tag @@ -2,7 +2,7 @@ - diff --git a/src/web/app/mobile/tags/page/new-post.tag b/src/web/app/mobile/tags/page/new-post.tag index 7adde3b329..1650446b43 100644 --- a/src/web/app/mobile/tags/page/new-post.tag +++ b/src/web/app/mobile/tags/page/new-post.tag @@ -1,6 +1,6 @@ - diff --git a/src/web/app/mobile/tags/page/notifications.tag b/src/web/app/mobile/tags/page/notifications.tag index 596467d476..97717e2e2a 100644 --- a/src/web/app/mobile/tags/page/notifications.tag +++ b/src/web/app/mobile/tags/page/notifications.tag @@ -2,7 +2,7 @@ - diff --git a/src/web/app/mobile/tags/page/post.tag b/src/web/app/mobile/tags/page/post.tag index 5303ca8d34..003f9dea56 100644 --- a/src/web/app/mobile/tags/page/post.tag +++ b/src/web/app/mobile/tags/page/post.tag @@ -8,7 +8,7 @@ %fa:angle-down%%i18n:mobile.tags.mk-post-page.prev% - diff --git a/src/web/app/mobile/tags/page/selectdrive.tag b/src/web/app/mobile/tags/page/selectdrive.tag index 172a161ec3..c7ff66d050 100644 --- a/src/web/app/mobile/tags/page/selectdrive.tag +++ b/src/web/app/mobile/tags/page/selectdrive.tag @@ -6,7 +6,7 @@
- @@ -29,7 +29,7 @@
  • %fa:power-off%%i18n:mobile.tags.mk-settings-page.signout%
  • ver { _VERSION_ } (葵 aoi)

    - diff --git a/src/web/app/mobile/tags/page/settings/profile.tag b/src/web/app/mobile/tags/page/settings/profile.tag index 5d6c477940..e213f40706 100644 --- a/src/web/app/mobile/tags/page/settings/profile.tag +++ b/src/web/app/mobile/tags/page/settings/profile.tag @@ -2,7 +2,7 @@ - @@ -51,7 +51,7 @@ - diff --git a/src/web/app/mobile/tags/page/settings/twitter.tag b/src/web/app/mobile/tags/page/settings/twitter.tag index 02661d3b6b..672eff25be 100644 --- a/src/web/app/mobile/tags/page/settings/twitter.tag +++ b/src/web/app/mobile/tags/page/settings/twitter.tag @@ -2,7 +2,7 @@ - diff --git a/src/web/app/mobile/tags/page/user-followers.tag b/src/web/app/mobile/tags/page/user-followers.tag index a5e63613c6..50280e7b99 100644 --- a/src/web/app/mobile/tags/page/user-followers.tag +++ b/src/web/app/mobile/tags/page/user-followers.tag @@ -2,7 +2,7 @@ - diff --git a/src/web/app/mobile/tags/page/user-following.tag b/src/web/app/mobile/tags/page/user-following.tag index b4ed107834..b28efbab94 100644 --- a/src/web/app/mobile/tags/page/user-following.tag +++ b/src/web/app/mobile/tags/page/user-following.tag @@ -2,7 +2,7 @@ - diff --git a/src/web/app/mobile/tags/page/user.tag b/src/web/app/mobile/tags/page/user.tag index 8eec733fcd..04b7276364 100644 --- a/src/web/app/mobile/tags/page/user.tag +++ b/src/web/app/mobile/tags/page/user.tag @@ -2,7 +2,7 @@ - diff --git a/src/web/app/mobile/tags/post-detail.tag b/src/web/app/mobile/tags/post-detail.tag index be377d77f5..e397ce7c0b 100644 --- a/src/web/app/mobile/tags/post-detail.tag +++ b/src/web/app/mobile/tags/post-detail.tag @@ -62,7 +62,7 @@ - diff --git a/src/web/app/mobile/tags/sub-post-content.tag b/src/web/app/mobile/tags/sub-post-content.tag index 7192cd0130..3d9175b18c 100644 --- a/src/web/app/mobile/tags/sub-post-content.tag +++ b/src/web/app/mobile/tags/sub-post-content.tag @@ -8,7 +8,7 @@ %i18n:mobile.tags.mk-sub-post-content.poll%
    - @@ -85,7 +85,7 @@

    %i18n:stats.users-count% { stats.users_count }

    - @@ -133,7 +133,7 @@ stroke="#555" stroke-dasharray="2 2"/> - @@ -107,7 +107,7 @@

    MEM { percentage }%

    - @@ -164,7 +164,7 @@ stroke="#f43b16" stroke-width="0.5"/> - - - diff --git a/src/web/app/common/tags/reactions-viewer.vue b/src/web/app/common/tags/reactions-viewer.vue new file mode 100644 index 0000000000..ad126ff1d5 --- /dev/null +++ b/src/web/app/common/tags/reactions-viewer.vue @@ -0,0 +1,55 @@ + + + + + + + + + + diff --git a/src/web/app/common/tags/signin-history.tag b/src/web/app/common/tags/signin-history.tag index 332bfdccfa..e6b57c091f 100644 --- a/src/web/app/common/tags/signin-history.tag +++ b/src/web/app/common/tags/signin-history.tag @@ -1,5 +1,5 @@ -
    +
    - - + -- cgit v1.2.3-freya From d8d4c4d2287489a02b3185a79ed0cac77057cf81 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Wed, 7 Feb 2018 18:47:29 +0900 Subject: wip --- src/web/app/auth/tags/form.tag | 2 +- src/web/app/auth/tags/index.tag | 2 +- src/web/app/ch/tags/channel.tag | 10 +++++----- src/web/app/ch/tags/header.tag | 2 +- src/web/app/ch/tags/index.tag | 2 +- src/web/app/common/tags/activity-table.tag | 2 +- src/web/app/common/tags/authorized-apps.tag | 2 +- src/web/app/common/tags/error.tag | 4 ++-- src/web/app/common/tags/file-type-icon.tag | 2 +- src/web/app/common/tags/messaging/form.tag | 2 +- src/web/app/common/tags/messaging/index.tag | 2 +- src/web/app/common/tags/messaging/message.tag | 2 +- src/web/app/common/tags/messaging/room.tag | 2 +- src/web/app/common/tags/nav-links.tag | 2 +- src/web/app/common/tags/number.tag | 2 +- src/web/app/common/tags/poll-editor.tag | 2 +- src/web/app/common/tags/poll.tag | 2 +- src/web/app/common/tags/post-menu.tag | 2 +- src/web/app/common/tags/raw.tag | 2 +- src/web/app/common/tags/reaction-picker.vue | 2 +- src/web/app/common/tags/reactions-viewer.vue | 2 +- src/web/app/common/tags/signin-history.tag | 4 ++-- src/web/app/common/tags/signin.tag | 2 +- src/web/app/common/tags/signup.tag | 2 +- src/web/app/common/tags/special-message.tag | 2 +- src/web/app/common/tags/stream-indicator.vue | 2 +- src/web/app/common/tags/time.vue | 2 +- src/web/app/common/tags/twitter-setting.tag | 2 +- src/web/app/common/tags/uploader.tag | 2 +- src/web/app/desktop/tags/analog-clock.tag | 2 +- src/web/app/desktop/tags/autocomplete-suggestion.tag | 2 +- src/web/app/desktop/tags/big-follow-button.tag | 2 +- src/web/app/desktop/tags/contextmenu.tag | 2 +- src/web/app/desktop/tags/crop-window.tag | 2 +- src/web/app/desktop/tags/detailed-post-window.tag | 2 +- src/web/app/desktop/tags/dialog.tag | 2 +- src/web/app/desktop/tags/donation.tag | 2 +- src/web/app/desktop/tags/drive/base-contextmenu.tag | 2 +- src/web/app/desktop/tags/drive/browser-window.tag | 2 +- src/web/app/desktop/tags/drive/browser.tag | 2 +- src/web/app/desktop/tags/drive/file-contextmenu.tag | 2 +- src/web/app/desktop/tags/drive/file.tag | 2 +- .../app/desktop/tags/drive/folder-contextmenu.tag | 2 +- src/web/app/desktop/tags/drive/folder.tag | 2 +- src/web/app/desktop/tags/drive/nav-folder.tag | 2 +- src/web/app/desktop/tags/follow-button.tag | 2 +- src/web/app/desktop/tags/following-setuper.tag | 2 +- src/web/app/desktop/tags/home-widgets/access-log.tag | 2 +- src/web/app/desktop/tags/home-widgets/activity.tag | 2 +- src/web/app/desktop/tags/home-widgets/broadcast.tag | 2 +- src/web/app/desktop/tags/home-widgets/calendar.tag | 2 +- src/web/app/desktop/tags/home-widgets/channel.tag | 8 ++++---- src/web/app/desktop/tags/home-widgets/donation.tag | 2 +- src/web/app/desktop/tags/home-widgets/mentions.tag | 2 +- src/web/app/desktop/tags/home-widgets/messaging.tag | 2 +- src/web/app/desktop/tags/home-widgets/nav.tag | 2 +- .../app/desktop/tags/home-widgets/notifications.tag | 2 +- .../app/desktop/tags/home-widgets/photo-stream.tag | 2 +- src/web/app/desktop/tags/home-widgets/post-form.tag | 2 +- src/web/app/desktop/tags/home-widgets/profile.tag | 2 +- .../desktop/tags/home-widgets/recommended-polls.tag | 2 +- src/web/app/desktop/tags/home-widgets/rss-reader.tag | 2 +- src/web/app/desktop/tags/home-widgets/server.tag | 16 ++++++++-------- src/web/app/desktop/tags/home-widgets/slideshow.tag | 2 +- src/web/app/desktop/tags/home-widgets/timeline.tag | 2 +- .../app/desktop/tags/home-widgets/timemachine.tag | 2 +- src/web/app/desktop/tags/home-widgets/tips.tag | 2 +- src/web/app/desktop/tags/home-widgets/trends.tag | 2 +- .../tags/home-widgets/user-recommendation.tag | 2 +- src/web/app/desktop/tags/home-widgets/version.tag | 2 +- src/web/app/desktop/tags/home.tag | 2 +- src/web/app/desktop/tags/images.tag | 6 +++--- src/web/app/desktop/tags/input-dialog.tag | 2 +- src/web/app/desktop/tags/list-user.tag | 2 +- src/web/app/desktop/tags/messaging/room-window.tag | 2 +- src/web/app/desktop/tags/messaging/window.tag | 2 +- src/web/app/desktop/tags/notifications.tag | 2 +- src/web/app/desktop/tags/pages/drive.tag | 2 +- src/web/app/desktop/tags/pages/entrance.tag | 4 ++-- src/web/app/desktop/tags/pages/home-customize.tag | 2 +- src/web/app/desktop/tags/pages/home.tag | 2 +- src/web/app/desktop/tags/pages/messaging-room.tag | 2 +- src/web/app/desktop/tags/pages/post.tag | 2 +- src/web/app/desktop/tags/pages/search.tag | 2 +- src/web/app/desktop/tags/pages/selectdrive.tag | 2 +- src/web/app/desktop/tags/pages/user.tag | 2 +- src/web/app/desktop/tags/post-detail-sub.tag | 2 +- src/web/app/desktop/tags/post-detail.tag | 2 +- src/web/app/desktop/tags/post-form-window.tag | 2 +- src/web/app/desktop/tags/post-form.tag | 2 +- src/web/app/desktop/tags/post-preview.tag | 2 +- src/web/app/desktop/tags/progress-dialog.tag | 2 +- src/web/app/desktop/tags/repost-form-window.tag | 2 +- src/web/app/desktop/tags/repost-form.tag | 2 +- src/web/app/desktop/tags/search-posts.tag | 2 +- src/web/app/desktop/tags/search.tag | 2 +- .../desktop/tags/select-file-from-drive-window.tag | 2 +- .../desktop/tags/select-folder-from-drive-window.tag | 2 +- src/web/app/desktop/tags/set-avatar-suggestion.tag | 2 +- src/web/app/desktop/tags/set-banner-suggestion.tag | 2 +- src/web/app/desktop/tags/settings-window.tag | 2 +- src/web/app/desktop/tags/settings.tag | 14 +++++++------- src/web/app/desktop/tags/sub-post-content.tag | 2 +- src/web/app/desktop/tags/timeline.tag | 6 +++--- src/web/app/desktop/tags/ui.tag | 18 +++++++++--------- src/web/app/desktop/tags/user-followers-window.tag | 2 +- src/web/app/desktop/tags/user-followers.tag | 2 +- src/web/app/desktop/tags/user-following-window.tag | 2 +- src/web/app/desktop/tags/user-following.tag | 2 +- src/web/app/desktop/tags/user-preview.tag | 2 +- src/web/app/desktop/tags/user-timeline.tag | 2 +- src/web/app/desktop/tags/user.tag | 18 +++++++++--------- src/web/app/desktop/tags/users-list.tag | 2 +- src/web/app/desktop/tags/widgets/activity.tag | 6 +++--- src/web/app/desktop/tags/widgets/calendar.tag | 2 +- src/web/app/desktop/tags/window.tag | 2 +- src/web/app/dev/tags/new-app-form.tag | 2 +- src/web/app/dev/tags/pages/app.tag | 2 +- src/web/app/dev/tags/pages/apps.tag | 2 +- src/web/app/mobile/tags/drive-folder-selector.tag | 2 +- src/web/app/mobile/tags/drive-selector.tag | 2 +- src/web/app/mobile/tags/drive.tag | 2 +- src/web/app/mobile/tags/drive/file-viewer.tag | 2 +- src/web/app/mobile/tags/drive/file.tag | 2 +- src/web/app/mobile/tags/drive/folder.tag | 2 +- src/web/app/mobile/tags/follow-button.tag | 2 +- src/web/app/mobile/tags/home-timeline.tag | 2 +- src/web/app/mobile/tags/home.tag | 2 +- src/web/app/mobile/tags/images.tag | 4 ++-- src/web/app/mobile/tags/init-following.tag | 2 +- src/web/app/mobile/tags/notification-preview.tag | 2 +- src/web/app/mobile/tags/notification.tag | 2 +- src/web/app/mobile/tags/notifications.tag | 2 +- src/web/app/mobile/tags/notify.tag | 2 +- src/web/app/mobile/tags/page/drive.tag | 2 +- src/web/app/mobile/tags/page/entrance.tag | 2 +- src/web/app/mobile/tags/page/home.tag | 2 +- src/web/app/mobile/tags/page/messaging-room.tag | 2 +- src/web/app/mobile/tags/page/messaging.tag | 2 +- src/web/app/mobile/tags/page/notifications.tag | 2 +- src/web/app/mobile/tags/page/post.tag | 2 +- src/web/app/mobile/tags/page/search.tag | 2 +- src/web/app/mobile/tags/page/selectdrive.tag | 2 +- src/web/app/mobile/tags/page/settings.tag | 4 ++-- .../mobile/tags/page/settings/authorized-apps.tag | 2 +- src/web/app/mobile/tags/page/settings/profile.tag | 4 ++-- src/web/app/mobile/tags/page/settings/signin.tag | 2 +- src/web/app/mobile/tags/page/settings/twitter.tag | 2 +- src/web/app/mobile/tags/page/user-followers.tag | 2 +- src/web/app/mobile/tags/page/user-following.tag | 2 +- src/web/app/mobile/tags/page/user.tag | 2 +- src/web/app/mobile/tags/post-detail.tag | 4 ++-- src/web/app/mobile/tags/post-form.tag | 2 +- src/web/app/mobile/tags/post-preview.tag | 2 +- src/web/app/mobile/tags/search-posts.tag | 2 +- src/web/app/mobile/tags/search.tag | 2 +- src/web/app/mobile/tags/sub-post-content.tag | 2 +- src/web/app/mobile/tags/timeline.tag | 6 +++--- src/web/app/mobile/tags/ui.tag | 6 +++--- src/web/app/mobile/tags/user-card.tag | 2 +- src/web/app/mobile/tags/user-followers.tag | 2 +- src/web/app/mobile/tags/user-following.tag | 2 +- src/web/app/mobile/tags/user-preview.tag | 2 +- src/web/app/mobile/tags/user-timeline.tag | 2 +- src/web/app/mobile/tags/user.tag | 20 ++++++++++---------- src/web/app/mobile/tags/users-list.tag | 2 +- src/web/app/stats/tags/index.tag | 10 +++++----- src/web/app/status/tags/index.tag | 8 ++++---- 168 files changed, 237 insertions(+), 237 deletions(-) (limited to 'src') diff --git a/src/web/app/auth/tags/form.tag b/src/web/app/auth/tags/form.tag index 8c085ee9b8..9b317fef46 100644 --- a/src/web/app/auth/tags/form.tag +++ b/src/web/app/auth/tags/form.tag @@ -105,7 +105,7 @@ font-size 16px - diff --git a/src/web/app/ch/tags/index.tag b/src/web/app/ch/tags/index.tag index e058da6a3f..6e0b451e8a 100644 --- a/src/web/app/ch/tags/index.tag +++ b/src/web/app/ch/tags/index.tag @@ -11,7 +11,7 @@ display block - diff --git a/src/web/app/common/tags/messaging/form.tag b/src/web/app/common/tags/messaging/form.tag index df0658741f..e9d2c01caa 100644 --- a/src/web/app/common/tags/messaging/form.tag +++ b/src/web/app/common/tags/messaging/form.tag @@ -116,7 +116,7 @@ display none - diff --git a/src/web/app/common/tags/number.tag b/src/web/app/common/tags/number.tag index 4b1081a87c..9cbbacd2c7 100644 --- a/src/web/app/common/tags/number.tag +++ b/src/web/app/common/tags/number.tag @@ -3,7 +3,7 @@ :scope display inline - diff --git a/src/web/app/desktop/tags/home-widgets/mentions.tag b/src/web/app/desktop/tags/home-widgets/mentions.tag index d4569216c6..2ca1fa502d 100644 --- a/src/web/app/desktop/tags/home-widgets/mentions.tag +++ b/src/web/app/desktop/tags/home-widgets/mentions.tag @@ -52,7 +52,7 @@ color #ccc - diff --git a/src/web/app/desktop/tags/home-widgets/notifications.tag b/src/web/app/desktop/tags/home-widgets/notifications.tag index 4a6d7b4170..4c48da6592 100644 --- a/src/web/app/desktop/tags/home-widgets/notifications.tag +++ b/src/web/app/desktop/tags/home-widgets/notifications.tag @@ -46,7 +46,7 @@ overflow auto - @@ -516,7 +516,7 @@ fill rgba(0, 0, 0, 0.6) - diff --git a/src/web/app/desktop/tags/home.tag b/src/web/app/desktop/tags/home.tag index f727c3e808..827622930d 100644 --- a/src/web/app/desktop/tags/home.tag +++ b/src/web/app/desktop/tags/home.tag @@ -180,7 +180,7 @@ margin 0 auto - + diff --git a/src/web/app/desktop/tags/messaging/room-window.tag b/src/web/app/desktop/tags/messaging/room-window.tag index b13c2d3e90..ca11873644 100644 --- a/src/web/app/desktop/tags/messaging/room-window.tag +++ b/src/web/app/desktop/tags/messaging/room-window.tag @@ -18,7 +18,7 @@ overflow auto - + @@ -175,7 +175,7 @@ box-shadow 0 0 0 2px rgba($theme-color, 0.5) !important - + diff --git a/src/web/app/desktop/tags/user-followers.tag b/src/web/app/desktop/tags/user-followers.tag index 79fa871413..a1b44f0f5b 100644 --- a/src/web/app/desktop/tags/user-followers.tag +++ b/src/web/app/desktop/tags/user-followers.tag @@ -6,7 +6,7 @@ height 100% - + diff --git a/src/web/app/desktop/tags/user-following.tag b/src/web/app/desktop/tags/user-following.tag index 260900f951..db46bf110e 100644 --- a/src/web/app/desktop/tags/user-following.tag +++ b/src/web/app/desktop/tags/user-following.tag @@ -6,7 +6,7 @@ height 100% - + diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag index 01c0748fea..1c0282e771 100644 --- a/src/web/app/mobile/tags/post-form.tag +++ b/src/web/app/mobile/tags/post-form.tag @@ -144,7 +144,7 @@ box-shadow none - + diff --git a/src/web/app/mobile/tags/search-posts.tag b/src/web/app/mobile/tags/search-posts.tag index 9cb5ee36f4..00936a8385 100644 --- a/src/web/app/mobile/tags/search-posts.tag +++ b/src/web/app/mobile/tags/search-posts.tag @@ -14,7 +14,7 @@ margin 16px auto width calc(100% - 32px) - + diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag index 0c783b8f3a..16fb116eb6 100644 --- a/src/web/app/mobile/tags/ui.tag +++ b/src/web/app/mobile/tags/ui.tag @@ -10,7 +10,7 @@ display block padding-top 48px - diff --git a/src/web/app/mobile/tags/user-followers.tag b/src/web/app/mobile/tags/user-followers.tag index a4dc99e68a..02368045e0 100644 --- a/src/web/app/mobile/tags/user-followers.tag +++ b/src/web/app/mobile/tags/user-followers.tag @@ -5,7 +5,7 @@ display block - + diff --git a/src/web/app/mobile/tags/user-timeline.tag b/src/web/app/mobile/tags/user-timeline.tag index dd878810cf..270a3744c3 100644 --- a/src/web/app/mobile/tags/user-timeline.tag +++ b/src/web/app/mobile/tags/user-timeline.tag @@ -6,7 +6,7 @@ max-width 600px margin 0 auto - @@ -620,7 +620,7 @@ margin-right 4px - @@ -658,7 +658,7 @@ margin-right 4px - - diff --git a/src/web/app/common/tags/poll.vue b/src/web/app/common/tags/poll.vue new file mode 100644 index 0000000000..638fa1cbe4 --- /dev/null +++ b/src/web/app/common/tags/poll.vue @@ -0,0 +1,117 @@ + + + + + + + + + diff --git a/src/web/app/common/tags/signin.tag b/src/web/app/common/tags/signin.tag index 441a8ec56c..76a55c7e05 100644 --- a/src/web/app/common/tags/signin.tag +++ b/src/web/app/common/tags/signin.tag @@ -1,5 +1,5 @@ -
    + diff --git a/src/web/app/desktop/tags/big-follow-button.tag b/src/web/app/desktop/tags/big-follow-button.tag index 6d43e4abeb..09b587c379 100644 --- a/src/web/app/desktop/tags/big-follow-button.tag +++ b/src/web/app/desktop/tags/big-follow-button.tag @@ -1,5 +1,5 @@ - -

    { '%i18n:desktop.tags.mk-post-form.text-remain%'.replace('{}', 1000 - refs.text.value.length) }

    - diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag index 3288ba7217..191d1d754a 100644 --- a/src/web/app/desktop/tags/settings.tag +++ b/src/web/app/desktop/tags/settings.tag @@ -1,15 +1,15 @@
    diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag index 4853533469..772140dcc6 100644 --- a/src/web/app/desktop/tags/timeline.tag +++ b/src/web/app/desktop/tags/timeline.tag @@ -135,7 +135,7 @@ - - - -
    -
    -
    -

    ゴミ箱

    -
    -
    - -
    -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -
    - - - diff --git a/src/web/app/desktop/tags/home.vue b/src/web/app/desktop/tags/home.vue new file mode 100644 index 0000000000..ee12200ba3 --- /dev/null +++ b/src/web/app/desktop/tags/home.vue @@ -0,0 +1,392 @@ + + + + + -- cgit v1.2.3-freya From 92a1429de9763a39541b065ddd86c8720f20500c Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 9 Feb 2018 13:11:30 +0900 Subject: wip --- src/web/app/auth/tags/form.tag | 4 +- src/web/app/common/tags/messaging/index.tag | 4 +- src/web/app/common/tags/signin.tag | 2 +- src/web/app/common/tags/uploader.tag | 6 +- src/web/app/desktop/tags/contextmenu.tag | 2 +- src/web/app/desktop/tags/crop-window.tag | 6 +- .../app/desktop/tags/drive/base-contextmenu.tag | 2 +- src/web/app/desktop/tags/drive/browser.tag | 10 +- .../app/desktop/tags/drive/file-contextmenu.tag | 2 +- .../app/desktop/tags/drive/folder-contextmenu.tag | 2 +- src/web/app/desktop/tags/home-widgets/mentions.tag | 2 +- src/web/app/desktop/tags/home-widgets/timeline.tag | 2 +- src/web/app/desktop/tags/home.vue | 484 ++++++++++----------- src/web/app/desktop/tags/post-form.tag | 12 +- src/web/app/desktop/tags/repost-form.tag | 6 +- src/web/app/desktop/tags/search-posts.tag | 2 +- src/web/app/desktop/tags/search.tag | 2 +- .../desktop/tags/select-file-from-drive-window.tag | 2 +- .../tags/select-folder-from-drive-window.tag | 2 +- src/web/app/desktop/tags/user-timeline.tag | 2 +- src/web/app/desktop/tags/user.tag | 6 +- src/web/app/desktop/tags/users-list.tag | 2 +- src/web/app/desktop/tags/widgets/activity.tag | 2 +- src/web/app/desktop/tags/window.tag | 8 +- src/web/app/mobile/tags/drive-folder-selector.tag | 4 +- src/web/app/mobile/tags/drive-selector.tag | 6 +- src/web/app/mobile/tags/drive.tag | 16 +- src/web/app/mobile/tags/home-timeline.tag | 2 +- src/web/app/mobile/tags/home.tag | 2 +- src/web/app/mobile/tags/notifications.tag | 2 +- src/web/app/mobile/tags/post-form.tag | 12 +- src/web/app/mobile/tags/search-posts.tag | 2 +- src/web/app/mobile/tags/search.tag | 2 +- src/web/app/mobile/tags/user-followers.tag | 2 +- src/web/app/mobile/tags/user-following.tag | 2 +- src/web/app/mobile/tags/user-timeline.tag | 2 +- src/web/app/mobile/tags/user.tag | 2 +- src/web/app/mobile/tags/users-list.tag | 2 +- 38 files changed, 306 insertions(+), 326 deletions(-) (limited to 'src') diff --git a/src/web/app/auth/tags/form.tag b/src/web/app/auth/tags/form.tag index f20165977f..043b6313bf 100644 --- a/src/web/app/auth/tags/form.tag +++ b/src/web/app/auth/tags/form.tag @@ -115,7 +115,7 @@ this.api('auth/deny', { token: this.session.token }).then(() => { - this.trigger('denied'); + this.$emit('denied'); }); }; @@ -123,7 +123,7 @@ this.api('auth/accept', { token: this.session.token }).then(() => { - this.trigger('accepted'); + this.$emit('accepted'); }); }; diff --git a/src/web/app/common/tags/messaging/index.tag b/src/web/app/common/tags/messaging/index.tag index f7af153c2a..0432f7e30f 100644 --- a/src/web/app/common/tags/messaging/index.tag +++ b/src/web/app/common/tags/messaging/index.tag @@ -344,7 +344,7 @@ this.registerMessage = message => { message.is_me = message.user_id == this.I.id; message._click = () => { - this.trigger('navigate-user', message.is_me ? message.recipient : message.user); + this.$emit('navigate-user', message.is_me ? message.recipient : message.user); }; }; @@ -400,7 +400,7 @@ }).then(users => { users.forEach(user => { user._click = () => { - this.trigger('navigate-user', user); + this.$emit('navigate-user', user); this.searchResult = []; }; }); diff --git a/src/web/app/common/tags/signin.tag b/src/web/app/common/tags/signin.tag index 76a55c7e05..89213d1f73 100644 --- a/src/web/app/common/tags/signin.tag +++ b/src/web/app/common/tags/signin.tag @@ -111,7 +111,7 @@ username: this.$refs.username.value }).then(user => { this.user = user; - this.trigger('user', user); + this.$emit('user', user); this.update(); }); }; diff --git a/src/web/app/common/tags/uploader.tag b/src/web/app/common/tags/uploader.tag index 1dbfff96fb..519b063fac 100644 --- a/src/web/app/common/tags/uploader.tag +++ b/src/web/app/common/tags/uploader.tag @@ -155,7 +155,7 @@ }; this.uploads.push(ctx); - this.trigger('change-uploads', this.uploads); + this.$emit('change-uploads', this.uploads); this.update(); const reader = new FileReader(); @@ -176,10 +176,10 @@ xhr.onload = e => { const driveFile = JSON.parse(e.target.response); - this.trigger('uploaded', driveFile); + this.$emit('uploaded', driveFile); this.uploads = this.uploads.filter(x => x.id != id); - this.trigger('change-uploads', this.uploads); + this.$emit('change-uploads', this.uploads); this.update(); }; diff --git a/src/web/app/desktop/tags/contextmenu.tag b/src/web/app/desktop/tags/contextmenu.tag index 67bdc58242..ee4c48fbde 100644 --- a/src/web/app/desktop/tags/contextmenu.tag +++ b/src/web/app/desktop/tags/contextmenu.tag @@ -131,7 +131,7 @@ el.removeEventListener('mousedown', this.mousedown); }); - this.trigger('closed'); + this.$emit('closed'); this.$destroy(); }; diff --git a/src/web/app/desktop/tags/crop-window.tag b/src/web/app/desktop/tags/crop-window.tag index 1749986b2b..c26f74b121 100644 --- a/src/web/app/desktop/tags/crop-window.tag +++ b/src/web/app/desktop/tags/crop-window.tag @@ -178,18 +178,18 @@ this.ok = () => { this.cropper.getCroppedCanvas().toBlob(blob => { - this.trigger('cropped', blob); + this.$emit('cropped', blob); this.$refs.window.close(); }); }; this.skip = () => { - this.trigger('skipped'); + this.$emit('skipped'); this.$refs.window.close(); }; this.cancel = () => { - this.trigger('canceled'); + this.$emit('canceled'); this.$refs.window.close(); }; diff --git a/src/web/app/desktop/tags/drive/base-contextmenu.tag b/src/web/app/desktop/tags/drive/base-contextmenu.tag index f81526bef0..c93d630263 100644 --- a/src/web/app/desktop/tags/drive/base-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/base-contextmenu.tag @@ -17,7 +17,7 @@ this.on('mount', () => { this.$refs.ctx.on('closed', () => { - this.trigger('closed'); + this.$emit('closed'); this.$destroy(); }); }); diff --git a/src/web/app/desktop/tags/drive/browser.tag b/src/web/app/desktop/tags/drive/browser.tag index 02d79afd86..7aaedab822 100644 --- a/src/web/app/desktop/tags/drive/browser.tag +++ b/src/web/app/desktop/tags/drive/browser.tag @@ -535,13 +535,13 @@ this.selectedFiles.push(file); } this.update(); - this.trigger('change-selection', this.selectedFiles); + this.$emit('change-selection', this.selectedFiles); } else { if (isAlreadySelected) { - this.trigger('selected', file); + this.$emit('selected', file); } else { this.selectedFiles = [file]; - this.trigger('change-selection', [file]); + this.$emit('change-selection', [file]); } } }; @@ -578,7 +578,7 @@ if (folder.parent) dive(folder.parent); this.update(); - this.trigger('open-folder', folder); + this.$emit('open-folder', folder); this.fetch(); }); }; @@ -648,7 +648,7 @@ folder: null, hierarchyFolders: [] }); - this.trigger('move-root'); + this.$emit('move-root'); this.fetch(); }; diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag index c7eeb01cd1..125f70b614 100644 --- a/src/web/app/desktop/tags/drive/file-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag @@ -49,7 +49,7 @@ this.on('mount', () => { this.$refs.ctx.on('closed', () => { - this.trigger('closed'); + this.$emit('closed'); this.$destroy(); }); }); diff --git a/src/web/app/desktop/tags/drive/folder-contextmenu.tag b/src/web/app/desktop/tags/drive/folder-contextmenu.tag index d4c2f93801..0cb7f6eb80 100644 --- a/src/web/app/desktop/tags/drive/folder-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/folder-contextmenu.tag @@ -29,7 +29,7 @@ this.$refs.ctx.open(pos); this.$refs.ctx.on('closed', () => { - this.trigger('closed'); + this.$emit('closed'); this.$destroy(); }); }; diff --git a/src/web/app/desktop/tags/home-widgets/mentions.tag b/src/web/app/desktop/tags/home-widgets/mentions.tag index e0592aa040..81f9b2875e 100644 --- a/src/web/app/desktop/tags/home-widgets/mentions.tag +++ b/src/web/app/desktop/tags/home-widgets/mentions.tag @@ -65,7 +65,7 @@ document.addEventListener('keydown', this.onDocumentKeydown); window.addEventListener('scroll', this.onScroll); - this.fetch(() => this.trigger('loaded')); + this.fetch(() => this.$emit('loaded')); }); this.on('unmount', () => { diff --git a/src/web/app/desktop/tags/home-widgets/timeline.tag b/src/web/app/desktop/tags/home-widgets/timeline.tag index ac2d95d5ae..4668ebfa87 100644 --- a/src/web/app/desktop/tags/home-widgets/timeline.tag +++ b/src/web/app/desktop/tags/home-widgets/timeline.tag @@ -59,7 +59,7 @@ document.addEventListener('keydown', this.onDocumentKeydown); window.addEventListener('scroll', this.onScroll); - this.load(() => this.trigger('loaded')); + this.load(() => this.$emit('loaded')); }); this.on('unmount', () => { diff --git a/src/web/app/desktop/tags/home.vue b/src/web/app/desktop/tags/home.vue index ee12200ba3..981123c56a 100644 --- a/src/web/app/desktop/tags/home.vue +++ b/src/web/app/desktop/tags/home.vue @@ -1,57 +1,243 @@ + + - - diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag index 358deb82f7..ddbb485d99 100644 --- a/src/web/app/desktop/tags/post-form.tag +++ b/src/web/app/desktop/tags/post-form.tag @@ -324,7 +324,7 @@ }); this.$refs.uploader.on('change-uploads', uploads => { - this.trigger('change-uploading-files', uploads); + this.$emit('change-uploading-files', uploads); }); this.autocomplete = new Autocomplete(this.$refs.text); @@ -340,7 +340,7 @@ this.update(); this.$refs.poll.set(draft.data.poll); } - this.trigger('change-files', this.files); + this.$emit('change-files', this.files); this.update(); } @@ -361,7 +361,7 @@ this.$refs.text.value = ''; this.files = []; this.poll = false; - this.trigger('change-files'); + this.$emit('change-files'); this.update(); }; @@ -444,14 +444,14 @@ this.addFile = file => { this.files.push(file); - this.trigger('change-files', this.files); + this.$emit('change-files', this.files); this.update(); }; this.removeFile = e => { const file = e.item; this.files = this.files.filter(x => x.id != file.id); - this.trigger('change-files', this.files); + this.$emit('change-files', this.files); this.update(); }; @@ -487,7 +487,7 @@ }).then(data => { this.clear(); this.removeDraft(); - this.trigger('post'); + this.$emit('post'); notify(this.repost ? '%i18n:desktop.tags.mk-post-form.reposted%' : this.inReplyToPost diff --git a/src/web/app/desktop/tags/repost-form.tag b/src/web/app/desktop/tags/repost-form.tag index a3d350fa2a..afe555b6d6 100644 --- a/src/web/app/desktop/tags/repost-form.tag +++ b/src/web/app/desktop/tags/repost-form.tag @@ -93,7 +93,7 @@ this.quote = false; this.cancel = () => { - this.trigger('cancel'); + this.$emit('cancel'); }; this.ok = () => { @@ -101,7 +101,7 @@ this.api('posts/create', { repost_id: this.opts.post.id }).then(data => { - this.trigger('posted'); + this.$emit('posted'); notify('%i18n:desktop.tags.mk-repost-form.success%'); }).catch(err => { notify('%i18n:desktop.tags.mk-repost-form.failure%'); @@ -118,7 +118,7 @@ }); this.$refs.form.on('post', () => { - this.trigger('posted'); + this.$emit('posted'); }); this.$refs.form.focus(); diff --git a/src/web/app/desktop/tags/search-posts.tag b/src/web/app/desktop/tags/search-posts.tag index 91bea2e906..52c68b754c 100644 --- a/src/web/app/desktop/tags/search-posts.tag +++ b/src/web/app/desktop/tags/search-posts.tag @@ -54,7 +54,7 @@ isEmpty: posts.length == 0 }); this.$refs.timeline.setPosts(posts); - this.trigger('loaded'); + this.$emit('loaded'); }); }); diff --git a/src/web/app/desktop/tags/search.tag b/src/web/app/desktop/tags/search.tag index ec6bbfc349..28127b721b 100644 --- a/src/web/app/desktop/tags/search.tag +++ b/src/web/app/desktop/tags/search.tag @@ -27,7 +27,7 @@ this.on('mount', () => { this.$refs.posts.on('loaded', () => { - this.trigger('loaded'); + this.$emit('loaded'); }); }); diff --git a/src/web/app/desktop/tags/select-file-from-drive-window.tag b/src/web/app/desktop/tags/select-file-from-drive-window.tag index 10dc7db9fd..d6234d5fd9 100644 --- a/src/web/app/desktop/tags/select-file-from-drive-window.tag +++ b/src/web/app/desktop/tags/select-file-from-drive-window.tag @@ -166,7 +166,7 @@ }; this.ok = () => { - this.trigger('selected', this.multiple ? this.files : this.files[0]); + this.$emit('selected', this.multiple ? this.files : this.files[0]); this.$refs.window.close(); }; diff --git a/src/web/app/desktop/tags/select-folder-from-drive-window.tag b/src/web/app/desktop/tags/select-folder-from-drive-window.tag index 1cd7527c81..2f98f30a63 100644 --- a/src/web/app/desktop/tags/select-folder-from-drive-window.tag +++ b/src/web/app/desktop/tags/select-folder-from-drive-window.tag @@ -105,7 +105,7 @@ }; this.ok = () => { - this.trigger('selected', this.$refs.window.refs.browser.folder); + this.$emit('selected', this.$refs.window.refs.browser.folder); this.$refs.window.close(); }; diff --git a/src/web/app/desktop/tags/user-timeline.tag b/src/web/app/desktop/tags/user-timeline.tag index 2e3bbbfd64..f018ba64e1 100644 --- a/src/web/app/desktop/tags/user-timeline.tag +++ b/src/web/app/desktop/tags/user-timeline.tag @@ -76,7 +76,7 @@ user: user }); - this.fetch(() => this.trigger('loaded')); + this.fetch(() => this.$emit('loaded')); }); }); diff --git a/src/web/app/desktop/tags/user.tag b/src/web/app/desktop/tags/user.tag index 161a151906..8221926f45 100644 --- a/src/web/app/desktop/tags/user.tag +++ b/src/web/app/desktop/tags/user.tag @@ -32,7 +32,7 @@ fetching: false, user: user }); - this.trigger('loaded'); + this.$emit('loaded'); }); }); @@ -716,7 +716,7 @@ this.on('mount', () => { this.$refs.tl.on('loaded', () => { - this.trigger('loaded'); + this.$emit('loaded'); }); this.scrollFollowerLeft = new ScrollFollower(this.$refs.left, this.parent.root.getBoundingClientRect().top); @@ -778,7 +778,7 @@ diff --git a/src/web/app/desktop/tags/users-list.tag b/src/web/app/desktop/tags/users-list.tag index 90173bfd25..bf002ae552 100644 --- a/src/web/app/desktop/tags/users-list.tag +++ b/src/web/app/desktop/tags/users-list.tag @@ -98,7 +98,7 @@ this.moreFetching = false; this.on('mount', () => { - this.fetch(() => this.trigger('loaded')); + this.fetch(() => this.$emit('loaded')); }); this.fetch = cb => { diff --git a/src/web/app/desktop/tags/widgets/activity.tag b/src/web/app/desktop/tags/widgets/activity.tag index ffddfa7dc8..8c20ef5a68 100644 --- a/src/web/app/desktop/tags/widgets/activity.tag +++ b/src/web/app/desktop/tags/widgets/activity.tag @@ -82,7 +82,7 @@ this.view++; if (this.view == 2) this.view = 0; this.update(); - this.trigger('view-changed', this.view); + this.$emit('view-changed', this.view); }; diff --git a/src/web/app/desktop/tags/window.tag b/src/web/app/desktop/tags/window.tag index dc7a37fff0..051b43f076 100644 --- a/src/web/app/desktop/tags/window.tag +++ b/src/web/app/desktop/tags/window.tag @@ -231,7 +231,7 @@ }; this.open = () => { - this.trigger('opening'); + this.$emit('opening'); this.top(); @@ -257,7 +257,7 @@ //this.$refs.main.focus(); setTimeout(() => { - this.trigger('opened'); + this.$emit('opened'); }, 300); }; @@ -278,7 +278,7 @@ }; this.close = () => { - this.trigger('closing'); + this.$emit('closing'); if (this.isModal) { this.$refs.bg.style.pointerEvents = 'none'; @@ -301,7 +301,7 @@ }); setTimeout(() => { - this.trigger('closed'); + this.$emit('closed'); }, 300); }; diff --git a/src/web/app/mobile/tags/drive-folder-selector.tag b/src/web/app/mobile/tags/drive-folder-selector.tag index a63d90af57..7dca527d6f 100644 --- a/src/web/app/mobile/tags/drive-folder-selector.tag +++ b/src/web/app/mobile/tags/drive-folder-selector.tag @@ -57,12 +57,12 @@ diff --git a/src/web/app/mobile/tags/drive-selector.tag b/src/web/app/mobile/tags/drive-selector.tag index d3e4f54c2b..4589592a72 100644 --- a/src/web/app/mobile/tags/drive-selector.tag +++ b/src/web/app/mobile/tags/drive-selector.tag @@ -70,18 +70,18 @@ }); this.$refs.browser.on('selected', file => { - this.trigger('selected', file); + this.$emit('selected', file); this.$destroy(); }); }); this.cancel = () => { - this.trigger('canceled'); + this.$emit('canceled'); this.$destroy(); }; this.ok = () => { - this.trigger('selected', this.files); + this.$emit('selected', this.files); this.$destroy(); }; diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag index 50578299a5..a7a8a35c3c 100644 --- a/src/web/app/mobile/tags/drive.tag +++ b/src/web/app/mobile/tags/drive.tag @@ -274,7 +274,7 @@ if (folder.parent) dive(folder.parent); this.update(); - this.trigger('open-folder', this.folder, silent); + this.$emit('open-folder', this.folder, silent); this.fetch(); }); }; @@ -343,7 +343,7 @@ folder: null, hierarchyFolders: [] }); - this.trigger('move-root'); + this.$emit('move-root'); this.fetch(); } @@ -359,7 +359,7 @@ fetching: true }); - this.trigger('begin-fetch'); + this.$emit('begin-fetch'); let fetchedFolders = null; let fetchedFiles = null; @@ -402,11 +402,11 @@ fetching: false }); // 一連の読み込みが完了したイベントを発行 - this.trigger('fetched'); + this.$emit('fetched'); } else { flag = true; // 一連の読み込みが半分完了したイベントを発行 - this.trigger('fetch-mid'); + this.$emit('fetch-mid'); } }; @@ -455,9 +455,9 @@ this.selectedFiles.push(file); } this.update(); - this.trigger('change-selection', this.selectedFiles); + this.$emit('change-selection', this.selectedFiles); } else { - this.trigger('selected', file); + this.$emit('selected', file); } } else { this.cf(file); @@ -482,7 +482,7 @@ if (file.folder) dive(file.folder); this.update(); - this.trigger('open-file', this.file, silent); + this.$emit('open-file', this.file, silent); }); }; diff --git a/src/web/app/mobile/tags/home-timeline.tag b/src/web/app/mobile/tags/home-timeline.tag index 70074ef9fe..88e26bc785 100644 --- a/src/web/app/mobile/tags/home-timeline.tag +++ b/src/web/app/mobile/tags/home-timeline.tag @@ -22,7 +22,7 @@ this.init = new Promise((res, rej) => { this.api('posts/timeline').then(posts => { res(posts); - this.trigger('loaded'); + this.$emit('loaded'); }); }); diff --git a/src/web/app/mobile/tags/home.tag b/src/web/app/mobile/tags/home.tag index a304708b3a..038322b633 100644 --- a/src/web/app/mobile/tags/home.tag +++ b/src/web/app/mobile/tags/home.tag @@ -16,7 +16,7 @@ diff --git a/src/web/app/mobile/tags/notifications.tag b/src/web/app/mobile/tags/notifications.tag index c945f6a3e1..8a1482aca2 100644 --- a/src/web/app/mobile/tags/notifications.tag +++ b/src/web/app/mobile/tags/notifications.tag @@ -106,7 +106,7 @@ notifications: notifications }); - this.trigger('fetched'); + this.$emit('fetched'); }); this.connection.on('notification', this.onNotification); diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag index 1c0282e771..a37e2bf388 100644 --- a/src/web/app/mobile/tags/post-form.tag +++ b/src/web/app/mobile/tags/post-form.tag @@ -161,7 +161,7 @@ }); this.$refs.uploader.on('change-uploads', uploads => { - this.trigger('change-uploading-files', uploads); + this.$emit('change-uploading-files', uploads); }); this.$refs.text.focus(); @@ -207,19 +207,19 @@ this.addFile = file => { file._remove = () => { this.files = this.files.filter(x => x.id != file.id); - this.trigger('change-files', this.files); + this.$emit('change-files', this.files); this.update(); }; this.files.push(file); - this.trigger('change-files', this.files); + this.$emit('change-files', this.files); this.update(); }; this.removeFile = e => { const file = e.item; this.files = this.files.filter(x => x.id != file.id); - this.trigger('change-files', this.files); + this.$emit('change-files', this.files); this.update(); }; @@ -254,7 +254,7 @@ reply_id: opts.reply ? opts.reply.id : undefined, poll: this.poll ? this.$refs.poll.get() : undefined }).then(data => { - this.trigger('post'); + this.$emit('post'); this.$destroy(); }).catch(err => { this.update({ @@ -264,7 +264,7 @@ }; this.cancel = () => { - this.trigger('cancel'); + this.$emit('cancel'); this.$destroy(); }; diff --git a/src/web/app/mobile/tags/search-posts.tag b/src/web/app/mobile/tags/search-posts.tag index 00936a8385..c650fbce5c 100644 --- a/src/web/app/mobile/tags/search-posts.tag +++ b/src/web/app/mobile/tags/search-posts.tag @@ -27,7 +27,7 @@ this.init = new Promise((res, rej) => { this.api('posts/search', parse(this.query)).then(posts => { res(posts); - this.trigger('loaded'); + this.$emit('loaded'); }); }); diff --git a/src/web/app/mobile/tags/search.tag b/src/web/app/mobile/tags/search.tag index 36f375e961..61f3093e03 100644 --- a/src/web/app/mobile/tags/search.tag +++ b/src/web/app/mobile/tags/search.tag @@ -9,7 +9,7 @@ this.on('mount', () => { this.$refs.posts.on('loaded', () => { - this.trigger('loaded'); + this.$emit('loaded'); }); }); diff --git a/src/web/app/mobile/tags/user-followers.tag b/src/web/app/mobile/tags/user-followers.tag index 02368045e0..b9101e2121 100644 --- a/src/web/app/mobile/tags/user-followers.tag +++ b/src/web/app/mobile/tags/user-followers.tag @@ -21,7 +21,7 @@ this.on('mount', () => { this.$refs.list.on('loaded', () => { - this.trigger('loaded'); + this.$emit('loaded'); }); }); diff --git a/src/web/app/mobile/tags/user-following.tag b/src/web/app/mobile/tags/user-following.tag index c0eb58b4be..5cfe60fec5 100644 --- a/src/web/app/mobile/tags/user-following.tag +++ b/src/web/app/mobile/tags/user-following.tag @@ -21,7 +21,7 @@ this.on('mount', () => { this.$refs.list.on('loaded', () => { - this.trigger('loaded'); + this.$emit('loaded'); }); }); diff --git a/src/web/app/mobile/tags/user-timeline.tag b/src/web/app/mobile/tags/user-timeline.tag index 270a3744c3..b9f5dfbd5d 100644 --- a/src/web/app/mobile/tags/user-timeline.tag +++ b/src/web/app/mobile/tags/user-timeline.tag @@ -18,7 +18,7 @@ with_media: this.withMedia }).then(posts => { res(posts); - this.trigger('loaded'); + this.$emit('loaded'); }); }); diff --git a/src/web/app/mobile/tags/user.tag b/src/web/app/mobile/tags/user.tag index 0091bafc2c..87e63471e8 100644 --- a/src/web/app/mobile/tags/user.tag +++ b/src/web/app/mobile/tags/user.tag @@ -201,7 +201,7 @@ }).then(user => { this.fetching = false; this.user = user; - this.trigger('loaded', user); + this.$emit('loaded', user); this.update(); }); }); diff --git a/src/web/app/mobile/tags/users-list.tag b/src/web/app/mobile/tags/users-list.tag index fb7040a7a0..2bc0c6e939 100644 --- a/src/web/app/mobile/tags/users-list.tag +++ b/src/web/app/mobile/tags/users-list.tag @@ -87,7 +87,7 @@ this.moreFetching = false; this.on('mount', () => { - this.fetch(() => this.trigger('loaded')); + this.fetch(() => this.$emit('loaded')); }); this.fetch = cb => { -- cgit v1.2.3-freya From a45d2b2293fd6aa35b8509d22e9b67df052341c8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 9 Feb 2018 13:20:45 +0900 Subject: wip --- src/web/app/common/-tags/activity-table.tag | 57 ++ src/web/app/common/-tags/authorized-apps.tag | 35 + src/web/app/common/-tags/ellipsis.tag | 24 + src/web/app/common/-tags/error.tag | 215 +++++ src/web/app/common/-tags/file-type-icon.tag | 10 + src/web/app/common/-tags/forkit.tag | 40 + src/web/app/common/-tags/index.ts | 30 + src/web/app/common/-tags/introduction.tag | 25 + src/web/app/common/-tags/messaging/form.tag | 175 ++++ src/web/app/common/-tags/messaging/index.tag | 456 +++++++++++ src/web/app/common/-tags/messaging/message.tag | 238 ++++++ src/web/app/common/-tags/messaging/room.tag | 319 ++++++++ src/web/app/common/-tags/nav-links.tag | 10 + src/web/app/common/-tags/number.tag | 16 + src/web/app/common/-tags/poll-editor.tag | 121 +++ src/web/app/common/-tags/post-menu.tag | 157 ++++ src/web/app/common/-tags/raw.tag | 13 + src/web/app/common/-tags/signin-history.tag | 116 +++ src/web/app/common/-tags/signin.tag | 155 ++++ src/web/app/common/-tags/signup.tag | 307 +++++++ src/web/app/common/-tags/special-message.tag | 27 + src/web/app/common/-tags/twitter-setting.tag | 62 ++ src/web/app/common/-tags/uploader.tag | 199 +++++ src/web/app/common/tags/activity-table.tag | 57 -- src/web/app/common/tags/authorized-apps.tag | 35 - src/web/app/common/tags/ellipsis.tag | 24 - src/web/app/common/tags/error.tag | 215 ----- src/web/app/common/tags/file-type-icon.tag | 10 - src/web/app/common/tags/forkit.tag | 40 - src/web/app/common/tags/index.ts | 30 - src/web/app/common/tags/introduction.tag | 25 - src/web/app/common/tags/messaging/form.tag | 175 ---- src/web/app/common/tags/messaging/index.tag | 456 ----------- src/web/app/common/tags/messaging/message.tag | 238 ------ src/web/app/common/tags/messaging/room.tag | 319 -------- src/web/app/common/tags/nav-links.tag | 10 - src/web/app/common/tags/number.tag | 16 - src/web/app/common/tags/poll-editor.tag | 121 --- src/web/app/common/tags/post-menu.tag | 157 ---- src/web/app/common/tags/raw.tag | 13 - src/web/app/common/tags/signin-history.tag | 116 --- src/web/app/common/tags/signin.tag | 155 ---- src/web/app/common/tags/signup.tag | 307 ------- src/web/app/common/tags/special-message.tag | 27 - src/web/app/common/tags/twitter-setting.tag | 62 -- src/web/app/common/tags/uploader.tag | 199 ----- src/web/app/desktop/-tags/analog-clock.tag | 95 +++ .../app/desktop/-tags/autocomplete-suggestion.tag | 197 +++++ src/web/app/desktop/-tags/big-follow-button.tag | 153 ++++ src/web/app/desktop/-tags/contextmenu.tag | 138 ++++ src/web/app/desktop/-tags/crop-window.tag | 196 +++++ src/web/app/desktop/-tags/detailed-post-window.tag | 80 ++ src/web/app/desktop/-tags/dialog.tag | 144 ++++ src/web/app/desktop/-tags/donation.tag | 66 ++ .../app/desktop/-tags/drive/base-contextmenu.tag | 44 + src/web/app/desktop/-tags/drive/browser-window.tag | 60 ++ src/web/app/desktop/-tags/drive/browser.tag | 736 +++++++++++++++++ .../app/desktop/-tags/drive/file-contextmenu.tag | 99 +++ src/web/app/desktop/-tags/drive/file.tag | 217 +++++ .../app/desktop/-tags/drive/folder-contextmenu.tag | 63 ++ src/web/app/desktop/-tags/drive/folder.tag | 202 +++++ src/web/app/desktop/-tags/drive/nav-folder.tag | 96 +++ src/web/app/desktop/-tags/ellipsis-icon.tag | 37 + src/web/app/desktop/-tags/follow-button.tag | 150 ++++ src/web/app/desktop/-tags/following-setuper.tag | 169 ++++ .../app/desktop/-tags/home-widgets/access-log.tag | 95 +++ .../app/desktop/-tags/home-widgets/activity.tag | 32 + .../app/desktop/-tags/home-widgets/broadcast.tag | 143 ++++ .../app/desktop/-tags/home-widgets/calendar.tag | 167 ++++ src/web/app/desktop/-tags/home-widgets/channel.tag | 318 ++++++++ .../app/desktop/-tags/home-widgets/donation.tag | 36 + .../app/desktop/-tags/home-widgets/mentions.tag | 125 +++ .../app/desktop/-tags/home-widgets/messaging.tag | 52 ++ src/web/app/desktop/-tags/home-widgets/nav.tag | 23 + .../desktop/-tags/home-widgets/notifications.tag | 66 ++ .../desktop/-tags/home-widgets/photo-stream.tag | 118 +++ .../app/desktop/-tags/home-widgets/post-form.tag | 103 +++ src/web/app/desktop/-tags/home-widgets/profile.tag | 116 +++ .../-tags/home-widgets/recommended-polls.tag | 119 +++ .../app/desktop/-tags/home-widgets/rss-reader.tag | 109 +++ src/web/app/desktop/-tags/home-widgets/server.tag | 533 ++++++++++++ .../app/desktop/-tags/home-widgets/slideshow.tag | 151 ++++ .../app/desktop/-tags/home-widgets/timeline.tag | 143 ++++ .../app/desktop/-tags/home-widgets/timemachine.tag | 23 + src/web/app/desktop/-tags/home-widgets/tips.tag | 94 +++ src/web/app/desktop/-tags/home-widgets/trends.tag | 125 +++ .../-tags/home-widgets/user-recommendation.tag | 165 ++++ src/web/app/desktop/-tags/home-widgets/version.tag | 20 + src/web/app/desktop/-tags/images.tag | 172 ++++ src/web/app/desktop/-tags/index.ts | 89 ++ src/web/app/desktop/-tags/input-dialog.tag | 172 ++++ src/web/app/desktop/-tags/list-user.tag | 93 +++ .../app/desktop/-tags/messaging/room-window.tag | 32 + src/web/app/desktop/-tags/messaging/window.tag | 34 + src/web/app/desktop/-tags/notifications.tag | 301 +++++++ src/web/app/desktop/-tags/pages/drive.tag | 37 + src/web/app/desktop/-tags/pages/entrance.tag | 342 ++++++++ src/web/app/desktop/-tags/pages/home-customize.tag | 12 + src/web/app/desktop/-tags/pages/home.tag | 54 ++ src/web/app/desktop/-tags/pages/messaging-room.tag | 37 + src/web/app/desktop/-tags/pages/not-found.tag | 11 + src/web/app/desktop/-tags/pages/post.tag | 58 ++ src/web/app/desktop/-tags/pages/search.tag | 20 + src/web/app/desktop/-tags/pages/selectdrive.tag | 161 ++++ src/web/app/desktop/-tags/pages/user.tag | 27 + src/web/app/desktop/-tags/post-detail-sub.tag | 149 ++++ src/web/app/desktop/-tags/post-detail.tag | 328 ++++++++ src/web/app/desktop/-tags/post-form-window.tag | 68 ++ src/web/app/desktop/-tags/post-form.tag | 540 +++++++++++++ src/web/app/desktop/-tags/post-preview.tag | 94 +++ src/web/app/desktop/-tags/progress-dialog.tag | 97 +++ src/web/app/desktop/-tags/repost-form-window.tag | 47 ++ src/web/app/desktop/-tags/repost-form.tag | 127 +++ src/web/app/desktop/-tags/search-posts.tag | 96 +++ src/web/app/desktop/-tags/search.tag | 34 + .../-tags/select-file-from-drive-window.tag | 173 ++++ .../-tags/select-folder-from-drive-window.tag | 112 +++ .../app/desktop/-tags/set-avatar-suggestion.tag | 48 ++ .../app/desktop/-tags/set-banner-suggestion.tag | 48 ++ src/web/app/desktop/-tags/settings-window.tag | 30 + src/web/app/desktop/-tags/settings.tag | 426 ++++++++++ src/web/app/desktop/-tags/sub-post-content.tag | 54 ++ src/web/app/desktop/-tags/timeline.tag | 704 ++++++++++++++++ src/web/app/desktop/-tags/ui.tag | 896 +++++++++++++++++++++ .../app/desktop/-tags/user-followers-window.tag | 19 + src/web/app/desktop/-tags/user-followers.tag | 23 + .../app/desktop/-tags/user-following-window.tag | 19 + src/web/app/desktop/-tags/user-following.tag | 23 + src/web/app/desktop/-tags/user-preview.tag | 149 ++++ src/web/app/desktop/-tags/user-timeline.tag | 150 ++++ src/web/app/desktop/-tags/user.tag | 852 ++++++++++++++++++++ src/web/app/desktop/-tags/users-list.tag | 138 ++++ src/web/app/desktop/-tags/widgets/activity.tag | 246 ++++++ src/web/app/desktop/-tags/widgets/calendar.tag | 241 ++++++ src/web/app/desktop/-tags/window.tag | 549 +++++++++++++ src/web/app/desktop/tags/analog-clock.tag | 95 --- .../app/desktop/tags/autocomplete-suggestion.tag | 197 ----- src/web/app/desktop/tags/big-follow-button.tag | 153 ---- src/web/app/desktop/tags/contextmenu.tag | 138 ---- src/web/app/desktop/tags/crop-window.tag | 196 ----- src/web/app/desktop/tags/detailed-post-window.tag | 80 -- src/web/app/desktop/tags/dialog.tag | 144 ---- src/web/app/desktop/tags/donation.tag | 66 -- .../app/desktop/tags/drive/base-contextmenu.tag | 44 - src/web/app/desktop/tags/drive/browser-window.tag | 60 -- src/web/app/desktop/tags/drive/browser.tag | 736 ----------------- .../app/desktop/tags/drive/file-contextmenu.tag | 99 --- src/web/app/desktop/tags/drive/file.tag | 217 ----- .../app/desktop/tags/drive/folder-contextmenu.tag | 63 -- src/web/app/desktop/tags/drive/folder.tag | 202 ----- src/web/app/desktop/tags/drive/nav-folder.tag | 96 --- src/web/app/desktop/tags/ellipsis-icon.tag | 37 - src/web/app/desktop/tags/follow-button.tag | 150 ---- src/web/app/desktop/tags/following-setuper.tag | 169 ---- .../app/desktop/tags/home-widgets/access-log.tag | 95 --- src/web/app/desktop/tags/home-widgets/activity.tag | 32 - .../app/desktop/tags/home-widgets/broadcast.tag | 143 ---- src/web/app/desktop/tags/home-widgets/calendar.tag | 167 ---- src/web/app/desktop/tags/home-widgets/channel.tag | 318 -------- src/web/app/desktop/tags/home-widgets/donation.tag | 36 - src/web/app/desktop/tags/home-widgets/mentions.tag | 125 --- .../app/desktop/tags/home-widgets/messaging.tag | 52 -- src/web/app/desktop/tags/home-widgets/nav.tag | 23 - .../desktop/tags/home-widgets/notifications.tag | 66 -- .../app/desktop/tags/home-widgets/photo-stream.tag | 118 --- .../app/desktop/tags/home-widgets/post-form.tag | 103 --- src/web/app/desktop/tags/home-widgets/profile.tag | 116 --- .../tags/home-widgets/recommended-polls.tag | 119 --- .../app/desktop/tags/home-widgets/rss-reader.tag | 109 --- src/web/app/desktop/tags/home-widgets/server.tag | 533 ------------ .../app/desktop/tags/home-widgets/slideshow.tag | 151 ---- src/web/app/desktop/tags/home-widgets/timeline.tag | 143 ---- .../app/desktop/tags/home-widgets/timemachine.tag | 23 - src/web/app/desktop/tags/home-widgets/tips.tag | 94 --- src/web/app/desktop/tags/home-widgets/trends.tag | 125 --- .../tags/home-widgets/user-recommendation.tag | 165 ---- src/web/app/desktop/tags/home-widgets/version.tag | 20 - src/web/app/desktop/tags/images.tag | 172 ---- src/web/app/desktop/tags/index.ts | 89 -- src/web/app/desktop/tags/input-dialog.tag | 172 ---- src/web/app/desktop/tags/list-user.tag | 93 --- src/web/app/desktop/tags/messaging/room-window.tag | 32 - src/web/app/desktop/tags/messaging/window.tag | 34 - src/web/app/desktop/tags/notifications.tag | 301 ------- src/web/app/desktop/tags/pages/drive.tag | 37 - src/web/app/desktop/tags/pages/entrance.tag | 342 -------- src/web/app/desktop/tags/pages/home-customize.tag | 12 - src/web/app/desktop/tags/pages/home.tag | 54 -- src/web/app/desktop/tags/pages/messaging-room.tag | 37 - src/web/app/desktop/tags/pages/not-found.tag | 11 - src/web/app/desktop/tags/pages/post.tag | 58 -- src/web/app/desktop/tags/pages/search.tag | 20 - src/web/app/desktop/tags/pages/selectdrive.tag | 161 ---- src/web/app/desktop/tags/pages/user.tag | 27 - src/web/app/desktop/tags/post-detail-sub.tag | 149 ---- src/web/app/desktop/tags/post-detail.tag | 328 -------- src/web/app/desktop/tags/post-form-window.tag | 68 -- src/web/app/desktop/tags/post-form.tag | 540 ------------- src/web/app/desktop/tags/post-preview.tag | 94 --- src/web/app/desktop/tags/progress-dialog.tag | 97 --- src/web/app/desktop/tags/repost-form-window.tag | 47 -- src/web/app/desktop/tags/repost-form.tag | 127 --- src/web/app/desktop/tags/search-posts.tag | 96 --- src/web/app/desktop/tags/search.tag | 34 - .../desktop/tags/select-file-from-drive-window.tag | 173 ---- .../tags/select-folder-from-drive-window.tag | 112 --- src/web/app/desktop/tags/set-avatar-suggestion.tag | 48 -- src/web/app/desktop/tags/set-banner-suggestion.tag | 48 -- src/web/app/desktop/tags/settings-window.tag | 30 - src/web/app/desktop/tags/settings.tag | 426 ---------- src/web/app/desktop/tags/sub-post-content.tag | 54 -- src/web/app/desktop/tags/timeline.tag | 704 ---------------- src/web/app/desktop/tags/ui.tag | 896 --------------------- src/web/app/desktop/tags/user-followers-window.tag | 19 - src/web/app/desktop/tags/user-followers.tag | 23 - src/web/app/desktop/tags/user-following-window.tag | 19 - src/web/app/desktop/tags/user-following.tag | 23 - src/web/app/desktop/tags/user-preview.tag | 149 ---- src/web/app/desktop/tags/user-timeline.tag | 150 ---- src/web/app/desktop/tags/user.tag | 852 -------------------- src/web/app/desktop/tags/users-list.tag | 138 ---- src/web/app/desktop/tags/widgets/activity.tag | 246 ------ src/web/app/desktop/tags/widgets/calendar.tag | 241 ------ src/web/app/desktop/tags/window.tag | 549 ------------- 224 files changed, 16757 insertions(+), 16757 deletions(-) create mode 100644 src/web/app/common/-tags/activity-table.tag create mode 100644 src/web/app/common/-tags/authorized-apps.tag create mode 100644 src/web/app/common/-tags/ellipsis.tag create mode 100644 src/web/app/common/-tags/error.tag create mode 100644 src/web/app/common/-tags/file-type-icon.tag create mode 100644 src/web/app/common/-tags/forkit.tag create mode 100644 src/web/app/common/-tags/index.ts create mode 100644 src/web/app/common/-tags/introduction.tag create mode 100644 src/web/app/common/-tags/messaging/form.tag create mode 100644 src/web/app/common/-tags/messaging/index.tag create mode 100644 src/web/app/common/-tags/messaging/message.tag create mode 100644 src/web/app/common/-tags/messaging/room.tag create mode 100644 src/web/app/common/-tags/nav-links.tag create mode 100644 src/web/app/common/-tags/number.tag create mode 100644 src/web/app/common/-tags/poll-editor.tag create mode 100644 src/web/app/common/-tags/post-menu.tag create mode 100644 src/web/app/common/-tags/raw.tag create mode 100644 src/web/app/common/-tags/signin-history.tag create mode 100644 src/web/app/common/-tags/signin.tag create mode 100644 src/web/app/common/-tags/signup.tag create mode 100644 src/web/app/common/-tags/special-message.tag create mode 100644 src/web/app/common/-tags/twitter-setting.tag create mode 100644 src/web/app/common/-tags/uploader.tag delete mode 100644 src/web/app/common/tags/activity-table.tag delete mode 100644 src/web/app/common/tags/authorized-apps.tag delete mode 100644 src/web/app/common/tags/ellipsis.tag delete mode 100644 src/web/app/common/tags/error.tag delete mode 100644 src/web/app/common/tags/file-type-icon.tag delete mode 100644 src/web/app/common/tags/forkit.tag delete mode 100644 src/web/app/common/tags/index.ts delete mode 100644 src/web/app/common/tags/introduction.tag delete mode 100644 src/web/app/common/tags/messaging/form.tag delete mode 100644 src/web/app/common/tags/messaging/index.tag delete mode 100644 src/web/app/common/tags/messaging/message.tag delete mode 100644 src/web/app/common/tags/messaging/room.tag delete mode 100644 src/web/app/common/tags/nav-links.tag delete mode 100644 src/web/app/common/tags/number.tag delete mode 100644 src/web/app/common/tags/poll-editor.tag delete mode 100644 src/web/app/common/tags/post-menu.tag delete mode 100644 src/web/app/common/tags/raw.tag delete mode 100644 src/web/app/common/tags/signin-history.tag delete mode 100644 src/web/app/common/tags/signin.tag delete mode 100644 src/web/app/common/tags/signup.tag delete mode 100644 src/web/app/common/tags/special-message.tag delete mode 100644 src/web/app/common/tags/twitter-setting.tag delete mode 100644 src/web/app/common/tags/uploader.tag create mode 100644 src/web/app/desktop/-tags/analog-clock.tag create mode 100644 src/web/app/desktop/-tags/autocomplete-suggestion.tag create mode 100644 src/web/app/desktop/-tags/big-follow-button.tag create mode 100644 src/web/app/desktop/-tags/contextmenu.tag create mode 100644 src/web/app/desktop/-tags/crop-window.tag create mode 100644 src/web/app/desktop/-tags/detailed-post-window.tag create mode 100644 src/web/app/desktop/-tags/dialog.tag create mode 100644 src/web/app/desktop/-tags/donation.tag create mode 100644 src/web/app/desktop/-tags/drive/base-contextmenu.tag create mode 100644 src/web/app/desktop/-tags/drive/browser-window.tag create mode 100644 src/web/app/desktop/-tags/drive/browser.tag create mode 100644 src/web/app/desktop/-tags/drive/file-contextmenu.tag create mode 100644 src/web/app/desktop/-tags/drive/file.tag create mode 100644 src/web/app/desktop/-tags/drive/folder-contextmenu.tag create mode 100644 src/web/app/desktop/-tags/drive/folder.tag create mode 100644 src/web/app/desktop/-tags/drive/nav-folder.tag create mode 100644 src/web/app/desktop/-tags/ellipsis-icon.tag create mode 100644 src/web/app/desktop/-tags/follow-button.tag create mode 100644 src/web/app/desktop/-tags/following-setuper.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/access-log.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/activity.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/broadcast.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/calendar.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/channel.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/donation.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/mentions.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/messaging.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/nav.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/notifications.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/photo-stream.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/post-form.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/profile.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/recommended-polls.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/rss-reader.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/server.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/slideshow.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/timeline.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/timemachine.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/tips.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/trends.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/user-recommendation.tag create mode 100644 src/web/app/desktop/-tags/home-widgets/version.tag create mode 100644 src/web/app/desktop/-tags/images.tag create mode 100644 src/web/app/desktop/-tags/index.ts create mode 100644 src/web/app/desktop/-tags/input-dialog.tag create mode 100644 src/web/app/desktop/-tags/list-user.tag create mode 100644 src/web/app/desktop/-tags/messaging/room-window.tag create mode 100644 src/web/app/desktop/-tags/messaging/window.tag create mode 100644 src/web/app/desktop/-tags/notifications.tag create mode 100644 src/web/app/desktop/-tags/pages/drive.tag create mode 100644 src/web/app/desktop/-tags/pages/entrance.tag create mode 100644 src/web/app/desktop/-tags/pages/home-customize.tag create mode 100644 src/web/app/desktop/-tags/pages/home.tag create mode 100644 src/web/app/desktop/-tags/pages/messaging-room.tag create mode 100644 src/web/app/desktop/-tags/pages/not-found.tag create mode 100644 src/web/app/desktop/-tags/pages/post.tag create mode 100644 src/web/app/desktop/-tags/pages/search.tag create mode 100644 src/web/app/desktop/-tags/pages/selectdrive.tag create mode 100644 src/web/app/desktop/-tags/pages/user.tag create mode 100644 src/web/app/desktop/-tags/post-detail-sub.tag create mode 100644 src/web/app/desktop/-tags/post-detail.tag create mode 100644 src/web/app/desktop/-tags/post-form-window.tag create mode 100644 src/web/app/desktop/-tags/post-form.tag create mode 100644 src/web/app/desktop/-tags/post-preview.tag create mode 100644 src/web/app/desktop/-tags/progress-dialog.tag create mode 100644 src/web/app/desktop/-tags/repost-form-window.tag create mode 100644 src/web/app/desktop/-tags/repost-form.tag create mode 100644 src/web/app/desktop/-tags/search-posts.tag create mode 100644 src/web/app/desktop/-tags/search.tag create mode 100644 src/web/app/desktop/-tags/select-file-from-drive-window.tag create mode 100644 src/web/app/desktop/-tags/select-folder-from-drive-window.tag create mode 100644 src/web/app/desktop/-tags/set-avatar-suggestion.tag create mode 100644 src/web/app/desktop/-tags/set-banner-suggestion.tag create mode 100644 src/web/app/desktop/-tags/settings-window.tag create mode 100644 src/web/app/desktop/-tags/settings.tag create mode 100644 src/web/app/desktop/-tags/sub-post-content.tag create mode 100644 src/web/app/desktop/-tags/timeline.tag create mode 100644 src/web/app/desktop/-tags/ui.tag create mode 100644 src/web/app/desktop/-tags/user-followers-window.tag create mode 100644 src/web/app/desktop/-tags/user-followers.tag create mode 100644 src/web/app/desktop/-tags/user-following-window.tag create mode 100644 src/web/app/desktop/-tags/user-following.tag create mode 100644 src/web/app/desktop/-tags/user-preview.tag create mode 100644 src/web/app/desktop/-tags/user-timeline.tag create mode 100644 src/web/app/desktop/-tags/user.tag create mode 100644 src/web/app/desktop/-tags/users-list.tag create mode 100644 src/web/app/desktop/-tags/widgets/activity.tag create mode 100644 src/web/app/desktop/-tags/widgets/calendar.tag create mode 100644 src/web/app/desktop/-tags/window.tag delete mode 100644 src/web/app/desktop/tags/analog-clock.tag delete mode 100644 src/web/app/desktop/tags/autocomplete-suggestion.tag delete mode 100644 src/web/app/desktop/tags/big-follow-button.tag delete mode 100644 src/web/app/desktop/tags/contextmenu.tag delete mode 100644 src/web/app/desktop/tags/crop-window.tag delete mode 100644 src/web/app/desktop/tags/detailed-post-window.tag delete mode 100644 src/web/app/desktop/tags/dialog.tag delete mode 100644 src/web/app/desktop/tags/donation.tag delete mode 100644 src/web/app/desktop/tags/drive/base-contextmenu.tag delete mode 100644 src/web/app/desktop/tags/drive/browser-window.tag delete mode 100644 src/web/app/desktop/tags/drive/browser.tag delete mode 100644 src/web/app/desktop/tags/drive/file-contextmenu.tag delete mode 100644 src/web/app/desktop/tags/drive/file.tag delete mode 100644 src/web/app/desktop/tags/drive/folder-contextmenu.tag delete mode 100644 src/web/app/desktop/tags/drive/folder.tag delete mode 100644 src/web/app/desktop/tags/drive/nav-folder.tag delete mode 100644 src/web/app/desktop/tags/ellipsis-icon.tag delete mode 100644 src/web/app/desktop/tags/follow-button.tag delete mode 100644 src/web/app/desktop/tags/following-setuper.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/access-log.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/activity.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/broadcast.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/calendar.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/channel.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/donation.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/mentions.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/messaging.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/nav.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/notifications.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/photo-stream.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/post-form.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/profile.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/recommended-polls.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/rss-reader.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/server.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/slideshow.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/timeline.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/timemachine.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/tips.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/trends.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/user-recommendation.tag delete mode 100644 src/web/app/desktop/tags/home-widgets/version.tag delete mode 100644 src/web/app/desktop/tags/images.tag delete mode 100644 src/web/app/desktop/tags/index.ts delete mode 100644 src/web/app/desktop/tags/input-dialog.tag delete mode 100644 src/web/app/desktop/tags/list-user.tag delete mode 100644 src/web/app/desktop/tags/messaging/room-window.tag delete mode 100644 src/web/app/desktop/tags/messaging/window.tag delete mode 100644 src/web/app/desktop/tags/notifications.tag delete mode 100644 src/web/app/desktop/tags/pages/drive.tag delete mode 100644 src/web/app/desktop/tags/pages/entrance.tag delete mode 100644 src/web/app/desktop/tags/pages/home-customize.tag delete mode 100644 src/web/app/desktop/tags/pages/home.tag delete mode 100644 src/web/app/desktop/tags/pages/messaging-room.tag delete mode 100644 src/web/app/desktop/tags/pages/not-found.tag delete mode 100644 src/web/app/desktop/tags/pages/post.tag delete mode 100644 src/web/app/desktop/tags/pages/search.tag delete mode 100644 src/web/app/desktop/tags/pages/selectdrive.tag delete mode 100644 src/web/app/desktop/tags/pages/user.tag delete mode 100644 src/web/app/desktop/tags/post-detail-sub.tag delete mode 100644 src/web/app/desktop/tags/post-detail.tag delete mode 100644 src/web/app/desktop/tags/post-form-window.tag delete mode 100644 src/web/app/desktop/tags/post-form.tag delete mode 100644 src/web/app/desktop/tags/post-preview.tag delete mode 100644 src/web/app/desktop/tags/progress-dialog.tag delete mode 100644 src/web/app/desktop/tags/repost-form-window.tag delete mode 100644 src/web/app/desktop/tags/repost-form.tag delete mode 100644 src/web/app/desktop/tags/search-posts.tag delete mode 100644 src/web/app/desktop/tags/search.tag delete mode 100644 src/web/app/desktop/tags/select-file-from-drive-window.tag delete mode 100644 src/web/app/desktop/tags/select-folder-from-drive-window.tag delete mode 100644 src/web/app/desktop/tags/set-avatar-suggestion.tag delete mode 100644 src/web/app/desktop/tags/set-banner-suggestion.tag delete mode 100644 src/web/app/desktop/tags/settings-window.tag delete mode 100644 src/web/app/desktop/tags/settings.tag delete mode 100644 src/web/app/desktop/tags/sub-post-content.tag delete mode 100644 src/web/app/desktop/tags/timeline.tag delete mode 100644 src/web/app/desktop/tags/ui.tag delete mode 100644 src/web/app/desktop/tags/user-followers-window.tag delete mode 100644 src/web/app/desktop/tags/user-followers.tag delete mode 100644 src/web/app/desktop/tags/user-following-window.tag delete mode 100644 src/web/app/desktop/tags/user-following.tag delete mode 100644 src/web/app/desktop/tags/user-preview.tag delete mode 100644 src/web/app/desktop/tags/user-timeline.tag delete mode 100644 src/web/app/desktop/tags/user.tag delete mode 100644 src/web/app/desktop/tags/users-list.tag delete mode 100644 src/web/app/desktop/tags/widgets/activity.tag delete mode 100644 src/web/app/desktop/tags/widgets/calendar.tag delete mode 100644 src/web/app/desktop/tags/window.tag (limited to 'src') diff --git a/src/web/app/common/-tags/activity-table.tag b/src/web/app/common/-tags/activity-table.tag new file mode 100644 index 0000000000..2f716912f3 --- /dev/null +++ b/src/web/app/common/-tags/activity-table.tag @@ -0,0 +1,57 @@ + + + + + + + + diff --git a/src/web/app/common/-tags/authorized-apps.tag b/src/web/app/common/-tags/authorized-apps.tag new file mode 100644 index 0000000000..26efa1316f --- /dev/null +++ b/src/web/app/common/-tags/authorized-apps.tag @@ -0,0 +1,35 @@ + +
    +

    %fa:info-circle%%i18n:common.tags.mk-authorized-apps.no-apps%

    +
    +
    +
    +

    { app.name }

    +

    { app.description }

    +
    +
    + + +
    diff --git a/src/web/app/common/-tags/ellipsis.tag b/src/web/app/common/-tags/ellipsis.tag new file mode 100644 index 0000000000..734454e4a0 --- /dev/null +++ b/src/web/app/common/-tags/ellipsis.tag @@ -0,0 +1,24 @@ +... + + diff --git a/src/web/app/common/-tags/error.tag b/src/web/app/common/-tags/error.tag new file mode 100644 index 0000000000..f09c0ce955 --- /dev/null +++ b/src/web/app/common/-tags/error.tag @@ -0,0 +1,215 @@ + + +

    %i18n:common.tags.mk-error.title%

    +

    { + '%i18n:common.tags.mk-error.description%'.substr(0, '%i18n:common.tags.mk-error.description%'.indexOf('{')) + }{ + '%i18n:common.tags.mk-error.description%'.match(/\{(.+?)\}/)[1] + }{ + '%i18n:common.tags.mk-error.description%'.substr('%i18n:common.tags.mk-error.description%'.indexOf('}') + 1) + }

    + + +

    %i18n:common.tags.mk-error.thanks%

    + + +
    + + +

    %fa:wrench%%i18n:common.tags.mk-error.troubleshooter.title%

    +
    +

    { network == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-network%' : '%i18n:common.tags.mk-error.troubleshooter.network%' }

    +

    { internet == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-internet%' : '%i18n:common.tags.mk-error.troubleshooter.internet%' }

    +

    { server == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-server%' : '%i18n:common.tags.mk-error.troubleshooter.server%' }

    +
    +

    %i18n:common.tags.mk-error.troubleshooter.finding%

    +

    %fa:exclamation-triangle%%i18n:common.tags.mk-error.troubleshooter.no-network%
    %i18n:common.tags.mk-error.troubleshooter.no-network-desc%

    +

    %fa:exclamation-triangle%%i18n:common.tags.mk-error.troubleshooter.no-internet%
    %i18n:common.tags.mk-error.troubleshooter.no-internet-desc%

    +

    %fa:exclamation-triangle%%i18n:common.tags.mk-error.troubleshooter.no-server%
    %i18n:common.tags.mk-error.troubleshooter.no-server-desc%

    +

    %fa:info-circle%%i18n:common.tags.mk-error.troubleshooter.success%
    %i18n:common.tags.mk-error.troubleshooter.success-desc%

    + + + +
    diff --git a/src/web/app/common/-tags/file-type-icon.tag b/src/web/app/common/-tags/file-type-icon.tag new file mode 100644 index 0000000000..f630efe118 --- /dev/null +++ b/src/web/app/common/-tags/file-type-icon.tag @@ -0,0 +1,10 @@ + + + + + diff --git a/src/web/app/common/-tags/forkit.tag b/src/web/app/common/-tags/forkit.tag new file mode 100644 index 0000000000..6a8d06e564 --- /dev/null +++ b/src/web/app/common/-tags/forkit.tag @@ -0,0 +1,40 @@ + + + + + + + + diff --git a/src/web/app/common/-tags/index.ts b/src/web/app/common/-tags/index.ts new file mode 100644 index 0000000000..df99d93cc5 --- /dev/null +++ b/src/web/app/common/-tags/index.ts @@ -0,0 +1,30 @@ +require('./error.tag'); +require('./url.tag'); +require('./url-preview.tag'); +require('./time.tag'); +require('./file-type-icon.tag'); +require('./uploader.tag'); +require('./ellipsis.tag'); +require('./raw.tag'); +require('./number.tag'); +require('./special-message.tag'); +require('./signin.tag'); +require('./signup.tag'); +require('./forkit.tag'); +require('./introduction.tag'); +require('./signin-history.tag'); +require('./twitter-setting.tag'); +require('./authorized-apps.tag'); +require('./poll.tag'); +require('./poll-editor.tag'); +require('./messaging/room.tag'); +require('./messaging/message.tag'); +require('./messaging/index.tag'); +require('./messaging/form.tag'); +require('./stream-indicator.tag'); +require('./activity-table.tag'); +require('./reaction-picker.tag'); +require('./reactions-viewer.tag'); +require('./reaction-icon.tag'); +require('./post-menu.tag'); +require('./nav-links.tag'); diff --git a/src/web/app/common/-tags/introduction.tag b/src/web/app/common/-tags/introduction.tag new file mode 100644 index 0000000000..c92cff0d1d --- /dev/null +++ b/src/web/app/common/-tags/introduction.tag @@ -0,0 +1,25 @@ + + + + diff --git a/src/web/app/common/-tags/messaging/form.tag b/src/web/app/common/-tags/messaging/form.tag new file mode 100644 index 0000000000..9a58dc0ce7 --- /dev/null +++ b/src/web/app/common/-tags/messaging/form.tag @@ -0,0 +1,175 @@ + + +
    + + + + + + + +
    diff --git a/src/web/app/common/-tags/messaging/index.tag b/src/web/app/common/-tags/messaging/index.tag new file mode 100644 index 0000000000..0432f7e30f --- /dev/null +++ b/src/web/app/common/-tags/messaging/index.tag @@ -0,0 +1,456 @@ + + +
    + +
    +

    %i18n:common.tags.mk-messaging.no-history%

    +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    + + +
    diff --git a/src/web/app/common/-tags/messaging/message.tag b/src/web/app/common/-tags/messaging/message.tag new file mode 100644 index 0000000000..ba6d26a184 --- /dev/null +++ b/src/web/app/common/-tags/messaging/message.tag @@ -0,0 +1,238 @@ + + + + +
    +
    +

    %i18n:common.tags.mk-messaging-message.is-read%

    + +
    +
    +
    image
    +
    +
    +

    %i18n:common.tags.mk-messaging-message.deleted%

    +
    +
    +
    + +
    +
    + + +
    diff --git a/src/web/app/common/-tags/messaging/room.tag b/src/web/app/common/-tags/messaging/room.tag new file mode 100644 index 0000000000..990f20a8e3 --- /dev/null +++ b/src/web/app/common/-tags/messaging/room.tag @@ -0,0 +1,319 @@ + +
    +

    %fa:spinner .spin%%i18n:common.loading%

    +

    %fa:info-circle%%i18n:common.tags.mk-messaging-room.empty%

    +

    %fa:flag%%i18n:common.tags.mk-messaging-room.no-history%

    + + +
    +
    +
    +
    + +
    + + +
    diff --git a/src/web/app/common/-tags/nav-links.tag b/src/web/app/common/-tags/nav-links.tag new file mode 100644 index 0000000000..3f2613c16d --- /dev/null +++ b/src/web/app/common/-tags/nav-links.tag @@ -0,0 +1,10 @@ + + %i18n:common.tags.mk-nav-links.about%%i18n:common.tags.mk-nav-links.stats%%i18n:common.tags.mk-nav-links.status%%i18n:common.tags.mk-nav-links.wiki%%i18n:common.tags.mk-nav-links.donors%%i18n:common.tags.mk-nav-links.repository%%i18n:common.tags.mk-nav-links.develop%Follow us on %fa:B twitter% + + + diff --git a/src/web/app/common/-tags/number.tag b/src/web/app/common/-tags/number.tag new file mode 100644 index 0000000000..9cbbacd2c7 --- /dev/null +++ b/src/web/app/common/-tags/number.tag @@ -0,0 +1,16 @@ + + + + diff --git a/src/web/app/common/-tags/poll-editor.tag b/src/web/app/common/-tags/poll-editor.tag new file mode 100644 index 0000000000..0de26f6547 --- /dev/null +++ b/src/web/app/common/-tags/poll-editor.tag @@ -0,0 +1,121 @@ + +

    + %fa:exclamation-triangle%%i18n:common.tags.mk-poll-editor.no-only-one-choice% +

    +
      +
    • + + +
    • +
    + + + + +
    diff --git a/src/web/app/common/-tags/post-menu.tag b/src/web/app/common/-tags/post-menu.tag new file mode 100644 index 0000000000..c2b362e8b5 --- /dev/null +++ b/src/web/app/common/-tags/post-menu.tag @@ -0,0 +1,157 @@ + +
    +
    + +
    + + +
    +
    + + +
    diff --git a/src/web/app/common/-tags/raw.tag b/src/web/app/common/-tags/raw.tag new file mode 100644 index 0000000000..149ac6c4bf --- /dev/null +++ b/src/web/app/common/-tags/raw.tag @@ -0,0 +1,13 @@ + + + + diff --git a/src/web/app/common/-tags/signin-history.tag b/src/web/app/common/-tags/signin-history.tag new file mode 100644 index 0000000000..57ac5ec979 --- /dev/null +++ b/src/web/app/common/-tags/signin-history.tag @@ -0,0 +1,116 @@ + +
    + +
    + + +
    + + +
    + + + { rec.ip } + +
    +
    { JSON.stringify(rec.headers, null, 2) }
    + + + + +
    diff --git a/src/web/app/common/-tags/signin.tag b/src/web/app/common/-tags/signin.tag new file mode 100644 index 0000000000..89213d1f73 --- /dev/null +++ b/src/web/app/common/-tags/signin.tag @@ -0,0 +1,155 @@ + + + + + + + + + + diff --git a/src/web/app/common/-tags/signup.tag b/src/web/app/common/-tags/signup.tag new file mode 100644 index 0000000000..99be10609b --- /dev/null +++ b/src/web/app/common/-tags/signup.tag @@ -0,0 +1,307 @@ + +
    + + + + + + +
    + + +
    diff --git a/src/web/app/common/-tags/special-message.tag b/src/web/app/common/-tags/special-message.tag new file mode 100644 index 0000000000..da903c6325 --- /dev/null +++ b/src/web/app/common/-tags/special-message.tag @@ -0,0 +1,27 @@ + +

    %i18n:common.tags.mk-special-message.new-year%

    +

    %i18n:common.tags.mk-special-message.christmas%

    + + +
    diff --git a/src/web/app/common/-tags/twitter-setting.tag b/src/web/app/common/-tags/twitter-setting.tag new file mode 100644 index 0000000000..935239f44e --- /dev/null +++ b/src/web/app/common/-tags/twitter-setting.tag @@ -0,0 +1,62 @@ + +

    %i18n:common.tags.mk-twitter-setting.description%%i18n:common.tags.mk-twitter-setting.detail%

    + +

    + { I.twitter ? '%i18n:common.tags.mk-twitter-setting.reconnect%' : '%i18n:common.tags.mk-twitter-setting.connect%' } + or + %i18n:common.tags.mk-twitter-setting.disconnect% +

    +

    Twitter ID: { I.twitter.user_id }

    + + +
    diff --git a/src/web/app/common/-tags/uploader.tag b/src/web/app/common/-tags/uploader.tag new file mode 100644 index 0000000000..519b063fac --- /dev/null +++ b/src/web/app/common/-tags/uploader.tag @@ -0,0 +1,199 @@ + +
      +
    1. +
      +

      %fa:spinner .pulse%{ name }

      +

      %i18n:common.tags.mk-uploader.waiting%{ String(Math.floor(progress.value / 1024)).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') }KB / { String(Math.floor(progress.max / 1024)).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') }KB{ Math.floor((progress.value / progress.max) * 100) }

      + +
      +
      +
    2. +
    + + +
    diff --git a/src/web/app/common/tags/activity-table.tag b/src/web/app/common/tags/activity-table.tag deleted file mode 100644 index 2f716912f3..0000000000 --- a/src/web/app/common/tags/activity-table.tag +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - diff --git a/src/web/app/common/tags/authorized-apps.tag b/src/web/app/common/tags/authorized-apps.tag deleted file mode 100644 index 26efa1316f..0000000000 --- a/src/web/app/common/tags/authorized-apps.tag +++ /dev/null @@ -1,35 +0,0 @@ - -
    -

    %fa:info-circle%%i18n:common.tags.mk-authorized-apps.no-apps%

    -
    -
    -
    -

    { app.name }

    -

    { app.description }

    -
    -
    - - -
    diff --git a/src/web/app/common/tags/ellipsis.tag b/src/web/app/common/tags/ellipsis.tag deleted file mode 100644 index 734454e4a0..0000000000 --- a/src/web/app/common/tags/ellipsis.tag +++ /dev/null @@ -1,24 +0,0 @@ -... - - diff --git a/src/web/app/common/tags/error.tag b/src/web/app/common/tags/error.tag deleted file mode 100644 index f09c0ce955..0000000000 --- a/src/web/app/common/tags/error.tag +++ /dev/null @@ -1,215 +0,0 @@ - - -

    %i18n:common.tags.mk-error.title%

    -

    { - '%i18n:common.tags.mk-error.description%'.substr(0, '%i18n:common.tags.mk-error.description%'.indexOf('{')) - }{ - '%i18n:common.tags.mk-error.description%'.match(/\{(.+?)\}/)[1] - }{ - '%i18n:common.tags.mk-error.description%'.substr('%i18n:common.tags.mk-error.description%'.indexOf('}') + 1) - }

    - - -

    %i18n:common.tags.mk-error.thanks%

    - - -
    - - -

    %fa:wrench%%i18n:common.tags.mk-error.troubleshooter.title%

    -
    -

    { network == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-network%' : '%i18n:common.tags.mk-error.troubleshooter.network%' }

    -

    { internet == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-internet%' : '%i18n:common.tags.mk-error.troubleshooter.internet%' }

    -

    { server == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-server%' : '%i18n:common.tags.mk-error.troubleshooter.server%' }

    -
    -

    %i18n:common.tags.mk-error.troubleshooter.finding%

    -

    %fa:exclamation-triangle%%i18n:common.tags.mk-error.troubleshooter.no-network%
    %i18n:common.tags.mk-error.troubleshooter.no-network-desc%

    -

    %fa:exclamation-triangle%%i18n:common.tags.mk-error.troubleshooter.no-internet%
    %i18n:common.tags.mk-error.troubleshooter.no-internet-desc%

    -

    %fa:exclamation-triangle%%i18n:common.tags.mk-error.troubleshooter.no-server%
    %i18n:common.tags.mk-error.troubleshooter.no-server-desc%

    -

    %fa:info-circle%%i18n:common.tags.mk-error.troubleshooter.success%
    %i18n:common.tags.mk-error.troubleshooter.success-desc%

    - - - -
    diff --git a/src/web/app/common/tags/file-type-icon.tag b/src/web/app/common/tags/file-type-icon.tag deleted file mode 100644 index f630efe118..0000000000 --- a/src/web/app/common/tags/file-type-icon.tag +++ /dev/null @@ -1,10 +0,0 @@ - - - - - diff --git a/src/web/app/common/tags/forkit.tag b/src/web/app/common/tags/forkit.tag deleted file mode 100644 index 6a8d06e564..0000000000 --- a/src/web/app/common/tags/forkit.tag +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - diff --git a/src/web/app/common/tags/index.ts b/src/web/app/common/tags/index.ts deleted file mode 100644 index df99d93cc5..0000000000 --- a/src/web/app/common/tags/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -require('./error.tag'); -require('./url.tag'); -require('./url-preview.tag'); -require('./time.tag'); -require('./file-type-icon.tag'); -require('./uploader.tag'); -require('./ellipsis.tag'); -require('./raw.tag'); -require('./number.tag'); -require('./special-message.tag'); -require('./signin.tag'); -require('./signup.tag'); -require('./forkit.tag'); -require('./introduction.tag'); -require('./signin-history.tag'); -require('./twitter-setting.tag'); -require('./authorized-apps.tag'); -require('./poll.tag'); -require('./poll-editor.tag'); -require('./messaging/room.tag'); -require('./messaging/message.tag'); -require('./messaging/index.tag'); -require('./messaging/form.tag'); -require('./stream-indicator.tag'); -require('./activity-table.tag'); -require('./reaction-picker.tag'); -require('./reactions-viewer.tag'); -require('./reaction-icon.tag'); -require('./post-menu.tag'); -require('./nav-links.tag'); diff --git a/src/web/app/common/tags/introduction.tag b/src/web/app/common/tags/introduction.tag deleted file mode 100644 index c92cff0d1d..0000000000 --- a/src/web/app/common/tags/introduction.tag +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/src/web/app/common/tags/messaging/form.tag b/src/web/app/common/tags/messaging/form.tag deleted file mode 100644 index 9a58dc0ce7..0000000000 --- a/src/web/app/common/tags/messaging/form.tag +++ /dev/null @@ -1,175 +0,0 @@ - - -
    - - - - - - - -
    diff --git a/src/web/app/common/tags/messaging/index.tag b/src/web/app/common/tags/messaging/index.tag deleted file mode 100644 index 0432f7e30f..0000000000 --- a/src/web/app/common/tags/messaging/index.tag +++ /dev/null @@ -1,456 +0,0 @@ - - -
    - -
    -

    %i18n:common.tags.mk-messaging.no-history%

    -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    - - -
    diff --git a/src/web/app/common/tags/messaging/message.tag b/src/web/app/common/tags/messaging/message.tag deleted file mode 100644 index ba6d26a184..0000000000 --- a/src/web/app/common/tags/messaging/message.tag +++ /dev/null @@ -1,238 +0,0 @@ - - - - -
    -
    -

    %i18n:common.tags.mk-messaging-message.is-read%

    - -
    -
    -
    image
    -
    -
    -

    %i18n:common.tags.mk-messaging-message.deleted%

    -
    -
    -
    - -
    -
    - - -
    diff --git a/src/web/app/common/tags/messaging/room.tag b/src/web/app/common/tags/messaging/room.tag deleted file mode 100644 index 990f20a8e3..0000000000 --- a/src/web/app/common/tags/messaging/room.tag +++ /dev/null @@ -1,319 +0,0 @@ - -
    -

    %fa:spinner .spin%%i18n:common.loading%

    -

    %fa:info-circle%%i18n:common.tags.mk-messaging-room.empty%

    -

    %fa:flag%%i18n:common.tags.mk-messaging-room.no-history%

    - - -
    -
    -
    -
    - -
    - - -
    diff --git a/src/web/app/common/tags/nav-links.tag b/src/web/app/common/tags/nav-links.tag deleted file mode 100644 index 3f2613c16d..0000000000 --- a/src/web/app/common/tags/nav-links.tag +++ /dev/null @@ -1,10 +0,0 @@ - - %i18n:common.tags.mk-nav-links.about%%i18n:common.tags.mk-nav-links.stats%%i18n:common.tags.mk-nav-links.status%%i18n:common.tags.mk-nav-links.wiki%%i18n:common.tags.mk-nav-links.donors%%i18n:common.tags.mk-nav-links.repository%%i18n:common.tags.mk-nav-links.develop%Follow us on %fa:B twitter% - - - diff --git a/src/web/app/common/tags/number.tag b/src/web/app/common/tags/number.tag deleted file mode 100644 index 9cbbacd2c7..0000000000 --- a/src/web/app/common/tags/number.tag +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/src/web/app/common/tags/poll-editor.tag b/src/web/app/common/tags/poll-editor.tag deleted file mode 100644 index 0de26f6547..0000000000 --- a/src/web/app/common/tags/poll-editor.tag +++ /dev/null @@ -1,121 +0,0 @@ - -

    - %fa:exclamation-triangle%%i18n:common.tags.mk-poll-editor.no-only-one-choice% -

    -
      -
    • - - -
    • -
    - - - - -
    diff --git a/src/web/app/common/tags/post-menu.tag b/src/web/app/common/tags/post-menu.tag deleted file mode 100644 index c2b362e8b5..0000000000 --- a/src/web/app/common/tags/post-menu.tag +++ /dev/null @@ -1,157 +0,0 @@ - -
    -
    - -
    - - -
    -
    - - -
    diff --git a/src/web/app/common/tags/raw.tag b/src/web/app/common/tags/raw.tag deleted file mode 100644 index 149ac6c4bf..0000000000 --- a/src/web/app/common/tags/raw.tag +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/src/web/app/common/tags/signin-history.tag b/src/web/app/common/tags/signin-history.tag deleted file mode 100644 index 57ac5ec979..0000000000 --- a/src/web/app/common/tags/signin-history.tag +++ /dev/null @@ -1,116 +0,0 @@ - -
    - -
    - - -
    - - -
    - - - { rec.ip } - -
    -
    { JSON.stringify(rec.headers, null, 2) }
    - - - - -
    diff --git a/src/web/app/common/tags/signin.tag b/src/web/app/common/tags/signin.tag deleted file mode 100644 index 89213d1f73..0000000000 --- a/src/web/app/common/tags/signin.tag +++ /dev/null @@ -1,155 +0,0 @@ - -
    - - - - -
    - - -
    diff --git a/src/web/app/common/tags/signup.tag b/src/web/app/common/tags/signup.tag deleted file mode 100644 index 99be10609b..0000000000 --- a/src/web/app/common/tags/signup.tag +++ /dev/null @@ -1,307 +0,0 @@ - -
    - - - - - - -
    - - -
    diff --git a/src/web/app/common/tags/special-message.tag b/src/web/app/common/tags/special-message.tag deleted file mode 100644 index da903c6325..0000000000 --- a/src/web/app/common/tags/special-message.tag +++ /dev/null @@ -1,27 +0,0 @@ - -

    %i18n:common.tags.mk-special-message.new-year%

    -

    %i18n:common.tags.mk-special-message.christmas%

    - - -
    diff --git a/src/web/app/common/tags/twitter-setting.tag b/src/web/app/common/tags/twitter-setting.tag deleted file mode 100644 index 935239f44e..0000000000 --- a/src/web/app/common/tags/twitter-setting.tag +++ /dev/null @@ -1,62 +0,0 @@ - -

    %i18n:common.tags.mk-twitter-setting.description%%i18n:common.tags.mk-twitter-setting.detail%

    - -

    - { I.twitter ? '%i18n:common.tags.mk-twitter-setting.reconnect%' : '%i18n:common.tags.mk-twitter-setting.connect%' } - or - %i18n:common.tags.mk-twitter-setting.disconnect% -

    -

    Twitter ID: { I.twitter.user_id }

    - - -
    diff --git a/src/web/app/common/tags/uploader.tag b/src/web/app/common/tags/uploader.tag deleted file mode 100644 index 519b063fac..0000000000 --- a/src/web/app/common/tags/uploader.tag +++ /dev/null @@ -1,199 +0,0 @@ - -
      -
    1. -
      -

      %fa:spinner .pulse%{ name }

      -

      %i18n:common.tags.mk-uploader.waiting%{ String(Math.floor(progress.value / 1024)).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') }KB / { String(Math.floor(progress.max / 1024)).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') }KB{ Math.floor((progress.value / progress.max) * 100) }

      - -
      -
      -
    2. -
    - - -
    diff --git a/src/web/app/desktop/-tags/analog-clock.tag b/src/web/app/desktop/-tags/analog-clock.tag new file mode 100644 index 0000000000..6b2bce3b2c --- /dev/null +++ b/src/web/app/desktop/-tags/analog-clock.tag @@ -0,0 +1,95 @@ + + + + + diff --git a/src/web/app/desktop/-tags/autocomplete-suggestion.tag b/src/web/app/desktop/-tags/autocomplete-suggestion.tag new file mode 100644 index 0000000000..a0215666c0 --- /dev/null +++ b/src/web/app/desktop/-tags/autocomplete-suggestion.tag @@ -0,0 +1,197 @@ + +
      +
    1. + + { name } + @{ username } +
    2. +
    + + +
    diff --git a/src/web/app/desktop/-tags/big-follow-button.tag b/src/web/app/desktop/-tags/big-follow-button.tag new file mode 100644 index 0000000000..5ea09fdfc8 --- /dev/null +++ b/src/web/app/desktop/-tags/big-follow-button.tag @@ -0,0 +1,153 @@ + + +
    %fa:spinner .pulse .fw%
    + + +
    diff --git a/src/web/app/desktop/-tags/contextmenu.tag b/src/web/app/desktop/-tags/contextmenu.tag new file mode 100644 index 0000000000..ee4c48fbde --- /dev/null +++ b/src/web/app/desktop/-tags/contextmenu.tag @@ -0,0 +1,138 @@ + + + + + diff --git a/src/web/app/desktop/-tags/crop-window.tag b/src/web/app/desktop/-tags/crop-window.tag new file mode 100644 index 0000000000..c26f74b121 --- /dev/null +++ b/src/web/app/desktop/-tags/crop-window.tag @@ -0,0 +1,196 @@ + + + %fa:crop%{ parent.title } + +
    +
    + + + +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/detailed-post-window.tag b/src/web/app/desktop/-tags/detailed-post-window.tag new file mode 100644 index 0000000000..57e390d50d --- /dev/null +++ b/src/web/app/desktop/-tags/detailed-post-window.tag @@ -0,0 +1,80 @@ + +
    +
    + +
    + + +
    diff --git a/src/web/app/desktop/-tags/dialog.tag b/src/web/app/desktop/-tags/dialog.tag new file mode 100644 index 0000000000..ba2fa514d1 --- /dev/null +++ b/src/web/app/desktop/-tags/dialog.tag @@ -0,0 +1,144 @@ + +
    +
    +
    +
    +
    + +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/donation.tag b/src/web/app/desktop/-tags/donation.tag new file mode 100644 index 0000000000..fe446f2e61 --- /dev/null +++ b/src/web/app/desktop/-tags/donation.tag @@ -0,0 +1,66 @@ + + +
    +

    利用者の皆さま、

    +

    + 今日は、日本の皆さまにお知らせがあります。 + Misskeyの援助をお願いいたします。 + 私は独立性を守るため、一切の広告を掲載いたしません。 + 平均で約¥1,500の寄付をいただき、運営しております。 + 援助をしてくださる利用者はほんの少数です。 + お願いいたします。 + 今日、利用者の皆さまが¥300ご援助くだされば、募金活動を一時間で終了することができます。 + コーヒー1杯ほどの金額です。 + Misskeyを活用しておられるのでしたら、広告を掲載せずにもう1年活動できるよう、どうか1分だけお時間をください。 + 私は小さな非営利個人ですが、サーバー、プログラム、人件費など、世界でトップクラスのウェブサイト同等のコストがかかります。 + 利用者は何億人といますが、他の大きなサイトに比べてほんの少額の費用で運営しているのです。 + 人間の可能性、自由、そして機会。知識こそ、これらの基盤を成すものです。 + 私は、誰もが無料かつ制限なく知識に触れられるべきだと信じています。 + 募金活動を終了し、Misskeyの改善に戻れるようご援助ください。 + よろしくお願いいたします。 +

    +
    + + +
    diff --git a/src/web/app/desktop/-tags/drive/base-contextmenu.tag b/src/web/app/desktop/-tags/drive/base-contextmenu.tag new file mode 100644 index 0000000000..c93d630263 --- /dev/null +++ b/src/web/app/desktop/-tags/drive/base-contextmenu.tag @@ -0,0 +1,44 @@ + + +
      +
    • +

      %fa:R folder%%i18n:desktop.tags.mk-drive-browser-base-contextmenu.create-folder%

      +
    • +
    • +

      %fa:upload%%i18n:desktop.tags.mk-drive-browser-base-contextmenu.upload%

      +
    • +
    • +

      %fa:cloud-upload-alt%%i18n:desktop.tags.mk-drive-browser-base-contextmenu.url-upload%

      +
    • +
    +
    + +
    diff --git a/src/web/app/desktop/-tags/drive/browser-window.tag b/src/web/app/desktop/-tags/drive/browser-window.tag new file mode 100644 index 0000000000..db7b898341 --- /dev/null +++ b/src/web/app/desktop/-tags/drive/browser-window.tag @@ -0,0 +1,60 @@ + + + +

    { parent.usage.toFixed(1) }% %i18n:desktop.tags.mk-drive-browser-window.used%

    + %fa:cloud%%i18n:desktop.tags.mk-drive-browser-window.drive% +
    + + + +
    + + +
    diff --git a/src/web/app/desktop/-tags/drive/browser.tag b/src/web/app/desktop/-tags/drive/browser.tag new file mode 100644 index 0000000000..7aaedab822 --- /dev/null +++ b/src/web/app/desktop/-tags/drive/browser.tag @@ -0,0 +1,736 @@ + + +
    +
    +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    +

    %i18n:desktop.tags.mk-drive-browser.empty-draghover%

    +

    %i18n:desktop.tags.mk-drive-browser.empty-drive%
    %i18n:desktop.tags.mk-drive-browser.empty-drive-description%

    +

    %i18n:desktop.tags.mk-drive-browser.empty-folder%

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + +
    diff --git a/src/web/app/desktop/-tags/drive/file-contextmenu.tag b/src/web/app/desktop/-tags/drive/file-contextmenu.tag new file mode 100644 index 0000000000..125f70b614 --- /dev/null +++ b/src/web/app/desktop/-tags/drive/file-contextmenu.tag @@ -0,0 +1,99 @@ + + +
      +
    • +

      %fa:i-cursor%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.rename%

      +
    • +
    • +

      %fa:link%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.copy-url%

      +
    • +
    • %fa:download%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.download%
    • +
    • +
    • +

      %fa:R trash-alt%%i18n:common.delete%

      +
    • +
    • +
    • +

      %i18n:desktop.tags.mk-drive-browser-file-contextmenu.else-files%%fa:caret-right%

      +
        +
      • +

        %i18n:desktop.tags.mk-drive-browser-file-contextmenu.set-as-avatar%

        +
      • +
      • +

        %i18n:desktop.tags.mk-drive-browser-file-contextmenu.set-as-banner%

        +
      • +
      +
    • +
    • +

      %i18n:desktop.tags.mk-drive-browser-file-contextmenu.open-in-app%...%fa:caret-right%

      +
        +
      • +

        %i18n:desktop.tags.mk-drive-browser-file-contextmenu.add-app%...

        +
      • +
      +
    • +
    +
    + +
    diff --git a/src/web/app/desktop/-tags/drive/file.tag b/src/web/app/desktop/-tags/drive/file.tag new file mode 100644 index 0000000000..a669f5fff4 --- /dev/null +++ b/src/web/app/desktop/-tags/drive/file.tag @@ -0,0 +1,217 @@ + +
    +

    %i18n:desktop.tags.mk-drive-browser-file.avatar%

    +
    +
    +

    %i18n:desktop.tags.mk-drive-browser-file.banner%

    +
    +
    + +
    +

    { file.name.lastIndexOf('.') != -1 ? file.name.substr(0, file.name.lastIndexOf('.')) : file.name }{ file.name.substr(file.name.lastIndexOf('.')) }

    + + +
    diff --git a/src/web/app/desktop/-tags/drive/folder-contextmenu.tag b/src/web/app/desktop/-tags/drive/folder-contextmenu.tag new file mode 100644 index 0000000000..0cb7f6eb80 --- /dev/null +++ b/src/web/app/desktop/-tags/drive/folder-contextmenu.tag @@ -0,0 +1,63 @@ + + +
      +
    • +

      %fa:arrow-right%%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.move-to-this-folder%

      +
    • +
    • +

      %fa:R window-restore%%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.show-in-new-window%

      +
    • +
    • +
    • +

      %fa:i-cursor%%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.rename%

      +
    • +
    • +
    • +

      %fa:R trash-alt%%i18n:common.delete%

      +
    • +
    +
    + +
    diff --git a/src/web/app/desktop/-tags/drive/folder.tag b/src/web/app/desktop/-tags/drive/folder.tag new file mode 100644 index 0000000000..ed16bfb0d7 --- /dev/null +++ b/src/web/app/desktop/-tags/drive/folder.tag @@ -0,0 +1,202 @@ + +

    { folder.name }

    + + +
    diff --git a/src/web/app/desktop/-tags/drive/nav-folder.tag b/src/web/app/desktop/-tags/drive/nav-folder.tag new file mode 100644 index 0000000000..4bca80f683 --- /dev/null +++ b/src/web/app/desktop/-tags/drive/nav-folder.tag @@ -0,0 +1,96 @@ + + { folder == null ? '%i18n:desktop.tags.mk-drive-browser-nav-folder.drive%' : folder.name } + + + diff --git a/src/web/app/desktop/-tags/ellipsis-icon.tag b/src/web/app/desktop/-tags/ellipsis-icon.tag new file mode 100644 index 0000000000..619f0d84f7 --- /dev/null +++ b/src/web/app/desktop/-tags/ellipsis-icon.tag @@ -0,0 +1,37 @@ + +
    +
    +
    + +
    diff --git a/src/web/app/desktop/-tags/follow-button.tag b/src/web/app/desktop/-tags/follow-button.tag new file mode 100644 index 0000000000..fa7d43e039 --- /dev/null +++ b/src/web/app/desktop/-tags/follow-button.tag @@ -0,0 +1,150 @@ + + +
    %fa:spinner .pulse .fw%
    + + +
    diff --git a/src/web/app/desktop/-tags/following-setuper.tag b/src/web/app/desktop/-tags/following-setuper.tag new file mode 100644 index 0000000000..75ce76ae53 --- /dev/null +++ b/src/web/app/desktop/-tags/following-setuper.tag @@ -0,0 +1,169 @@ + +

    気になるユーザーをフォロー:

    +
    +
    +
    { name } +

    @{ username }

    +
    + +
    +
    +

    おすすめのユーザーは見つかりませんでした。

    +

    %fa:spinner .pulse .fw%読み込んでいます

    + もっと見る + + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/access-log.tag b/src/web/app/desktop/-tags/home-widgets/access-log.tag new file mode 100644 index 0000000000..fea18299e8 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/access-log.tag @@ -0,0 +1,95 @@ + + +
    +

    + { ip } + { method } + { path } +

    +
    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/activity.tag b/src/web/app/desktop/-tags/home-widgets/activity.tag new file mode 100644 index 0000000000..878de6d13a --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/activity.tag @@ -0,0 +1,32 @@ + + + + + diff --git a/src/web/app/desktop/-tags/home-widgets/broadcast.tag b/src/web/app/desktop/-tags/home-widgets/broadcast.tag new file mode 100644 index 0000000000..91ddbb4ab4 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/broadcast.tag @@ -0,0 +1,143 @@ + +
    + + + + + + + +
    +

    %i18n:desktop.tags.mk-broadcast-home-widget.fetching%

    +

    { + broadcasts.length == 0 ? '%i18n:desktop.tags.mk-broadcast-home-widget.no-broadcasts%' : broadcasts[i].title + }

    +

    + %i18n:desktop.tags.mk-broadcast-home-widget.next% >> + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/calendar.tag b/src/web/app/desktop/-tags/home-widgets/calendar.tag new file mode 100644 index 0000000000..46d47662b9 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/calendar.tag @@ -0,0 +1,167 @@ + +
    +

    { year }年{ month }月

    +

    { day }日

    +

    { weekDay }曜日

    +
    +
    +
    +

    今日:{ dayP.toFixed(1) }%

    +
    +
    +
    +
    +
    +

    今月:{ monthP.toFixed(1) }%

    +
    +
    +
    +
    +
    +

    今年:{ yearP.toFixed(1) }%

    +
    +
    +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/channel.tag b/src/web/app/desktop/-tags/home-widgets/channel.tag new file mode 100644 index 0000000000..98bf6bf7ec --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/channel.tag @@ -0,0 +1,318 @@ + + +

    %i18n:desktop.tags.mk-channel-home-widget.get-started%

    + + + +
    + + +

    読み込み中

    +
    +

    まだ投稿がありません

    + +
    + + + +
    + + +
    + { post.index }: + { post.user.name } + ID:{ post.user.username } +
    +
    + >>{ post.reply.index } + { post.text } +
    + +
    +
    + + +
    + + + + + + diff --git a/src/web/app/desktop/-tags/home-widgets/donation.tag b/src/web/app/desktop/-tags/home-widgets/donation.tag new file mode 100644 index 0000000000..5ed5c137b5 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/donation.tag @@ -0,0 +1,36 @@ + +
    +

    %fa:heart%%i18n:desktop.tags.mk-donation-home-widget.title%

    +

    {'%i18n:desktop.tags.mk-donation-home-widget.text%'.substr(0, '%i18n:desktop.tags.mk-donation-home-widget.text%'.indexOf('{'))}@syuilo{'%i18n:desktop.tags.mk-donation-home-widget.text%'.substr('%i18n:desktop.tags.mk-donation-home-widget.text%'.indexOf('}') + 1)}

    +
    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/mentions.tag b/src/web/app/desktop/-tags/home-widgets/mentions.tag new file mode 100644 index 0000000000..81f9b2875e --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/mentions.tag @@ -0,0 +1,125 @@ + +
    すべてフォロー中
    +
    + +
    +

    %fa:R comments%あなた宛ての投稿はありません。あなたがフォローしているユーザーからの言及はありません。

    + + + + + + + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/messaging.tag b/src/web/app/desktop/-tags/home-widgets/messaging.tag new file mode 100644 index 0000000000..d3b77b58cc --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/messaging.tag @@ -0,0 +1,52 @@ + + + + + + diff --git a/src/web/app/desktop/-tags/home-widgets/nav.tag b/src/web/app/desktop/-tags/home-widgets/nav.tag new file mode 100644 index 0000000000..890fb4d8f7 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/nav.tag @@ -0,0 +1,23 @@ + + + + + diff --git a/src/web/app/desktop/-tags/home-widgets/notifications.tag b/src/web/app/desktop/-tags/home-widgets/notifications.tag new file mode 100644 index 0000000000..bd915b197b --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/notifications.tag @@ -0,0 +1,66 @@ + + + + + + diff --git a/src/web/app/desktop/-tags/home-widgets/photo-stream.tag b/src/web/app/desktop/-tags/home-widgets/photo-stream.tag new file mode 100644 index 0000000000..a2d95dede3 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/photo-stream.tag @@ -0,0 +1,118 @@ + + +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    +
    + +
    +

    %i18n:desktop.tags.mk-photo-stream-home-widget.no-photos%

    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/post-form.tag b/src/web/app/desktop/-tags/home-widgets/post-form.tag new file mode 100644 index 0000000000..d5824477b9 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/post-form.tag @@ -0,0 +1,103 @@ + + + + + + diff --git a/src/web/app/desktop/-tags/home-widgets/profile.tag b/src/web/app/desktop/-tags/home-widgets/profile.tag new file mode 100644 index 0000000000..02a1f0d5a3 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/profile.tag @@ -0,0 +1,116 @@ + + + avatar + { I.name } +

    @{ I.username }

    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/recommended-polls.tag b/src/web/app/desktop/-tags/home-widgets/recommended-polls.tag new file mode 100644 index 0000000000..cfbcd1e929 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/recommended-polls.tag @@ -0,0 +1,119 @@ + + + +

    %i18n:desktop.tags.mk-recommended-polls-home-widget.nothing%

    +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/rss-reader.tag b/src/web/app/desktop/-tags/home-widgets/rss-reader.tag new file mode 100644 index 0000000000..4e0ed702e2 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/rss-reader.tag @@ -0,0 +1,109 @@ + + +
    + +
    +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/server.tag b/src/web/app/desktop/-tags/home-widgets/server.tag new file mode 100644 index 0000000000..992517163a --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/server.tag @@ -0,0 +1,533 @@ + + +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    + + + + + + + + +
    + + + + + + + + + + + + + + + + + CPU { cpuP }% + + + + + + + + + + + + + + + + MEM { memP }% + + + + + + + +
    +

    %fa:microchip%CPU

    +

    { cores } Cores

    +

    { model }

    +
    + + +
    + + + +
    +

    %fa:flask%Memory

    +

    Total: { bytesToSize(total, 1) }

    +

    Used: { bytesToSize(used, 1) }

    +

    Free: { bytesToSize(free, 1) }

    +
    + + +
    + + + +
    +

    %fa:R hdd%Storage

    +

    Total: { bytesToSize(total, 1) }

    +

    Available: { bytesToSize(available, 1) }

    +

    Used: { bytesToSize(used, 1) }

    +
    + + +
    + + +

    Uptimes

    +

    Process: { process ? process.toFixed(0) : '---' }s

    +

    OS: { os ? os.toFixed(0) : '---' }s

    + + +
    + + +

    Maintainer: { meta.maintainer }

    +

    Machine: { meta.machine }

    +

    Node: { meta.node }

    + + +
    + + + + + + { (p * 100).toFixed(0) }% + + + + diff --git a/src/web/app/desktop/-tags/home-widgets/slideshow.tag b/src/web/app/desktop/-tags/home-widgets/slideshow.tag new file mode 100644 index 0000000000..817b138d31 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/slideshow.tag @@ -0,0 +1,151 @@ + +
    +

    クリックしてフォルダを指定してください

    +

    このフォルダには画像がありません

    +
    +
    +
    + + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/timeline.tag b/src/web/app/desktop/-tags/home-widgets/timeline.tag new file mode 100644 index 0000000000..4668ebfa87 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/timeline.tag @@ -0,0 +1,143 @@ + + +
    + +
    +

    %fa:R comments%自分の投稿や、自分がフォローしているユーザーの投稿が表示されます。

    + + + + + + + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/timemachine.tag b/src/web/app/desktop/-tags/home-widgets/timemachine.tag new file mode 100644 index 0000000000..43f59fe674 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/timemachine.tag @@ -0,0 +1,23 @@ + + + + + diff --git a/src/web/app/desktop/-tags/home-widgets/tips.tag b/src/web/app/desktop/-tags/home-widgets/tips.tag new file mode 100644 index 0000000000..a352253cef --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/tips.tag @@ -0,0 +1,94 @@ + +

    %fa:R lightbulb%

    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/trends.tag b/src/web/app/desktop/-tags/home-widgets/trends.tag new file mode 100644 index 0000000000..5e297ebc7b --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/trends.tag @@ -0,0 +1,125 @@ + + +
    +

    { post.text }

    +

    @{ post.user.username }

    +
    +

    %i18n:desktop.tags.mk-trends-home-widget.nothing%

    +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/user-recommendation.tag b/src/web/app/desktop/-tags/home-widgets/user-recommendation.tag new file mode 100644 index 0000000000..5344da1f2b --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/user-recommendation.tag @@ -0,0 +1,165 @@ + + +
    + + + +
    + { _user.name } +

    @{ _user.username }

    +
    + +
    +

    %i18n:desktop.tags.mk-user-recommendation-home-widget.no-one%

    +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    + + +
    diff --git a/src/web/app/desktop/-tags/home-widgets/version.tag b/src/web/app/desktop/-tags/home-widgets/version.tag new file mode 100644 index 0000000000..6dd8ad6444 --- /dev/null +++ b/src/web/app/desktop/-tags/home-widgets/version.tag @@ -0,0 +1,20 @@ + +

    ver { _VERSION_ } (葵 aoi)

    + + +
    diff --git a/src/web/app/desktop/-tags/images.tag b/src/web/app/desktop/-tags/images.tag new file mode 100644 index 0000000000..1094e0d968 --- /dev/null +++ b/src/web/app/desktop/-tags/images.tag @@ -0,0 +1,172 @@ + + + + + + + + + + + + + +
    { + + +
    diff --git a/src/web/app/desktop/-tags/index.ts b/src/web/app/desktop/-tags/index.ts new file mode 100644 index 0000000000..4edda83534 --- /dev/null +++ b/src/web/app/desktop/-tags/index.ts @@ -0,0 +1,89 @@ +require('./contextmenu.tag'); +require('./dialog.tag'); +require('./window.tag'); +require('./input-dialog.tag'); +require('./follow-button.tag'); +require('./drive/base-contextmenu.tag'); +require('./drive/file-contextmenu.tag'); +require('./drive/folder-contextmenu.tag'); +require('./drive/file.tag'); +require('./drive/folder.tag'); +require('./drive/nav-folder.tag'); +require('./drive/browser-window.tag'); +require('./drive/browser.tag'); +require('./select-file-from-drive-window.tag'); +require('./select-folder-from-drive-window.tag'); +require('./crop-window.tag'); +require('./settings.tag'); +require('./settings-window.tag'); +require('./analog-clock.tag'); +require('./notifications.tag'); +require('./post-form-window.tag'); +require('./post-form.tag'); +require('./post-preview.tag'); +require('./repost-form-window.tag'); +require('./home-widgets/user-recommendation.tag'); +require('./home-widgets/timeline.tag'); +require('./home-widgets/mentions.tag'); +require('./home-widgets/calendar.tag'); +require('./home-widgets/donation.tag'); +require('./home-widgets/tips.tag'); +require('./home-widgets/nav.tag'); +require('./home-widgets/profile.tag'); +require('./home-widgets/notifications.tag'); +require('./home-widgets/rss-reader.tag'); +require('./home-widgets/photo-stream.tag'); +require('./home-widgets/broadcast.tag'); +require('./home-widgets/version.tag'); +require('./home-widgets/recommended-polls.tag'); +require('./home-widgets/trends.tag'); +require('./home-widgets/activity.tag'); +require('./home-widgets/server.tag'); +require('./home-widgets/slideshow.tag'); +require('./home-widgets/channel.tag'); +require('./home-widgets/timemachine.tag'); +require('./home-widgets/post-form.tag'); +require('./home-widgets/access-log.tag'); +require('./home-widgets/messaging.tag'); +require('./timeline.tag'); +require('./messaging/window.tag'); +require('./messaging/room-window.tag'); +require('./following-setuper.tag'); +require('./ellipsis-icon.tag'); +require('./ui.tag'); +require('./home.tag'); +require('./user-timeline.tag'); +require('./user.tag'); +require('./big-follow-button.tag'); +require('./pages/entrance.tag'); +require('./pages/home.tag'); +require('./pages/home-customize.tag'); +require('./pages/user.tag'); +require('./pages/post.tag'); +require('./pages/search.tag'); +require('./pages/not-found.tag'); +require('./pages/selectdrive.tag'); +require('./pages/drive.tag'); +require('./pages/messaging-room.tag'); +require('./autocomplete-suggestion.tag'); +require('./progress-dialog.tag'); +require('./user-preview.tag'); +require('./post-detail.tag'); +require('./post-detail-sub.tag'); +require('./search.tag'); +require('./search-posts.tag'); +require('./set-avatar-suggestion.tag'); +require('./set-banner-suggestion.tag'); +require('./repost-form.tag'); +require('./sub-post-content.tag'); +require('./images.tag'); +require('./donation.tag'); +require('./users-list.tag'); +require('./user-following.tag'); +require('./user-followers.tag'); +require('./user-following-window.tag'); +require('./user-followers-window.tag'); +require('./list-user.tag'); +require('./detailed-post-window.tag'); +require('./widgets/calendar.tag'); +require('./widgets/activity.tag'); diff --git a/src/web/app/desktop/-tags/input-dialog.tag b/src/web/app/desktop/-tags/input-dialog.tag new file mode 100644 index 0000000000..a1634429cf --- /dev/null +++ b/src/web/app/desktop/-tags/input-dialog.tag @@ -0,0 +1,172 @@ + + + + %fa:i-cursor%{ parent.title } + + +
    + +
    +
    + + +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/list-user.tag b/src/web/app/desktop/-tags/list-user.tag new file mode 100644 index 0000000000..bde90b1cc6 --- /dev/null +++ b/src/web/app/desktop/-tags/list-user.tag @@ -0,0 +1,93 @@ + + + avatar + +
    +
    + { user.name } + @{ user.username } +
    +
    +

    フォローされています

    +
    { user.description }
    +
    +
    + + + +
    diff --git a/src/web/app/desktop/-tags/messaging/room-window.tag b/src/web/app/desktop/-tags/messaging/room-window.tag new file mode 100644 index 0000000000..ca11873644 --- /dev/null +++ b/src/web/app/desktop/-tags/messaging/room-window.tag @@ -0,0 +1,32 @@ + + + %fa:comments%メッセージ: { parent.user.name } + + + + + + + diff --git a/src/web/app/desktop/-tags/messaging/window.tag b/src/web/app/desktop/-tags/messaging/window.tag new file mode 100644 index 0000000000..e078bccad7 --- /dev/null +++ b/src/web/app/desktop/-tags/messaging/window.tag @@ -0,0 +1,34 @@ + + + %fa:comments%メッセージ + + + + + + + diff --git a/src/web/app/desktop/-tags/notifications.tag b/src/web/app/desktop/-tags/notifications.tag new file mode 100644 index 0000000000..a599e5d6a5 --- /dev/null +++ b/src/web/app/desktop/-tags/notifications.tag @@ -0,0 +1,301 @@ + +
    + +
    + +

    ありません!

    +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    + + +
    diff --git a/src/web/app/desktop/-tags/pages/drive.tag b/src/web/app/desktop/-tags/pages/drive.tag new file mode 100644 index 0000000000..f4e2a3740a --- /dev/null +++ b/src/web/app/desktop/-tags/pages/drive.tag @@ -0,0 +1,37 @@ + + + + + diff --git a/src/web/app/desktop/-tags/pages/entrance.tag b/src/web/app/desktop/-tags/pages/entrance.tag new file mode 100644 index 0000000000..56cec34909 --- /dev/null +++ b/src/web/app/desktop/-tags/pages/entrance.tag @@ -0,0 +1,342 @@ + +
    +
    +

    どこにいても、ここにあります

    +

    ようこそ! MisskeyはTwitter風ミニブログSNSです――思ったこと、共有したいことをシンプルに書き残せます。タイムラインを見れば、皆の反応や皆がどう思っているのかもすぐにわかります。

    +

    これまでに{ stats.posts_count }投稿されました

    +
    +
    + + +
    + + +
    +
    +
    + +
    +
    + +

    { _COPYRIGHT_ }

    +
    +
    + + + + +
    + + + %fa:question% +
    +

    +

    { user ? user.name : 'アカウント' }

    +

    + +
    + Twitterでサインイン +
    or
    + Misskeyについて + + +
    + + + + + + diff --git a/src/web/app/desktop/-tags/pages/home-customize.tag b/src/web/app/desktop/-tags/pages/home-customize.tag new file mode 100644 index 0000000000..178558f9d7 --- /dev/null +++ b/src/web/app/desktop/-tags/pages/home-customize.tag @@ -0,0 +1,12 @@ + + + + + diff --git a/src/web/app/desktop/-tags/pages/home.tag b/src/web/app/desktop/-tags/pages/home.tag new file mode 100644 index 0000000000..9b9d455b5b --- /dev/null +++ b/src/web/app/desktop/-tags/pages/home.tag @@ -0,0 +1,54 @@ + + + + + + + diff --git a/src/web/app/desktop/-tags/pages/messaging-room.tag b/src/web/app/desktop/-tags/pages/messaging-room.tag new file mode 100644 index 0000000000..bfa8c2465e --- /dev/null +++ b/src/web/app/desktop/-tags/pages/messaging-room.tag @@ -0,0 +1,37 @@ + + + + + + diff --git a/src/web/app/desktop/-tags/pages/not-found.tag b/src/web/app/desktop/-tags/pages/not-found.tag new file mode 100644 index 0000000000..f2b4ef09a9 --- /dev/null +++ b/src/web/app/desktop/-tags/pages/not-found.tag @@ -0,0 +1,11 @@ + + +
    +

    Not Found

    +
    +
    + +
    diff --git a/src/web/app/desktop/-tags/pages/post.tag b/src/web/app/desktop/-tags/pages/post.tag new file mode 100644 index 0000000000..488adc6e39 --- /dev/null +++ b/src/web/app/desktop/-tags/pages/post.tag @@ -0,0 +1,58 @@ + + +
    + %fa:angle-up%%i18n:desktop.tags.mk-post-page.next% + + %fa:angle-down%%i18n:desktop.tags.mk-post-page.prev% +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/pages/search.tag b/src/web/app/desktop/-tags/pages/search.tag new file mode 100644 index 0000000000..eaa80a039c --- /dev/null +++ b/src/web/app/desktop/-tags/pages/search.tag @@ -0,0 +1,20 @@ + + + + + + + diff --git a/src/web/app/desktop/-tags/pages/selectdrive.tag b/src/web/app/desktop/-tags/pages/selectdrive.tag new file mode 100644 index 0000000000..dd4d30f412 --- /dev/null +++ b/src/web/app/desktop/-tags/pages/selectdrive.tag @@ -0,0 +1,161 @@ + + +
    + + + +
    + + + +
    diff --git a/src/web/app/desktop/-tags/pages/user.tag b/src/web/app/desktop/-tags/pages/user.tag new file mode 100644 index 0000000000..abed2ef021 --- /dev/null +++ b/src/web/app/desktop/-tags/pages/user.tag @@ -0,0 +1,27 @@ + + + + + + + diff --git a/src/web/app/desktop/-tags/post-detail-sub.tag b/src/web/app/desktop/-tags/post-detail-sub.tag new file mode 100644 index 0000000000..2088056700 --- /dev/null +++ b/src/web/app/desktop/-tags/post-detail-sub.tag @@ -0,0 +1,149 @@ + + + avatar + +
    +
    +
    + { post.user.name } + @{ post.user.username } +
    +
    + + + +
    +
    +
    +
    +
    + +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/post-detail.tag b/src/web/app/desktop/-tags/post-detail.tag new file mode 100644 index 0000000000..5f35ce6afa --- /dev/null +++ b/src/web/app/desktop/-tags/post-detail.tag @@ -0,0 +1,328 @@ + +
    + +
    + +
    +
    + +
    +
    +

    + + avatar + + %fa:retweet% + { post.user.name } + + がRepost +

    +
    +
    + + avatar + +
    + { p.user.name } + @{ p.user.username } + + + +
    +
    +
    +
    + +
    + +
    +
    + + + + + +
    +
    +
    + +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/post-form-window.tag b/src/web/app/desktop/-tags/post-form-window.tag new file mode 100644 index 0000000000..562621bde2 --- /dev/null +++ b/src/web/app/desktop/-tags/post-form-window.tag @@ -0,0 +1,68 @@ + + + + %i18n:desktop.tags.mk-post-form-window.post% + %i18n:desktop.tags.mk-post-form-window.reply% + { '%i18n:desktop.tags.mk-post-form-window.attaches%'.replace('{}', parent.files.length) } + { '%i18n:desktop.tags.mk-post-form-window.uploading-media%'.replace('{}', parent.uploadingFiles.length) } + + +
    + +
    +
    + +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/post-form.tag b/src/web/app/desktop/-tags/post-form.tag new file mode 100644 index 0000000000..ddbb485d99 --- /dev/null +++ b/src/web/app/desktop/-tags/post-form.tag @@ -0,0 +1,540 @@ + +
    + +
    +
      +
    • +
      + +
    • +
    +

    { 4 - files.length }/4

    +
    + +
    + + + + + +

    { '%i18n:desktop.tags.mk-post-form.text-remain%'.replace('{}', 1000 - refs.text.value.length) }

    + + +
    + + +
    diff --git a/src/web/app/desktop/-tags/post-preview.tag b/src/web/app/desktop/-tags/post-preview.tag new file mode 100644 index 0000000000..eb71e5e879 --- /dev/null +++ b/src/web/app/desktop/-tags/post-preview.tag @@ -0,0 +1,94 @@ + + + + + diff --git a/src/web/app/desktop/-tags/progress-dialog.tag b/src/web/app/desktop/-tags/progress-dialog.tag new file mode 100644 index 0000000000..5df5d7f57a --- /dev/null +++ b/src/web/app/desktop/-tags/progress-dialog.tag @@ -0,0 +1,97 @@ + + + { parent.title } + +
    +

    待機中

    +

    { Math.floor((parent.value / parent.max) * 100) }

    + +
    +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/repost-form-window.tag b/src/web/app/desktop/-tags/repost-form-window.tag new file mode 100644 index 0000000000..25f509c626 --- /dev/null +++ b/src/web/app/desktop/-tags/repost-form-window.tag @@ -0,0 +1,47 @@ + + + + %fa:retweet%%i18n:desktop.tags.mk-repost-form-window.title% + + + + + + + + diff --git a/src/web/app/desktop/-tags/repost-form.tag b/src/web/app/desktop/-tags/repost-form.tag new file mode 100644 index 0000000000..afe555b6d6 --- /dev/null +++ b/src/web/app/desktop/-tags/repost-form.tag @@ -0,0 +1,127 @@ + + + + + + + diff --git a/src/web/app/desktop/-tags/search-posts.tag b/src/web/app/desktop/-tags/search-posts.tag new file mode 100644 index 0000000000..52c68b754c --- /dev/null +++ b/src/web/app/desktop/-tags/search-posts.tag @@ -0,0 +1,96 @@ + +
    + +
    +

    %fa:search%「{ query }」に関する投稿は見つかりませんでした。

    + + + + + + + + +
    diff --git a/src/web/app/desktop/-tags/search.tag b/src/web/app/desktop/-tags/search.tag new file mode 100644 index 0000000000..28127b721b --- /dev/null +++ b/src/web/app/desktop/-tags/search.tag @@ -0,0 +1,34 @@ + +
    +

    { query }

    +
    + + + +
    diff --git a/src/web/app/desktop/-tags/select-file-from-drive-window.tag b/src/web/app/desktop/-tags/select-file-from-drive-window.tag new file mode 100644 index 0000000000..d6234d5fd9 --- /dev/null +++ b/src/web/app/desktop/-tags/select-file-from-drive-window.tag @@ -0,0 +1,173 @@ + + + + + ({ parent.files.length }ファイル選択中) + + + +
    + + + +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/select-folder-from-drive-window.tag b/src/web/app/desktop/-tags/select-folder-from-drive-window.tag new file mode 100644 index 0000000000..2f98f30a63 --- /dev/null +++ b/src/web/app/desktop/-tags/select-folder-from-drive-window.tag @@ -0,0 +1,112 @@ + + + + + + + +
    + + +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/set-avatar-suggestion.tag b/src/web/app/desktop/-tags/set-avatar-suggestion.tag new file mode 100644 index 0000000000..e67a8c66d4 --- /dev/null +++ b/src/web/app/desktop/-tags/set-avatar-suggestion.tag @@ -0,0 +1,48 @@ + +

    アバターを設定してみませんか? + +

    + + +
    diff --git a/src/web/app/desktop/-tags/set-banner-suggestion.tag b/src/web/app/desktop/-tags/set-banner-suggestion.tag new file mode 100644 index 0000000000..0d32c9a0e3 --- /dev/null +++ b/src/web/app/desktop/-tags/set-banner-suggestion.tag @@ -0,0 +1,48 @@ + +

    バナーを設定してみませんか? + +

    + + +
    diff --git a/src/web/app/desktop/-tags/settings-window.tag b/src/web/app/desktop/-tags/settings-window.tag new file mode 100644 index 0000000000..094225f61f --- /dev/null +++ b/src/web/app/desktop/-tags/settings-window.tag @@ -0,0 +1,30 @@ + + + %fa:cog%設定 + + + + + + + diff --git a/src/web/app/desktop/-tags/settings.tag b/src/web/app/desktop/-tags/settings.tag new file mode 100644 index 0000000000..4bf210cef4 --- /dev/null +++ b/src/web/app/desktop/-tags/settings.tag @@ -0,0 +1,426 @@ + + +
    +
    +

    %i18n:desktop.tags.mk-settings.profile%

    + +
    + +
    +

    デザイン

    + ホームをカスタマイズ +
    + +
    +

    %i18n:desktop.tags.mk-settings.drive%

    + +
    + +
    +

    %i18n:desktop.tags.mk-settings.mute%

    + +
    + +
    +

    アプリケーション

    + +
    + + + +
    +

    %i18n:desktop.tags.mk-settings.password%

    + +
    + +
    +

    %i18n:desktop.tags.mk-settings.2fa%

    + +
    + + + +
    +

    API

    + +
    + +
    +

    %i18n:desktop.tags.mk-settings.license%

    + %license% +
    +
    + + +
    + + + + + + + + + + + + + +

    Token: { I.token }

    +

    %i18n:desktop.tags.mk-api-info.intro%

    +

    %fa:exclamation-triangle%%i18n:desktop.tags.mk-api-info.caution%

    +

    %i18n:desktop.tags.mk-api-info.regeneration-of-token%

    + + + +
    + + + + + + + + +

    %i18n:desktop.tags.mk-2fa-setting.intro%%i18n:desktop.tags.mk-2fa-setting.detail%

    +

    %fa:exclamation-triangle%%i18n:desktop.tags.mk-2fa-setting.caution%

    +

    + +
    +
      +
    1. %i18n:desktop.tags.mk-2fa-setting.authenticator% %i18n:desktop.tags.mk-2fa-setting.howtoinstall%
    2. +
    3. %i18n:desktop.tags.mk-2fa-setting.scan%
    4. +
    5. %i18n:desktop.tags.mk-2fa-setting.done%
      + + +
    6. +
    +

    %fa:info-circle%%i18n:desktop.tags.mk-2fa-setting.info%

    +
    + + +
    + + + + + + { (usageP * 100).toFixed(0) }% + + + + + + + +
    +

    %fa:info-circle%%i18n:desktop.tags.mk-mute-setting.no-users%

    +
    +
    +
    +

    { user.name } @{ user.username }

    +
    +
    + + + +
    diff --git a/src/web/app/desktop/-tags/sub-post-content.tag b/src/web/app/desktop/-tags/sub-post-content.tag new file mode 100644 index 0000000000..40b3b30058 --- /dev/null +++ b/src/web/app/desktop/-tags/sub-post-content.tag @@ -0,0 +1,54 @@ + + +
    + ({ post.media.length }つのメディア) + +
    +
    + 投票 + +
    + + +
    diff --git a/src/web/app/desktop/-tags/timeline.tag b/src/web/app/desktop/-tags/timeline.tag new file mode 100644 index 0000000000..7f79d18b47 --- /dev/null +++ b/src/web/app/desktop/-tags/timeline.tag @@ -0,0 +1,704 @@ + + +
    + +
    + + +
    + + +
    + +
    +
    +

    + + avatar + + %fa:retweet%{'%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('{'))}{ post.user.name }{'%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr('%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1)} +

    + +
    +
    + + avatar + +
    +
    + { p.user.name } + bot + @{ p.user.username } +
    + via { p.app.name } + + + +
    +
    +
    + +
    + +
    + +
    %fa:quote-right -flip-h% + +
    +
    +
    + + + + + + +
    +
    +
    +
    + +
    + + +
    + + + + + + diff --git a/src/web/app/desktop/-tags/ui.tag b/src/web/app/desktop/-tags/ui.tag new file mode 100644 index 0000000000..e5008b838f --- /dev/null +++ b/src/web/app/desktop/-tags/ui.tag @@ -0,0 +1,896 @@ + + + + +
    + +
    + + + +
    + + + + +
    +
    +
    +
    +
    + +
    +
    + + + + + +
    +
    +
    +
    + + +
    + + + + + + + + + + + + + + + +
    + +
    + + +
    + + + + + + + + +
    + +
    +
    + +
    + + +
    + + + + + + + + + +

    { opts.message }

    + + +
    diff --git a/src/web/app/desktop/-tags/user-followers-window.tag b/src/web/app/desktop/-tags/user-followers-window.tag new file mode 100644 index 0000000000..82bec6992d --- /dev/null +++ b/src/web/app/desktop/-tags/user-followers-window.tag @@ -0,0 +1,19 @@ + + { parent.user.name }のフォロワー + + + + + + diff --git a/src/web/app/desktop/-tags/user-followers.tag b/src/web/app/desktop/-tags/user-followers.tag new file mode 100644 index 0000000000..a1b44f0f5b --- /dev/null +++ b/src/web/app/desktop/-tags/user-followers.tag @@ -0,0 +1,23 @@ + + + + + diff --git a/src/web/app/desktop/-tags/user-following-window.tag b/src/web/app/desktop/-tags/user-following-window.tag new file mode 100644 index 0000000000..0f1c4b3ea6 --- /dev/null +++ b/src/web/app/desktop/-tags/user-following-window.tag @@ -0,0 +1,19 @@ + + { parent.user.name }のフォロー + + + + + + diff --git a/src/web/app/desktop/-tags/user-following.tag b/src/web/app/desktop/-tags/user-following.tag new file mode 100644 index 0000000000..db46bf110e --- /dev/null +++ b/src/web/app/desktop/-tags/user-following.tag @@ -0,0 +1,23 @@ + + + + + diff --git a/src/web/app/desktop/-tags/user-preview.tag b/src/web/app/desktop/-tags/user-preview.tag new file mode 100644 index 0000000000..10c37de641 --- /dev/null +++ b/src/web/app/desktop/-tags/user-preview.tag @@ -0,0 +1,149 @@ + + + + + diff --git a/src/web/app/desktop/-tags/user-timeline.tag b/src/web/app/desktop/-tags/user-timeline.tag new file mode 100644 index 0000000000..f018ba64e1 --- /dev/null +++ b/src/web/app/desktop/-tags/user-timeline.tag @@ -0,0 +1,150 @@ + +
    + 投稿投稿と返信 +
    +
    + +
    +

    %fa:R comments%このユーザーはまだ何も投稿していないようです。

    + + + + + + + + +
    diff --git a/src/web/app/desktop/-tags/user.tag b/src/web/app/desktop/-tags/user.tag new file mode 100644 index 0000000000..8221926f45 --- /dev/null +++ b/src/web/app/desktop/-tags/user.tag @@ -0,0 +1,852 @@ + +
    +
    + +
    + + +
    + + +
    + + + +
    +
    + avatar +
    +

    { user.name }

    +

    @{ user.username }

    +

    %fa:map-marker%{ user.profile.location }

    +
    + +
    + + +
    + + +
    + +

    %i18n:desktop.tags.mk-user.follows-you%

    +

    %i18n:desktop.tags.mk-user.muted% %i18n:desktop.tags.mk-user.unmute%

    +

    %i18n:desktop.tags.mk-user.mute%

    +
    +
    { user.description }
    +
    +

    %fa:birthday-cake%{ user.profile.birthday.replace('-', '年').replace('-', '月') + '日' } ({ age(user.profile.birthday) }歳)

    +
    + +
    +

    %fa:angle-right%{ user.posts_count }ポスト

    +

    %fa:angle-right%{ user.following_count }人をフォロー

    +

    %fa:angle-right%{ user.followers_count }人のフォロワー

    +
    + + +
    + + +

    %fa:camera%%i18n:desktop.tags.mk-user.photos.title%

    +

    %fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.photos.loading%

    +
    + +
    +

    %i18n:desktop.tags.mk-user.photos.no-photos%

    + + +
    + + +

    %fa:users%%i18n:desktop.tags.mk-user.frequently-replied-users.title%

    +

    %fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.frequently-replied-users.loading%

    +
    + + + +
    + { _user.name } +

    @{ _user.username }

    +
    + +
    +

    %i18n:desktop.tags.mk-user.frequently-replied-users.no-users%

    + + +
    + + +

    %fa:users%%i18n:desktop.tags.mk-user.followers-you-know.title%

    +

    %fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.followers-you-know.loading%

    +
    + +
    +

    %i18n:desktop.tags.mk-user.followers-you-know.no-users%

    + + +
    + + +
    +
    + + + +

    %i18n:desktop.tags.mk-user.last-used-at%:

    +
    +
    +
    + + +
    +
    +
    + + + + +
    +
    + + +
    + + +
    +
    +

    %fa:pencil-alt%投稿

    + +
    +
    +
    +
    +

    フォロー/フォロワー

    + +
    +
    +
    +
    +

    いいね

    + +
    +
    + + +
    + + + + + + + + + +

    直近1年間分の統計です。一番右が現在で、一番左が1年前です。青は通常の投稿、赤は返信、緑はRepostをそれぞれ表しています。

    +

    + だいたい*1日に{ averageOfAllTypePostsEachDays }回投稿(返信、Repost含む)しています。
    + だいたい*1日に{ averageOfPostsEachDays }回投稿(通常の)しています。
    + だいたい*1日に{ averageOfRepliesEachDays }回返信しています。
    + だいたい*1日に{ averageOfRepostsEachDays }回Repostしています。
    +

    +

    * 中央値

    + + + +
    diff --git a/src/web/app/desktop/-tags/users-list.tag b/src/web/app/desktop/-tags/users-list.tag new file mode 100644 index 0000000000..bf002ae552 --- /dev/null +++ b/src/web/app/desktop/-tags/users-list.tag @@ -0,0 +1,138 @@ + + +
    +
    + +
    +
    + +

    { opts.noUsers }

    +

    %fa:spinner .pulse .fw%読み込んでいます

    + + +
    diff --git a/src/web/app/desktop/-tags/widgets/activity.tag b/src/web/app/desktop/-tags/widgets/activity.tag new file mode 100644 index 0000000000..8c20ef5a68 --- /dev/null +++ b/src/web/app/desktop/-tags/widgets/activity.tag @@ -0,0 +1,246 @@ + + +

    %fa:spinner .pulse .fw%%i18n:common.loading%

    + + + + +
    + + + + + { date.year }/{ date.month }/{ date.day }
    Post: { posts }, Reply: { replies }, Repost: { reposts }
    +
    + + +
    + + +
    + + + + Black ... Total
    Blue ... Posts
    Red ... Replies
    Green ... Reposts
    + + + + +
    + + +
    + diff --git a/src/web/app/desktop/-tags/widgets/calendar.tag b/src/web/app/desktop/-tags/widgets/calendar.tag new file mode 100644 index 0000000000..d20180f1c3 --- /dev/null +++ b/src/web/app/desktop/-tags/widgets/calendar.tag @@ -0,0 +1,241 @@ + + + +
    +
    { weekdayText[i] }
    +
    +
    { i + 1 }
    +
    + + +
    diff --git a/src/web/app/desktop/-tags/window.tag b/src/web/app/desktop/-tags/window.tag new file mode 100644 index 0000000000..051b43f076 --- /dev/null +++ b/src/web/app/desktop/-tags/window.tag @@ -0,0 +1,549 @@ + +
    +
    +
    +
    +

    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + +
    diff --git a/src/web/app/desktop/tags/analog-clock.tag b/src/web/app/desktop/tags/analog-clock.tag deleted file mode 100644 index 6b2bce3b2c..0000000000 --- a/src/web/app/desktop/tags/analog-clock.tag +++ /dev/null @@ -1,95 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/autocomplete-suggestion.tag b/src/web/app/desktop/tags/autocomplete-suggestion.tag deleted file mode 100644 index a0215666c0..0000000000 --- a/src/web/app/desktop/tags/autocomplete-suggestion.tag +++ /dev/null @@ -1,197 +0,0 @@ - -
      -
    1. - - { name } - @{ username } -
    2. -
    - - -
    diff --git a/src/web/app/desktop/tags/big-follow-button.tag b/src/web/app/desktop/tags/big-follow-button.tag deleted file mode 100644 index 5ea09fdfc8..0000000000 --- a/src/web/app/desktop/tags/big-follow-button.tag +++ /dev/null @@ -1,153 +0,0 @@ - - -
    %fa:spinner .pulse .fw%
    - - -
    diff --git a/src/web/app/desktop/tags/contextmenu.tag b/src/web/app/desktop/tags/contextmenu.tag deleted file mode 100644 index ee4c48fbde..0000000000 --- a/src/web/app/desktop/tags/contextmenu.tag +++ /dev/null @@ -1,138 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/crop-window.tag b/src/web/app/desktop/tags/crop-window.tag deleted file mode 100644 index c26f74b121..0000000000 --- a/src/web/app/desktop/tags/crop-window.tag +++ /dev/null @@ -1,196 +0,0 @@ - - - %fa:crop%{ parent.title } - -
    -
    - - - -
    -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/detailed-post-window.tag b/src/web/app/desktop/tags/detailed-post-window.tag deleted file mode 100644 index 57e390d50d..0000000000 --- a/src/web/app/desktop/tags/detailed-post-window.tag +++ /dev/null @@ -1,80 +0,0 @@ - -
    -
    - -
    - - -
    diff --git a/src/web/app/desktop/tags/dialog.tag b/src/web/app/desktop/tags/dialog.tag deleted file mode 100644 index ba2fa514d1..0000000000 --- a/src/web/app/desktop/tags/dialog.tag +++ /dev/null @@ -1,144 +0,0 @@ - -
    -
    -
    -
    -
    - -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/donation.tag b/src/web/app/desktop/tags/donation.tag deleted file mode 100644 index fe446f2e61..0000000000 --- a/src/web/app/desktop/tags/donation.tag +++ /dev/null @@ -1,66 +0,0 @@ - - -
    -

    利用者の皆さま、

    -

    - 今日は、日本の皆さまにお知らせがあります。 - Misskeyの援助をお願いいたします。 - 私は独立性を守るため、一切の広告を掲載いたしません。 - 平均で約¥1,500の寄付をいただき、運営しております。 - 援助をしてくださる利用者はほんの少数です。 - お願いいたします。 - 今日、利用者の皆さまが¥300ご援助くだされば、募金活動を一時間で終了することができます。 - コーヒー1杯ほどの金額です。 - Misskeyを活用しておられるのでしたら、広告を掲載せずにもう1年活動できるよう、どうか1分だけお時間をください。 - 私は小さな非営利個人ですが、サーバー、プログラム、人件費など、世界でトップクラスのウェブサイト同等のコストがかかります。 - 利用者は何億人といますが、他の大きなサイトに比べてほんの少額の費用で運営しているのです。 - 人間の可能性、自由、そして機会。知識こそ、これらの基盤を成すものです。 - 私は、誰もが無料かつ制限なく知識に触れられるべきだと信じています。 - 募金活動を終了し、Misskeyの改善に戻れるようご援助ください。 - よろしくお願いいたします。 -

    -
    - - -
    diff --git a/src/web/app/desktop/tags/drive/base-contextmenu.tag b/src/web/app/desktop/tags/drive/base-contextmenu.tag deleted file mode 100644 index c93d630263..0000000000 --- a/src/web/app/desktop/tags/drive/base-contextmenu.tag +++ /dev/null @@ -1,44 +0,0 @@ - - -
      -
    • -

      %fa:R folder%%i18n:desktop.tags.mk-drive-browser-base-contextmenu.create-folder%

      -
    • -
    • -

      %fa:upload%%i18n:desktop.tags.mk-drive-browser-base-contextmenu.upload%

      -
    • -
    • -

      %fa:cloud-upload-alt%%i18n:desktop.tags.mk-drive-browser-base-contextmenu.url-upload%

      -
    • -
    -
    - -
    diff --git a/src/web/app/desktop/tags/drive/browser-window.tag b/src/web/app/desktop/tags/drive/browser-window.tag deleted file mode 100644 index db7b898341..0000000000 --- a/src/web/app/desktop/tags/drive/browser-window.tag +++ /dev/null @@ -1,60 +0,0 @@ - - - -

    { parent.usage.toFixed(1) }% %i18n:desktop.tags.mk-drive-browser-window.used%

    - %fa:cloud%%i18n:desktop.tags.mk-drive-browser-window.drive% -
    - - - -
    - - -
    diff --git a/src/web/app/desktop/tags/drive/browser.tag b/src/web/app/desktop/tags/drive/browser.tag deleted file mode 100644 index 7aaedab822..0000000000 --- a/src/web/app/desktop/tags/drive/browser.tag +++ /dev/null @@ -1,736 +0,0 @@ - - -
    -
    -
    -
    - - -
    - -
    -
    - - -
    - -
    -
    -

    %i18n:desktop.tags.mk-drive-browser.empty-draghover%

    -

    %i18n:desktop.tags.mk-drive-browser.empty-drive%
    %i18n:desktop.tags.mk-drive-browser.empty-drive-description%

    -

    %i18n:desktop.tags.mk-drive-browser.empty-folder%

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - -
    diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag deleted file mode 100644 index 125f70b614..0000000000 --- a/src/web/app/desktop/tags/drive/file-contextmenu.tag +++ /dev/null @@ -1,99 +0,0 @@ - - -
      -
    • -

      %fa:i-cursor%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.rename%

      -
    • -
    • -

      %fa:link%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.copy-url%

      -
    • -
    • %fa:download%%i18n:desktop.tags.mk-drive-browser-file-contextmenu.download%
    • -
    • -
    • -

      %fa:R trash-alt%%i18n:common.delete%

      -
    • -
    • -
    • -

      %i18n:desktop.tags.mk-drive-browser-file-contextmenu.else-files%%fa:caret-right%

      -
        -
      • -

        %i18n:desktop.tags.mk-drive-browser-file-contextmenu.set-as-avatar%

        -
      • -
      • -

        %i18n:desktop.tags.mk-drive-browser-file-contextmenu.set-as-banner%

        -
      • -
      -
    • -
    • -

      %i18n:desktop.tags.mk-drive-browser-file-contextmenu.open-in-app%...%fa:caret-right%

      -
        -
      • -

        %i18n:desktop.tags.mk-drive-browser-file-contextmenu.add-app%...

        -
      • -
      -
    • -
    -
    - -
    diff --git a/src/web/app/desktop/tags/drive/file.tag b/src/web/app/desktop/tags/drive/file.tag deleted file mode 100644 index a669f5fff4..0000000000 --- a/src/web/app/desktop/tags/drive/file.tag +++ /dev/null @@ -1,217 +0,0 @@ - -
    -

    %i18n:desktop.tags.mk-drive-browser-file.avatar%

    -
    -
    -

    %i18n:desktop.tags.mk-drive-browser-file.banner%

    -
    -
    - -
    -

    { file.name.lastIndexOf('.') != -1 ? file.name.substr(0, file.name.lastIndexOf('.')) : file.name }{ file.name.substr(file.name.lastIndexOf('.')) }

    - - -
    diff --git a/src/web/app/desktop/tags/drive/folder-contextmenu.tag b/src/web/app/desktop/tags/drive/folder-contextmenu.tag deleted file mode 100644 index 0cb7f6eb80..0000000000 --- a/src/web/app/desktop/tags/drive/folder-contextmenu.tag +++ /dev/null @@ -1,63 +0,0 @@ - - -
      -
    • -

      %fa:arrow-right%%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.move-to-this-folder%

      -
    • -
    • -

      %fa:R window-restore%%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.show-in-new-window%

      -
    • -
    • -
    • -

      %fa:i-cursor%%i18n:desktop.tags.mk-drive-browser-folder-contextmenu.rename%

      -
    • -
    • -
    • -

      %fa:R trash-alt%%i18n:common.delete%

      -
    • -
    -
    - -
    diff --git a/src/web/app/desktop/tags/drive/folder.tag b/src/web/app/desktop/tags/drive/folder.tag deleted file mode 100644 index ed16bfb0d7..0000000000 --- a/src/web/app/desktop/tags/drive/folder.tag +++ /dev/null @@ -1,202 +0,0 @@ - -

    { folder.name }

    - - -
    diff --git a/src/web/app/desktop/tags/drive/nav-folder.tag b/src/web/app/desktop/tags/drive/nav-folder.tag deleted file mode 100644 index 4bca80f683..0000000000 --- a/src/web/app/desktop/tags/drive/nav-folder.tag +++ /dev/null @@ -1,96 +0,0 @@ - - { folder == null ? '%i18n:desktop.tags.mk-drive-browser-nav-folder.drive%' : folder.name } - - - diff --git a/src/web/app/desktop/tags/ellipsis-icon.tag b/src/web/app/desktop/tags/ellipsis-icon.tag deleted file mode 100644 index 619f0d84f7..0000000000 --- a/src/web/app/desktop/tags/ellipsis-icon.tag +++ /dev/null @@ -1,37 +0,0 @@ - -
    -
    -
    - -
    diff --git a/src/web/app/desktop/tags/follow-button.tag b/src/web/app/desktop/tags/follow-button.tag deleted file mode 100644 index fa7d43e039..0000000000 --- a/src/web/app/desktop/tags/follow-button.tag +++ /dev/null @@ -1,150 +0,0 @@ - - -
    %fa:spinner .pulse .fw%
    - - -
    diff --git a/src/web/app/desktop/tags/following-setuper.tag b/src/web/app/desktop/tags/following-setuper.tag deleted file mode 100644 index 75ce76ae53..0000000000 --- a/src/web/app/desktop/tags/following-setuper.tag +++ /dev/null @@ -1,169 +0,0 @@ - -

    気になるユーザーをフォロー:

    -
    -
    -
    { name } -

    @{ username }

    -
    - -
    -
    -

    おすすめのユーザーは見つかりませんでした。

    -

    %fa:spinner .pulse .fw%読み込んでいます

    - もっと見る - - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/access-log.tag b/src/web/app/desktop/tags/home-widgets/access-log.tag deleted file mode 100644 index fea18299e8..0000000000 --- a/src/web/app/desktop/tags/home-widgets/access-log.tag +++ /dev/null @@ -1,95 +0,0 @@ - - -
    -

    - { ip } - { method } - { path } -

    -
    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/activity.tag b/src/web/app/desktop/tags/home-widgets/activity.tag deleted file mode 100644 index 878de6d13a..0000000000 --- a/src/web/app/desktop/tags/home-widgets/activity.tag +++ /dev/null @@ -1,32 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/home-widgets/broadcast.tag b/src/web/app/desktop/tags/home-widgets/broadcast.tag deleted file mode 100644 index 91ddbb4ab4..0000000000 --- a/src/web/app/desktop/tags/home-widgets/broadcast.tag +++ /dev/null @@ -1,143 +0,0 @@ - -
    - - - - - - - -
    -

    %i18n:desktop.tags.mk-broadcast-home-widget.fetching%

    -

    { - broadcasts.length == 0 ? '%i18n:desktop.tags.mk-broadcast-home-widget.no-broadcasts%' : broadcasts[i].title - }

    -

    - %i18n:desktop.tags.mk-broadcast-home-widget.next% >> - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/calendar.tag b/src/web/app/desktop/tags/home-widgets/calendar.tag deleted file mode 100644 index 46d47662b9..0000000000 --- a/src/web/app/desktop/tags/home-widgets/calendar.tag +++ /dev/null @@ -1,167 +0,0 @@ - -
    -

    { year }年{ month }月

    -

    { day }日

    -

    { weekDay }曜日

    -
    -
    -
    -

    今日:{ dayP.toFixed(1) }%

    -
    -
    -
    -
    -
    -

    今月:{ monthP.toFixed(1) }%

    -
    -
    -
    -
    -
    -

    今年:{ yearP.toFixed(1) }%

    -
    -
    -
    -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/channel.tag b/src/web/app/desktop/tags/home-widgets/channel.tag deleted file mode 100644 index 98bf6bf7ec..0000000000 --- a/src/web/app/desktop/tags/home-widgets/channel.tag +++ /dev/null @@ -1,318 +0,0 @@ - - -

    %i18n:desktop.tags.mk-channel-home-widget.get-started%

    - - - -
    - - -

    読み込み中

    -
    -

    まだ投稿がありません

    - -
    - - - -
    - - -
    - { post.index }: - { post.user.name } - ID:{ post.user.username } -
    -
    - >>{ post.reply.index } - { post.text } -
    - -
    -
    - - -
    - - - - - - diff --git a/src/web/app/desktop/tags/home-widgets/donation.tag b/src/web/app/desktop/tags/home-widgets/donation.tag deleted file mode 100644 index 5ed5c137b5..0000000000 --- a/src/web/app/desktop/tags/home-widgets/donation.tag +++ /dev/null @@ -1,36 +0,0 @@ - -
    -

    %fa:heart%%i18n:desktop.tags.mk-donation-home-widget.title%

    -

    {'%i18n:desktop.tags.mk-donation-home-widget.text%'.substr(0, '%i18n:desktop.tags.mk-donation-home-widget.text%'.indexOf('{'))}@syuilo{'%i18n:desktop.tags.mk-donation-home-widget.text%'.substr('%i18n:desktop.tags.mk-donation-home-widget.text%'.indexOf('}') + 1)}

    -
    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/mentions.tag b/src/web/app/desktop/tags/home-widgets/mentions.tag deleted file mode 100644 index 81f9b2875e..0000000000 --- a/src/web/app/desktop/tags/home-widgets/mentions.tag +++ /dev/null @@ -1,125 +0,0 @@ - -
    すべてフォロー中
    -
    - -
    -

    %fa:R comments%あなた宛ての投稿はありません。あなたがフォローしているユーザーからの言及はありません。

    - - - - - - - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/messaging.tag b/src/web/app/desktop/tags/home-widgets/messaging.tag deleted file mode 100644 index d3b77b58cc..0000000000 --- a/src/web/app/desktop/tags/home-widgets/messaging.tag +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - diff --git a/src/web/app/desktop/tags/home-widgets/nav.tag b/src/web/app/desktop/tags/home-widgets/nav.tag deleted file mode 100644 index 890fb4d8f7..0000000000 --- a/src/web/app/desktop/tags/home-widgets/nav.tag +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/home-widgets/notifications.tag b/src/web/app/desktop/tags/home-widgets/notifications.tag deleted file mode 100644 index bd915b197b..0000000000 --- a/src/web/app/desktop/tags/home-widgets/notifications.tag +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - diff --git a/src/web/app/desktop/tags/home-widgets/photo-stream.tag b/src/web/app/desktop/tags/home-widgets/photo-stream.tag deleted file mode 100644 index a2d95dede3..0000000000 --- a/src/web/app/desktop/tags/home-widgets/photo-stream.tag +++ /dev/null @@ -1,118 +0,0 @@ - - -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    -
    - -
    -

    %i18n:desktop.tags.mk-photo-stream-home-widget.no-photos%

    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/post-form.tag b/src/web/app/desktop/tags/home-widgets/post-form.tag deleted file mode 100644 index d5824477b9..0000000000 --- a/src/web/app/desktop/tags/home-widgets/post-form.tag +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - diff --git a/src/web/app/desktop/tags/home-widgets/profile.tag b/src/web/app/desktop/tags/home-widgets/profile.tag deleted file mode 100644 index 02a1f0d5a3..0000000000 --- a/src/web/app/desktop/tags/home-widgets/profile.tag +++ /dev/null @@ -1,116 +0,0 @@ - - - avatar - { I.name } -

    @{ I.username }

    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/recommended-polls.tag b/src/web/app/desktop/tags/home-widgets/recommended-polls.tag deleted file mode 100644 index cfbcd1e929..0000000000 --- a/src/web/app/desktop/tags/home-widgets/recommended-polls.tag +++ /dev/null @@ -1,119 +0,0 @@ - - - -

    %i18n:desktop.tags.mk-recommended-polls-home-widget.nothing%

    -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/rss-reader.tag b/src/web/app/desktop/tags/home-widgets/rss-reader.tag deleted file mode 100644 index 4e0ed702e2..0000000000 --- a/src/web/app/desktop/tags/home-widgets/rss-reader.tag +++ /dev/null @@ -1,109 +0,0 @@ - - -
    - -
    -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/server.tag b/src/web/app/desktop/tags/home-widgets/server.tag deleted file mode 100644 index 992517163a..0000000000 --- a/src/web/app/desktop/tags/home-widgets/server.tag +++ /dev/null @@ -1,533 +0,0 @@ - - -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    - - - - - - - - -
    - - - - - - - - - - - - - - - - - CPU { cpuP }% - - - - - - - - - - - - - - - - MEM { memP }% - - - - - - - -
    -

    %fa:microchip%CPU

    -

    { cores } Cores

    -

    { model }

    -
    - - -
    - - - -
    -

    %fa:flask%Memory

    -

    Total: { bytesToSize(total, 1) }

    -

    Used: { bytesToSize(used, 1) }

    -

    Free: { bytesToSize(free, 1) }

    -
    - - -
    - - - -
    -

    %fa:R hdd%Storage

    -

    Total: { bytesToSize(total, 1) }

    -

    Available: { bytesToSize(available, 1) }

    -

    Used: { bytesToSize(used, 1) }

    -
    - - -
    - - -

    Uptimes

    -

    Process: { process ? process.toFixed(0) : '---' }s

    -

    OS: { os ? os.toFixed(0) : '---' }s

    - - -
    - - -

    Maintainer: { meta.maintainer }

    -

    Machine: { meta.machine }

    -

    Node: { meta.node }

    - - -
    - - - - - - { (p * 100).toFixed(0) }% - - - - diff --git a/src/web/app/desktop/tags/home-widgets/slideshow.tag b/src/web/app/desktop/tags/home-widgets/slideshow.tag deleted file mode 100644 index 817b138d31..0000000000 --- a/src/web/app/desktop/tags/home-widgets/slideshow.tag +++ /dev/null @@ -1,151 +0,0 @@ - -
    -

    クリックしてフォルダを指定してください

    -

    このフォルダには画像がありません

    -
    -
    -
    - - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/timeline.tag b/src/web/app/desktop/tags/home-widgets/timeline.tag deleted file mode 100644 index 4668ebfa87..0000000000 --- a/src/web/app/desktop/tags/home-widgets/timeline.tag +++ /dev/null @@ -1,143 +0,0 @@ - - -
    - -
    -

    %fa:R comments%自分の投稿や、自分がフォローしているユーザーの投稿が表示されます。

    - - - - - - - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/timemachine.tag b/src/web/app/desktop/tags/home-widgets/timemachine.tag deleted file mode 100644 index 43f59fe674..0000000000 --- a/src/web/app/desktop/tags/home-widgets/timemachine.tag +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/home-widgets/tips.tag b/src/web/app/desktop/tags/home-widgets/tips.tag deleted file mode 100644 index a352253cef..0000000000 --- a/src/web/app/desktop/tags/home-widgets/tips.tag +++ /dev/null @@ -1,94 +0,0 @@ - -

    %fa:R lightbulb%

    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/trends.tag b/src/web/app/desktop/tags/home-widgets/trends.tag deleted file mode 100644 index 5e297ebc7b..0000000000 --- a/src/web/app/desktop/tags/home-widgets/trends.tag +++ /dev/null @@ -1,125 +0,0 @@ - - -
    -

    { post.text }

    -

    @{ post.user.username }

    -
    -

    %i18n:desktop.tags.mk-trends-home-widget.nothing%

    -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/user-recommendation.tag b/src/web/app/desktop/tags/home-widgets/user-recommendation.tag deleted file mode 100644 index 5344da1f2b..0000000000 --- a/src/web/app/desktop/tags/home-widgets/user-recommendation.tag +++ /dev/null @@ -1,165 +0,0 @@ - - -
    - - - -
    - { _user.name } -

    @{ _user.username }

    -
    - -
    -

    %i18n:desktop.tags.mk-user-recommendation-home-widget.no-one%

    -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    - - -
    diff --git a/src/web/app/desktop/tags/home-widgets/version.tag b/src/web/app/desktop/tags/home-widgets/version.tag deleted file mode 100644 index 6dd8ad6444..0000000000 --- a/src/web/app/desktop/tags/home-widgets/version.tag +++ /dev/null @@ -1,20 +0,0 @@ - -

    ver { _VERSION_ } (葵 aoi)

    - - -
    diff --git a/src/web/app/desktop/tags/images.tag b/src/web/app/desktop/tags/images.tag deleted file mode 100644 index 1094e0d968..0000000000 --- a/src/web/app/desktop/tags/images.tag +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - - - - - -
    { - - -
    diff --git a/src/web/app/desktop/tags/index.ts b/src/web/app/desktop/tags/index.ts deleted file mode 100644 index 4edda83534..0000000000 --- a/src/web/app/desktop/tags/index.ts +++ /dev/null @@ -1,89 +0,0 @@ -require('./contextmenu.tag'); -require('./dialog.tag'); -require('./window.tag'); -require('./input-dialog.tag'); -require('./follow-button.tag'); -require('./drive/base-contextmenu.tag'); -require('./drive/file-contextmenu.tag'); -require('./drive/folder-contextmenu.tag'); -require('./drive/file.tag'); -require('./drive/folder.tag'); -require('./drive/nav-folder.tag'); -require('./drive/browser-window.tag'); -require('./drive/browser.tag'); -require('./select-file-from-drive-window.tag'); -require('./select-folder-from-drive-window.tag'); -require('./crop-window.tag'); -require('./settings.tag'); -require('./settings-window.tag'); -require('./analog-clock.tag'); -require('./notifications.tag'); -require('./post-form-window.tag'); -require('./post-form.tag'); -require('./post-preview.tag'); -require('./repost-form-window.tag'); -require('./home-widgets/user-recommendation.tag'); -require('./home-widgets/timeline.tag'); -require('./home-widgets/mentions.tag'); -require('./home-widgets/calendar.tag'); -require('./home-widgets/donation.tag'); -require('./home-widgets/tips.tag'); -require('./home-widgets/nav.tag'); -require('./home-widgets/profile.tag'); -require('./home-widgets/notifications.tag'); -require('./home-widgets/rss-reader.tag'); -require('./home-widgets/photo-stream.tag'); -require('./home-widgets/broadcast.tag'); -require('./home-widgets/version.tag'); -require('./home-widgets/recommended-polls.tag'); -require('./home-widgets/trends.tag'); -require('./home-widgets/activity.tag'); -require('./home-widgets/server.tag'); -require('./home-widgets/slideshow.tag'); -require('./home-widgets/channel.tag'); -require('./home-widgets/timemachine.tag'); -require('./home-widgets/post-form.tag'); -require('./home-widgets/access-log.tag'); -require('./home-widgets/messaging.tag'); -require('./timeline.tag'); -require('./messaging/window.tag'); -require('./messaging/room-window.tag'); -require('./following-setuper.tag'); -require('./ellipsis-icon.tag'); -require('./ui.tag'); -require('./home.tag'); -require('./user-timeline.tag'); -require('./user.tag'); -require('./big-follow-button.tag'); -require('./pages/entrance.tag'); -require('./pages/home.tag'); -require('./pages/home-customize.tag'); -require('./pages/user.tag'); -require('./pages/post.tag'); -require('./pages/search.tag'); -require('./pages/not-found.tag'); -require('./pages/selectdrive.tag'); -require('./pages/drive.tag'); -require('./pages/messaging-room.tag'); -require('./autocomplete-suggestion.tag'); -require('./progress-dialog.tag'); -require('./user-preview.tag'); -require('./post-detail.tag'); -require('./post-detail-sub.tag'); -require('./search.tag'); -require('./search-posts.tag'); -require('./set-avatar-suggestion.tag'); -require('./set-banner-suggestion.tag'); -require('./repost-form.tag'); -require('./sub-post-content.tag'); -require('./images.tag'); -require('./donation.tag'); -require('./users-list.tag'); -require('./user-following.tag'); -require('./user-followers.tag'); -require('./user-following-window.tag'); -require('./user-followers-window.tag'); -require('./list-user.tag'); -require('./detailed-post-window.tag'); -require('./widgets/calendar.tag'); -require('./widgets/activity.tag'); diff --git a/src/web/app/desktop/tags/input-dialog.tag b/src/web/app/desktop/tags/input-dialog.tag deleted file mode 100644 index a1634429cf..0000000000 --- a/src/web/app/desktop/tags/input-dialog.tag +++ /dev/null @@ -1,172 +0,0 @@ - - - - %fa:i-cursor%{ parent.title } - - -
    - -
    -
    - - -
    -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/list-user.tag b/src/web/app/desktop/tags/list-user.tag deleted file mode 100644 index bde90b1cc6..0000000000 --- a/src/web/app/desktop/tags/list-user.tag +++ /dev/null @@ -1,93 +0,0 @@ - - - avatar - -
    -
    - { user.name } - @{ user.username } -
    -
    -

    フォローされています

    -
    { user.description }
    -
    -
    - - - -
    diff --git a/src/web/app/desktop/tags/messaging/room-window.tag b/src/web/app/desktop/tags/messaging/room-window.tag deleted file mode 100644 index ca11873644..0000000000 --- a/src/web/app/desktop/tags/messaging/room-window.tag +++ /dev/null @@ -1,32 +0,0 @@ - - - %fa:comments%メッセージ: { parent.user.name } - - - - - - - diff --git a/src/web/app/desktop/tags/messaging/window.tag b/src/web/app/desktop/tags/messaging/window.tag deleted file mode 100644 index e078bccad7..0000000000 --- a/src/web/app/desktop/tags/messaging/window.tag +++ /dev/null @@ -1,34 +0,0 @@ - - - %fa:comments%メッセージ - - - - - - - diff --git a/src/web/app/desktop/tags/notifications.tag b/src/web/app/desktop/tags/notifications.tag deleted file mode 100644 index a599e5d6a5..0000000000 --- a/src/web/app/desktop/tags/notifications.tag +++ /dev/null @@ -1,301 +0,0 @@ - -
    - -
    - -

    ありません!

    -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    - - -
    diff --git a/src/web/app/desktop/tags/pages/drive.tag b/src/web/app/desktop/tags/pages/drive.tag deleted file mode 100644 index f4e2a3740a..0000000000 --- a/src/web/app/desktop/tags/pages/drive.tag +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/pages/entrance.tag b/src/web/app/desktop/tags/pages/entrance.tag deleted file mode 100644 index 56cec34909..0000000000 --- a/src/web/app/desktop/tags/pages/entrance.tag +++ /dev/null @@ -1,342 +0,0 @@ - -
    -
    -

    どこにいても、ここにあります

    -

    ようこそ! MisskeyはTwitter風ミニブログSNSです――思ったこと、共有したいことをシンプルに書き残せます。タイムラインを見れば、皆の反応や皆がどう思っているのかもすぐにわかります。

    -

    これまでに{ stats.posts_count }投稿されました

    -
    -
    - - -
    - - -
    -
    -
    - -
    -
    - -

    { _COPYRIGHT_ }

    -
    -
    - - - - -
    - - - %fa:question% -
    -

    -

    { user ? user.name : 'アカウント' }

    -

    - -
    - Twitterでサインイン -
    or
    - Misskeyについて - - -
    - - - - - - diff --git a/src/web/app/desktop/tags/pages/home-customize.tag b/src/web/app/desktop/tags/pages/home-customize.tag deleted file mode 100644 index 178558f9d7..0000000000 --- a/src/web/app/desktop/tags/pages/home-customize.tag +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/pages/home.tag b/src/web/app/desktop/tags/pages/home.tag deleted file mode 100644 index 9b9d455b5b..0000000000 --- a/src/web/app/desktop/tags/pages/home.tag +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - diff --git a/src/web/app/desktop/tags/pages/messaging-room.tag b/src/web/app/desktop/tags/pages/messaging-room.tag deleted file mode 100644 index bfa8c2465e..0000000000 --- a/src/web/app/desktop/tags/pages/messaging-room.tag +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - diff --git a/src/web/app/desktop/tags/pages/not-found.tag b/src/web/app/desktop/tags/pages/not-found.tag deleted file mode 100644 index f2b4ef09a9..0000000000 --- a/src/web/app/desktop/tags/pages/not-found.tag +++ /dev/null @@ -1,11 +0,0 @@ - - -
    -

    Not Found

    -
    -
    - -
    diff --git a/src/web/app/desktop/tags/pages/post.tag b/src/web/app/desktop/tags/pages/post.tag deleted file mode 100644 index 488adc6e39..0000000000 --- a/src/web/app/desktop/tags/pages/post.tag +++ /dev/null @@ -1,58 +0,0 @@ - - -
    - %fa:angle-up%%i18n:desktop.tags.mk-post-page.next% - - %fa:angle-down%%i18n:desktop.tags.mk-post-page.prev% -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/pages/search.tag b/src/web/app/desktop/tags/pages/search.tag deleted file mode 100644 index eaa80a039c..0000000000 --- a/src/web/app/desktop/tags/pages/search.tag +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - diff --git a/src/web/app/desktop/tags/pages/selectdrive.tag b/src/web/app/desktop/tags/pages/selectdrive.tag deleted file mode 100644 index dd4d30f412..0000000000 --- a/src/web/app/desktop/tags/pages/selectdrive.tag +++ /dev/null @@ -1,161 +0,0 @@ - - -
    - - - -
    - - - -
    diff --git a/src/web/app/desktop/tags/pages/user.tag b/src/web/app/desktop/tags/pages/user.tag deleted file mode 100644 index abed2ef021..0000000000 --- a/src/web/app/desktop/tags/pages/user.tag +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - diff --git a/src/web/app/desktop/tags/post-detail-sub.tag b/src/web/app/desktop/tags/post-detail-sub.tag deleted file mode 100644 index 2088056700..0000000000 --- a/src/web/app/desktop/tags/post-detail-sub.tag +++ /dev/null @@ -1,149 +0,0 @@ - - - avatar - -
    -
    -
    - { post.user.name } - @{ post.user.username } -
    -
    - - - -
    -
    -
    -
    -
    - -
    -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/post-detail.tag b/src/web/app/desktop/tags/post-detail.tag deleted file mode 100644 index 5f35ce6afa..0000000000 --- a/src/web/app/desktop/tags/post-detail.tag +++ /dev/null @@ -1,328 +0,0 @@ - -
    - -
    - -
    -
    - -
    -
    -

    - - avatar - - %fa:retweet% - { post.user.name } - - がRepost -

    -
    -
    - - avatar - -
    - { p.user.name } - @{ p.user.username } - - - -
    -
    -
    -
    - -
    - -
    -
    - - - - - -
    -
    -
    - -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/post-form-window.tag b/src/web/app/desktop/tags/post-form-window.tag deleted file mode 100644 index 562621bde2..0000000000 --- a/src/web/app/desktop/tags/post-form-window.tag +++ /dev/null @@ -1,68 +0,0 @@ - - - - %i18n:desktop.tags.mk-post-form-window.post% - %i18n:desktop.tags.mk-post-form-window.reply% - { '%i18n:desktop.tags.mk-post-form-window.attaches%'.replace('{}', parent.files.length) } - { '%i18n:desktop.tags.mk-post-form-window.uploading-media%'.replace('{}', parent.uploadingFiles.length) } - - -
    - -
    -
    - -
    -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag deleted file mode 100644 index ddbb485d99..0000000000 --- a/src/web/app/desktop/tags/post-form.tag +++ /dev/null @@ -1,540 +0,0 @@ - -
    - -
    -
      -
    • -
      - -
    • -
    -

    { 4 - files.length }/4

    -
    - -
    - - - - - -

    { '%i18n:desktop.tags.mk-post-form.text-remain%'.replace('{}', 1000 - refs.text.value.length) }

    - - -
    - - -
    diff --git a/src/web/app/desktop/tags/post-preview.tag b/src/web/app/desktop/tags/post-preview.tag deleted file mode 100644 index eb71e5e879..0000000000 --- a/src/web/app/desktop/tags/post-preview.tag +++ /dev/null @@ -1,94 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/progress-dialog.tag b/src/web/app/desktop/tags/progress-dialog.tag deleted file mode 100644 index 5df5d7f57a..0000000000 --- a/src/web/app/desktop/tags/progress-dialog.tag +++ /dev/null @@ -1,97 +0,0 @@ - - - { parent.title } - -
    -

    待機中

    -

    { Math.floor((parent.value / parent.max) * 100) }

    - -
    -
    -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/repost-form-window.tag b/src/web/app/desktop/tags/repost-form-window.tag deleted file mode 100644 index 25f509c626..0000000000 --- a/src/web/app/desktop/tags/repost-form-window.tag +++ /dev/null @@ -1,47 +0,0 @@ - - - - %fa:retweet%%i18n:desktop.tags.mk-repost-form-window.title% - - - - - - - - diff --git a/src/web/app/desktop/tags/repost-form.tag b/src/web/app/desktop/tags/repost-form.tag deleted file mode 100644 index afe555b6d6..0000000000 --- a/src/web/app/desktop/tags/repost-form.tag +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - diff --git a/src/web/app/desktop/tags/search-posts.tag b/src/web/app/desktop/tags/search-posts.tag deleted file mode 100644 index 52c68b754c..0000000000 --- a/src/web/app/desktop/tags/search-posts.tag +++ /dev/null @@ -1,96 +0,0 @@ - -
    - -
    -

    %fa:search%「{ query }」に関する投稿は見つかりませんでした。

    - - - - - - - - -
    diff --git a/src/web/app/desktop/tags/search.tag b/src/web/app/desktop/tags/search.tag deleted file mode 100644 index 28127b721b..0000000000 --- a/src/web/app/desktop/tags/search.tag +++ /dev/null @@ -1,34 +0,0 @@ - -
    -

    { query }

    -
    - - - -
    diff --git a/src/web/app/desktop/tags/select-file-from-drive-window.tag b/src/web/app/desktop/tags/select-file-from-drive-window.tag deleted file mode 100644 index d6234d5fd9..0000000000 --- a/src/web/app/desktop/tags/select-file-from-drive-window.tag +++ /dev/null @@ -1,173 +0,0 @@ - - - - - ({ parent.files.length }ファイル選択中) - - - -
    - - - -
    -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/select-folder-from-drive-window.tag b/src/web/app/desktop/tags/select-folder-from-drive-window.tag deleted file mode 100644 index 2f98f30a63..0000000000 --- a/src/web/app/desktop/tags/select-folder-from-drive-window.tag +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - -
    - - -
    -
    -
    - - -
    diff --git a/src/web/app/desktop/tags/set-avatar-suggestion.tag b/src/web/app/desktop/tags/set-avatar-suggestion.tag deleted file mode 100644 index e67a8c66d4..0000000000 --- a/src/web/app/desktop/tags/set-avatar-suggestion.tag +++ /dev/null @@ -1,48 +0,0 @@ - -

    アバターを設定してみませんか? - -

    - - -
    diff --git a/src/web/app/desktop/tags/set-banner-suggestion.tag b/src/web/app/desktop/tags/set-banner-suggestion.tag deleted file mode 100644 index 0d32c9a0e3..0000000000 --- a/src/web/app/desktop/tags/set-banner-suggestion.tag +++ /dev/null @@ -1,48 +0,0 @@ - -

    バナーを設定してみませんか? - -

    - - -
    diff --git a/src/web/app/desktop/tags/settings-window.tag b/src/web/app/desktop/tags/settings-window.tag deleted file mode 100644 index 094225f61f..0000000000 --- a/src/web/app/desktop/tags/settings-window.tag +++ /dev/null @@ -1,30 +0,0 @@ - - - %fa:cog%設定 - - - - - - - diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag deleted file mode 100644 index 4bf210cef4..0000000000 --- a/src/web/app/desktop/tags/settings.tag +++ /dev/null @@ -1,426 +0,0 @@ - - -
    -
    -

    %i18n:desktop.tags.mk-settings.profile%

    - -
    - -
    -

    デザイン

    - ホームをカスタマイズ -
    - -
    -

    %i18n:desktop.tags.mk-settings.drive%

    - -
    - -
    -

    %i18n:desktop.tags.mk-settings.mute%

    - -
    - -
    -

    アプリケーション

    - -
    - - - -
    -

    %i18n:desktop.tags.mk-settings.password%

    - -
    - -
    -

    %i18n:desktop.tags.mk-settings.2fa%

    - -
    - - - -
    -

    API

    - -
    - -
    -

    %i18n:desktop.tags.mk-settings.license%

    - %license% -
    -
    - - -
    - - - - - - - - - - - - - -

    Token: { I.token }

    -

    %i18n:desktop.tags.mk-api-info.intro%

    -

    %fa:exclamation-triangle%%i18n:desktop.tags.mk-api-info.caution%

    -

    %i18n:desktop.tags.mk-api-info.regeneration-of-token%

    - - - -
    - - - - - - - - -

    %i18n:desktop.tags.mk-2fa-setting.intro%%i18n:desktop.tags.mk-2fa-setting.detail%

    -

    %fa:exclamation-triangle%%i18n:desktop.tags.mk-2fa-setting.caution%

    -

    - -
    -
      -
    1. %i18n:desktop.tags.mk-2fa-setting.authenticator% %i18n:desktop.tags.mk-2fa-setting.howtoinstall%
    2. -
    3. %i18n:desktop.tags.mk-2fa-setting.scan%
    4. -
    5. %i18n:desktop.tags.mk-2fa-setting.done%
      - - -
    6. -
    -

    %fa:info-circle%%i18n:desktop.tags.mk-2fa-setting.info%

    -
    - - -
    - - - - - - { (usageP * 100).toFixed(0) }% - - - - - - - -
    -

    %fa:info-circle%%i18n:desktop.tags.mk-mute-setting.no-users%

    -
    -
    -
    -

    { user.name } @{ user.username }

    -
    -
    - - - -
    diff --git a/src/web/app/desktop/tags/sub-post-content.tag b/src/web/app/desktop/tags/sub-post-content.tag deleted file mode 100644 index 40b3b30058..0000000000 --- a/src/web/app/desktop/tags/sub-post-content.tag +++ /dev/null @@ -1,54 +0,0 @@ - - -
    - ({ post.media.length }つのメディア) - -
    -
    - 投票 - -
    - - -
    diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag deleted file mode 100644 index 7f79d18b47..0000000000 --- a/src/web/app/desktop/tags/timeline.tag +++ /dev/null @@ -1,704 +0,0 @@ - - -
    - -
    - - -
    - - -
    - -
    -
    -

    - - avatar - - %fa:retweet%{'%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('{'))}{ post.user.name }{'%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr('%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1)} -

    - -
    -
    - - avatar - -
    -
    - { p.user.name } - bot - @{ p.user.username } -
    - via { p.app.name } - - - -
    -
    -
    - -
    - -
    - -
    %fa:quote-right -flip-h% - -
    -
    -
    - - - - - - -
    -
    -
    -
    - -
    - - -
    - - - - - - diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag deleted file mode 100644 index e5008b838f..0000000000 --- a/src/web/app/desktop/tags/ui.tag +++ /dev/null @@ -1,896 +0,0 @@ - - - - -
    - -
    - - - -
    - - - - -
    -
    -
    -
    -
    - -
    -
    - - - - - -
    -
    -
    -
    - - -
    - - - - - - - - - - - - - - - -
    - -
    - - -
    - - - - - - - - -
    - -
    -
    - -
    - - -
    - - - - - - - - - -

    { opts.message }

    - - -
    diff --git a/src/web/app/desktop/tags/user-followers-window.tag b/src/web/app/desktop/tags/user-followers-window.tag deleted file mode 100644 index 82bec6992d..0000000000 --- a/src/web/app/desktop/tags/user-followers-window.tag +++ /dev/null @@ -1,19 +0,0 @@ - - { parent.user.name }のフォロワー - - - - - - diff --git a/src/web/app/desktop/tags/user-followers.tag b/src/web/app/desktop/tags/user-followers.tag deleted file mode 100644 index a1b44f0f5b..0000000000 --- a/src/web/app/desktop/tags/user-followers.tag +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/user-following-window.tag b/src/web/app/desktop/tags/user-following-window.tag deleted file mode 100644 index 0f1c4b3ea6..0000000000 --- a/src/web/app/desktop/tags/user-following-window.tag +++ /dev/null @@ -1,19 +0,0 @@ - - { parent.user.name }のフォロー - - - - - - diff --git a/src/web/app/desktop/tags/user-following.tag b/src/web/app/desktop/tags/user-following.tag deleted file mode 100644 index db46bf110e..0000000000 --- a/src/web/app/desktop/tags/user-following.tag +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/user-preview.tag b/src/web/app/desktop/tags/user-preview.tag deleted file mode 100644 index 10c37de641..0000000000 --- a/src/web/app/desktop/tags/user-preview.tag +++ /dev/null @@ -1,149 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/user-timeline.tag b/src/web/app/desktop/tags/user-timeline.tag deleted file mode 100644 index f018ba64e1..0000000000 --- a/src/web/app/desktop/tags/user-timeline.tag +++ /dev/null @@ -1,150 +0,0 @@ - -
    - 投稿投稿と返信 -
    -
    - -
    -

    %fa:R comments%このユーザーはまだ何も投稿していないようです。

    - - - - - - - - -
    diff --git a/src/web/app/desktop/tags/user.tag b/src/web/app/desktop/tags/user.tag deleted file mode 100644 index 8221926f45..0000000000 --- a/src/web/app/desktop/tags/user.tag +++ /dev/null @@ -1,852 +0,0 @@ - -
    -
    - -
    - - -
    - - -
    - - - -
    -
    - avatar -
    -

    { user.name }

    -

    @{ user.username }

    -

    %fa:map-marker%{ user.profile.location }

    -
    - -
    - - -
    - - -
    - -

    %i18n:desktop.tags.mk-user.follows-you%

    -

    %i18n:desktop.tags.mk-user.muted% %i18n:desktop.tags.mk-user.unmute%

    -

    %i18n:desktop.tags.mk-user.mute%

    -
    -
    { user.description }
    -
    -

    %fa:birthday-cake%{ user.profile.birthday.replace('-', '年').replace('-', '月') + '日' } ({ age(user.profile.birthday) }歳)

    -
    - -
    -

    %fa:angle-right%{ user.posts_count }ポスト

    -

    %fa:angle-right%{ user.following_count }人をフォロー

    -

    %fa:angle-right%{ user.followers_count }人のフォロワー

    -
    - - -
    - - -

    %fa:camera%%i18n:desktop.tags.mk-user.photos.title%

    -

    %fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.photos.loading%

    -
    - -
    -

    %i18n:desktop.tags.mk-user.photos.no-photos%

    - - -
    - - -

    %fa:users%%i18n:desktop.tags.mk-user.frequently-replied-users.title%

    -

    %fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.frequently-replied-users.loading%

    -
    - - - -
    - { _user.name } -

    @{ _user.username }

    -
    - -
    -

    %i18n:desktop.tags.mk-user.frequently-replied-users.no-users%

    - - -
    - - -

    %fa:users%%i18n:desktop.tags.mk-user.followers-you-know.title%

    -

    %fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.followers-you-know.loading%

    -
    - -
    -

    %i18n:desktop.tags.mk-user.followers-you-know.no-users%

    - - -
    - - -
    -
    - - - -

    %i18n:desktop.tags.mk-user.last-used-at%:

    -
    -
    -
    - - -
    -
    -
    - - - - -
    -
    - - -
    - - -
    -
    -

    %fa:pencil-alt%投稿

    - -
    -
    -
    -
    -

    フォロー/フォロワー

    - -
    -
    -
    -
    -

    いいね

    - -
    -
    - - -
    - - - - - - - - - -

    直近1年間分の統計です。一番右が現在で、一番左が1年前です。青は通常の投稿、赤は返信、緑はRepostをそれぞれ表しています。

    -

    - だいたい*1日に{ averageOfAllTypePostsEachDays }回投稿(返信、Repost含む)しています。
    - だいたい*1日に{ averageOfPostsEachDays }回投稿(通常の)しています。
    - だいたい*1日に{ averageOfRepliesEachDays }回返信しています。
    - だいたい*1日に{ averageOfRepostsEachDays }回Repostしています。
    -

    -

    * 中央値

    - - - -
    diff --git a/src/web/app/desktop/tags/users-list.tag b/src/web/app/desktop/tags/users-list.tag deleted file mode 100644 index bf002ae552..0000000000 --- a/src/web/app/desktop/tags/users-list.tag +++ /dev/null @@ -1,138 +0,0 @@ - - -
    -
    - -
    -
    - -

    { opts.noUsers }

    -

    %fa:spinner .pulse .fw%読み込んでいます

    - - -
    diff --git a/src/web/app/desktop/tags/widgets/activity.tag b/src/web/app/desktop/tags/widgets/activity.tag deleted file mode 100644 index 8c20ef5a68..0000000000 --- a/src/web/app/desktop/tags/widgets/activity.tag +++ /dev/null @@ -1,246 +0,0 @@ - - -

    %fa:spinner .pulse .fw%%i18n:common.loading%

    - - - - -
    - - - - - { date.year }/{ date.month }/{ date.day }
    Post: { posts }, Reply: { replies }, Repost: { reposts }
    -
    - - -
    - - -
    - - - - Black ... Total
    Blue ... Posts
    Red ... Replies
    Green ... Reposts
    - - - - -
    - - -
    - diff --git a/src/web/app/desktop/tags/widgets/calendar.tag b/src/web/app/desktop/tags/widgets/calendar.tag deleted file mode 100644 index d20180f1c3..0000000000 --- a/src/web/app/desktop/tags/widgets/calendar.tag +++ /dev/null @@ -1,241 +0,0 @@ - - - -
    -
    { weekdayText[i] }
    -
    -
    { i + 1 }
    -
    - - -
    diff --git a/src/web/app/desktop/tags/window.tag b/src/web/app/desktop/tags/window.tag deleted file mode 100644 index 051b43f076..0000000000 --- a/src/web/app/desktop/tags/window.tag +++ /dev/null @@ -1,549 +0,0 @@ - -
    -
    -
    -
    -

    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - -
    -- cgit v1.2.3-freya From 24478a060ef7d1668b6055b494421118b8c1fed1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 9 Feb 2018 13:32:41 +0900 Subject: wip --- package.json | 2 ++ src/web/app/init.ts | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/package.json b/package.json index bd51144807..33a0b2e2da 100644 --- a/package.json +++ b/package.json @@ -172,6 +172,8 @@ "uglifyjs-webpack-plugin": "1.1.8", "uuid": "3.2.1", "vhost": "3.0.2", + "vue": "^2.5.13", + "vue-router": "^3.0.1", "web-push": "3.2.5", "webpack": "3.10.0", "websocket": "1.0.25", diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 154b1ba0f0..62bd6949bb 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -7,11 +7,14 @@ declare const _LANG_: string; declare const _HOST_: string; declare const __CONSTS__: any; -import * as riot from 'riot'; +import Vue from 'vue'; +import VueRouter from 'vue-router'; + +Vue.use(VueRouter); + import checkForUpdate from './common/scripts/check-for-update'; import mixin from './common/mixins'; import MiOS from './common/mios'; -require('./common/tags'); /** * APP ENTRY POINT! -- cgit v1.2.3-freya From b7596e357c373b95d681bbf3f0b12683fa467e71 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 9 Feb 2018 18:28:06 +0900 Subject: wip --- src/tsconfig.json | 4 ++- src/web/app/common/mios.ts | 35 ++++++++++++++++++++----- src/web/app/common/mixins.ts | 40 ---------------------------- src/web/app/common/tags/time.vue | 56 +++++++++++++++++++++++----------------- src/web/app/init.ts | 26 +++++++++---------- tsconfig.json | 4 ++- 6 files changed, 80 insertions(+), 85 deletions(-) delete mode 100644 src/web/app/common/mixins.ts (limited to 'src') diff --git a/src/tsconfig.json b/src/tsconfig.json index 36600eed2b..d88432d243 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -12,7 +12,9 @@ "target": "es2017", "module": "commonjs", "removeComments": false, - "noLib": false + "noLib": false, + "strict": true, + "strictNullChecks": false }, "compileOnSave": false, "include": [ diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index 6ee42ea8a7..b947e0743c 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -4,6 +4,10 @@ import signout from './scripts/signout'; import Progress from './scripts/loading'; import HomeStreamManager from './scripts/streaming/home-stream-manager'; import api from './scripts/api'; +import DriveStreamManager from './scripts/streaming/drive-stream-manager'; +import ServerStreamManager from './scripts/streaming/server-stream-manager'; +import RequestsStreamManager from './scripts/streaming/requests-stream-manager'; +import MessagingIndexStreamManager from './scripts/streaming/messaging-index-stream-manager'; //#region environment variables declare const _VERSION_: string; @@ -50,6 +54,16 @@ export default class MiOS extends EventEmitter { */ public stream: HomeStreamManager; + /** + * Connection managers + */ + public streams: { + driveStream: DriveStreamManager; + serverStream: ServerStreamManager; + requestsStream: RequestsStreamManager; + messagingIndexStream: MessagingIndexStreamManager; + }; + /** * A registration of service worker */ @@ -69,6 +83,9 @@ export default class MiOS extends EventEmitter { this.shouldRegisterSw = shouldRegisterSw; + this.streams.serverStream = new ServerStreamManager(); + this.streams.requestsStream = new RequestsStreamManager(); + //#region BIND this.log = this.log.bind(this); this.logInfo = this.logInfo.bind(this); @@ -79,6 +96,15 @@ export default class MiOS extends EventEmitter { this.getMeta = this.getMeta.bind(this); this.registerSw = this.registerSw.bind(this); //#endregion + + this.once('signedin', () => { + // Init home stream manager + this.stream = new HomeStreamManager(this.i); + + // Init other stream manager + this.streams.driveStream = new DriveStreamManager(this.i); + this.streams.messagingIndexStream = new MessagingIndexStreamManager(this.i); + }); } public log(...args) { @@ -139,8 +165,8 @@ export default class MiOS extends EventEmitter { // When failure .catch(() => { // Render the error screen - document.body.innerHTML = ''; - riot.mount('*'); + //document.body.innerHTML = ''; + //riot.mount('*'); Progress.done(); }); @@ -173,10 +199,7 @@ export default class MiOS extends EventEmitter { this.i = me; - // Init home stream manager - this.stream = this.isSignedin - ? new HomeStreamManager(this.i) - : null; + this.emit('signedin'); // Finish init callback(); diff --git a/src/web/app/common/mixins.ts b/src/web/app/common/mixins.ts deleted file mode 100644 index e9c3625937..0000000000 --- a/src/web/app/common/mixins.ts +++ /dev/null @@ -1,40 +0,0 @@ -import * as riot from 'riot'; - -import MiOS from './mios'; -import ServerStreamManager from './scripts/streaming/server-stream-manager'; -import RequestsStreamManager from './scripts/streaming/requests-stream-manager'; -import MessagingIndexStreamManager from './scripts/streaming/messaging-index-stream-manager'; -import DriveStreamManager from './scripts/streaming/drive-stream-manager'; - -export default (mios: MiOS) => { - (riot as any).mixin('os', { - mios: mios - }); - - (riot as any).mixin('i', { - init: function() { - this.I = mios.i; - this.SIGNIN = mios.isSignedin; - - if (this.SIGNIN) { - this.on('mount', () => { - mios.i.on('updated', this.update); - }); - this.on('unmount', () => { - mios.i.off('updated', this.update); - }); - } - }, - me: mios.i - }); - - (riot as any).mixin('api', { - api: mios.api - }); - - (riot as any).mixin('stream', { stream: mios.stream }); - (riot as any).mixin('drive-stream', { driveStream: new DriveStreamManager(mios.i) }); - (riot as any).mixin('server-stream', { serverStream: new ServerStreamManager() }); - (riot as any).mixin('requests-stream', { requestsStream: new RequestsStreamManager() }); - (riot as any).mixin('messaging-index-stream', { messagingIndexStream: new MessagingIndexStreamManager(mios.i) }); -}; diff --git a/src/web/app/common/tags/time.vue b/src/web/app/common/tags/time.vue index 0239f5422e..7d165fc006 100644 --- a/src/web/app/common/tags/time.vue +++ b/src/web/app/common/tags/time.vue @@ -7,23 +7,43 @@ diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 62bd6949bb..4b2a3b8689 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -30,21 +30,21 @@ if (_HOST_ != 'localhost') { document.domain = _HOST_; } -{ // Set lang attr - const html = document.documentElement; - html.setAttribute('lang', _LANG_); -} - -{ // Set description meta tag - const head = document.getElementsByTagName('head')[0]; - const meta = document.createElement('meta'); - meta.setAttribute('name', 'description'); - meta.setAttribute('content', '%i18n:common.misskey%'); - head.appendChild(meta); -} +//#region Set lang attr +const html = document.documentElement; +html.setAttribute('lang', _LANG_); +//#endregion + +//#region Set description meta tag +const head = document.getElementsByTagName('head')[0]; +const meta = document.createElement('meta'); +meta.setAttribute('name', 'description'); +meta.setAttribute('content', '%i18n:common.misskey%'); +head.appendChild(meta); +//#endregion // Set global configuration -(riot as any).mixin(__CONSTS__); +//(riot as any).mixin(__CONSTS__); // iOSでプライベートモードだとlocalStorageが使えないので既存のメソッドを上書きする try { diff --git a/tsconfig.json b/tsconfig.json index a38ff220b2..68f6809b99 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,9 @@ "target": "es2017", "module": "commonjs", "removeComments": false, - "noLib": false + "noLib": false, + "strict": true, + "strictNullChecks": false }, "compileOnSave": false, "include": [ -- cgit v1.2.3-freya From d5f345c8f97a9e785884aa1f3b17696472e026cf Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 9 Feb 2018 18:57:42 +0900 Subject: wip --- src/web/app/desktop/script.ts | 6 ++---- src/web/app/init.ts | 18 ++++++------------ 2 files changed, 8 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts index b06cb180e1..2d3714d845 100644 --- a/src/web/app/desktop/script.ts +++ b/src/web/app/desktop/script.ts @@ -5,9 +5,7 @@ // Style import './style.styl'; -require('./tags'); -require('./mixins'); -import * as riot from 'riot'; +import Vue from 'vue'; import init from '../init'; import route from './router'; import fuckAdBlock from './scripts/fuck-ad-block'; @@ -18,7 +16,7 @@ import composeNotification from '../common/scripts/compose-notification'; /** * init */ -init(async (mios: MiOS) => { +init(async (mios: MiOS, app: Vue) => { /** * Fuck AD Block */ diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 4b2a3b8689..5fb6ae7908 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -13,7 +13,6 @@ import VueRouter from 'vue-router'; Vue.use(VueRouter); import checkForUpdate from './common/scripts/check-for-update'; -import mixin from './common/mixins'; import MiOS from './common/mios'; /** @@ -64,20 +63,15 @@ export default (callback, sw = false) => { const mios = new MiOS(sw); mios.init(() => { - // ミックスイン初期化 - mixin(mios); - - // ローディング画面クリア - const ini = document.getElementById('ini'); - ini.parentNode.removeChild(ini); - // アプリ基底要素マウント - const app = document.createElement('div'); - app.setAttribute('id', 'app'); - document.body.appendChild(app); + document.body.innerHTML = '
    '; + + const app = new Vue({ + router: new VueRouter() + }).$mount('#app'); try { - callback(mios); + callback(mios, app); } catch (e) { panic(e); } -- cgit v1.2.3-freya From ff7bb97d8ee04a6a56aaea8a09f9b4d7170f2064 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 10 Feb 2018 10:27:05 +0900 Subject: wip --- gulpfile.ts | 2 +- package.json | 4 +- src/api/bot/core.ts | 4 +- src/common/build/i18n.ts | 13 ++++-- src/tsconfig.json | 26 ------------ src/web/app/desktop/mixins/index.ts | 2 - src/web/app/desktop/mixins/user-preview.ts | 66 ----------------------------- src/web/app/desktop/mixins/widget.ts | 31 -------------- src/web/app/desktop/script.ts | 12 +++--- src/web/app/desktop/scripts/autocomplete.ts | 2 +- src/web/app/desktop/tags/pages/index.vue | 3 ++ src/web/app/init.ts | 2 +- src/web/app/tsconfig.json | 23 ++++++++++ src/web/app/v.d.ts | 4 ++ tsconfig.json | 5 ++- webpack/module/rules/index.ts | 4 +- webpack/module/rules/tag.ts | 20 --------- webpack/module/rules/typescript.ts | 6 ++- webpack/module/rules/vue.ts | 9 ++++ webpack/webpack.config.ts | 12 +++--- 20 files changed, 81 insertions(+), 169 deletions(-) delete mode 100644 src/tsconfig.json delete mode 100644 src/web/app/desktop/mixins/index.ts delete mode 100644 src/web/app/desktop/mixins/user-preview.ts delete mode 100644 src/web/app/desktop/mixins/widget.ts create mode 100644 src/web/app/desktop/tags/pages/index.vue create mode 100644 src/web/app/tsconfig.json create mode 100644 src/web/app/v.d.ts delete mode 100644 webpack/module/rules/tag.ts create mode 100644 webpack/module/rules/vue.ts (limited to 'src') diff --git a/gulpfile.ts b/gulpfile.ts index 21870473ed..736507bafb 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -56,7 +56,7 @@ gulp.task('build:js', () => ); gulp.task('build:ts', () => { - const tsProject = ts.createProject('./src/tsconfig.json'); + const tsProject = ts.createProject('./tsconfig.json'); return tsProject .src() diff --git a/package.json b/package.json index 33a0b2e2da..56501266b6 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,6 @@ "accesses": "2.5.0", "animejs": "2.2.0", "autwh": "0.0.1", - "awesome-typescript-loader": "3.4.1", "bcryptjs": "2.4.3", "body-parser": "1.18.2", "cafy": "3.2.1", @@ -165,6 +164,7 @@ "tcp-port-used": "0.1.2", "textarea-caret": "3.0.2", "tmp": "0.0.33", + "ts-loader": "^3.5.0", "ts-node": "4.1.0", "tslint": "5.9.1", "typescript": "2.7.1", @@ -173,7 +173,9 @@ "uuid": "3.2.1", "vhost": "3.0.2", "vue": "^2.5.13", + "vue-loader": "^14.1.1", "vue-router": "^3.0.1", + "vue-template-compiler": "^2.5.13", "web-push": "3.2.5", "webpack": "3.10.0", "websocket": "1.0.25", diff --git a/src/api/bot/core.ts b/src/api/bot/core.ts index ddae6405f5..0a073a3127 100644 --- a/src/api/bot/core.ts +++ b/src/api/bot/core.ts @@ -305,7 +305,7 @@ class TlContext extends Context { private async getTl() { const tl = await require('../endpoints/posts/timeline')({ limit: 5, - max_id: this.next ? this.next : undefined + until_id: this.next ? this.next : undefined }, this.bot.user); if (tl.length > 0) { @@ -357,7 +357,7 @@ class NotificationsContext extends Context { private async getNotifications() { const notifications = await require('../endpoints/i/notifications')({ limit: 5, - max_id: this.next ? this.next : undefined + until_id: this.next ? this.next : undefined }, this.bot.user); if (notifications.length > 0) { diff --git a/src/common/build/i18n.ts b/src/common/build/i18n.ts index 1ae22147c4..500b8814fd 100644 --- a/src/common/build/i18n.ts +++ b/src/common/build/i18n.ts @@ -17,12 +17,19 @@ export default class Replacer { } private get(key: string) { - let text = locale[this.lang]; + const texts = locale[this.lang]; + + if (texts == null) { + console.warn(`lang '${this.lang}' is not supported`); + return key; // Fallback + } + + let text; // Check the key existance const error = key.split('.').some(k => { - if (text.hasOwnProperty(k)) { - text = text[k]; + if (texts.hasOwnProperty(k)) { + text = texts[k]; return false; } else { return true; diff --git a/src/tsconfig.json b/src/tsconfig.json deleted file mode 100644 index d88432d243..0000000000 --- a/src/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "noEmitOnError": false, - "noImplicitAny": false, - "noImplicitReturns": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "noFallthroughCasesInSwitch": true, - "declaration": false, - "sourceMap": false, - "target": "es2017", - "module": "commonjs", - "removeComments": false, - "noLib": false, - "strict": true, - "strictNullChecks": false - }, - "compileOnSave": false, - "include": [ - "./**/*.ts" - ], - "exclude": [ - "./web/app/**/*.ts" - ] -} diff --git a/src/web/app/desktop/mixins/index.ts b/src/web/app/desktop/mixins/index.ts deleted file mode 100644 index e0c94ec5ee..0000000000 --- a/src/web/app/desktop/mixins/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -require('./user-preview'); -require('./widget'); diff --git a/src/web/app/desktop/mixins/user-preview.ts b/src/web/app/desktop/mixins/user-preview.ts deleted file mode 100644 index 614de72bea..0000000000 --- a/src/web/app/desktop/mixins/user-preview.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as riot from 'riot'; - -riot.mixin('user-preview', { - init: function() { - const scan = () => { - this.root.querySelectorAll('[data-user-preview]:not([data-user-preview-attached])') - .forEach(attach.bind(this)); - }; - this.on('mount', scan); - this.on('updated', scan); - } -}); - -function attach(el) { - el.setAttribute('data-user-preview-attached', true); - - const user = el.getAttribute('data-user-preview'); - let tag = null; - let showTimer = null; - let hideTimer = null; - - el.addEventListener('mouseover', () => { - clearTimeout(showTimer); - clearTimeout(hideTimer); - showTimer = setTimeout(show, 500); - }); - - el.addEventListener('mouseleave', () => { - clearTimeout(showTimer); - clearTimeout(hideTimer); - hideTimer = setTimeout(close, 500); - }); - - this.on('unmount', () => { - clearTimeout(showTimer); - clearTimeout(hideTimer); - close(); - }); - - const show = () => { - if (tag) return; - const preview = document.createElement('mk-user-preview'); - const rect = el.getBoundingClientRect(); - const x = rect.left + el.offsetWidth + window.pageXOffset; - const y = rect.top + window.pageYOffset; - preview.style.top = y + 'px'; - preview.style.left = x + 'px'; - preview.addEventListener('mouseover', () => { - clearTimeout(hideTimer); - }); - preview.addEventListener('mouseleave', () => { - clearTimeout(showTimer); - hideTimer = setTimeout(close, 500); - }); - tag = (riot as any).mount(document.body.appendChild(preview), { - user: user - })[0]; - }; - - const close = () => { - if (tag) { - tag.close(); - tag = null; - } - }; -} diff --git a/src/web/app/desktop/mixins/widget.ts b/src/web/app/desktop/mixins/widget.ts deleted file mode 100644 index 04131cd8f0..0000000000 --- a/src/web/app/desktop/mixins/widget.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as riot from 'riot'; - -// ミックスインにオプションを渡せないのアレ -// SEE: https://github.com/riot/riot/issues/2434 - -(riot as any).mixin('widget', { - init: function() { - this.mixin('i'); - this.mixin('api'); - - this.id = this.opts.id; - this.place = this.opts.place; - - if (this.data) { - Object.keys(this.data).forEach(prop => { - this.data[prop] = this.opts.data.hasOwnProperty(prop) ? this.opts.data[prop] : this.data[prop]; - }); - } - }, - - save: function() { - this.update(); - this.api('i/update_home', { - id: this.id, - data: this.data - }).then(() => { - this.I.client_settings.home.find(w => w.id == this.id).data = this.data; - this.I.update(); - }); - } -}); diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts index 2d3714d845..4aef69b077 100644 --- a/src/web/app/desktop/script.ts +++ b/src/web/app/desktop/script.ts @@ -7,12 +7,13 @@ import './style.styl'; import Vue from 'vue'; import init from '../init'; -import route from './router'; import fuckAdBlock from './scripts/fuck-ad-block'; import MiOS from '../common/mios'; import HomeStreamManager from '../common/scripts/streaming/home-stream-manager'; import composeNotification from '../common/scripts/compose-notification'; +import MkIndex from './tags/pages/index.vue'; + /** * init */ @@ -36,8 +37,9 @@ init(async (mios: MiOS, app: Vue) => { } } - // Start routing - route(mios); + app.$router.addRoutes([{ + path: '/', component: MkIndex, props: { os: mios } + }]); }, true); function registerNotifications(stream: HomeStreamManager) { @@ -96,9 +98,9 @@ function registerNotifications(stream: HomeStreamManager) { }); n.onclick = () => { n.close(); - (riot as any).mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), { + /*(riot as any).mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), { user: message.user - }); + });*/ }; setTimeout(n.close.bind(n), 7000); }); diff --git a/src/web/app/desktop/scripts/autocomplete.ts b/src/web/app/desktop/scripts/autocomplete.ts index 9df7aae08d..8f075efdd1 100644 --- a/src/web/app/desktop/scripts/autocomplete.ts +++ b/src/web/app/desktop/scripts/autocomplete.ts @@ -1,4 +1,4 @@ -import getCaretCoordinates = require('textarea-caret'); +import getCaretCoordinates from 'textarea-caret'; import * as riot from 'riot'; /** diff --git a/src/web/app/desktop/tags/pages/index.vue b/src/web/app/desktop/tags/pages/index.vue new file mode 100644 index 0000000000..6bd036fc22 --- /dev/null +++ b/src/web/app/desktop/tags/pages/index.vue @@ -0,0 +1,3 @@ + diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 5fb6ae7908..f0c36f6c12 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -5,7 +5,7 @@ declare const _VERSION_: string; declare const _LANG_: string; declare const _HOST_: string; -declare const __CONSTS__: any; +//declare const __CONSTS__: any; import Vue from 'vue'; import VueRouter from 'vue-router'; diff --git a/src/web/app/tsconfig.json b/src/web/app/tsconfig.json new file mode 100644 index 0000000000..e31b52dab1 --- /dev/null +++ b/src/web/app/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "allowJs": true, + "noEmitOnError": false, + "noImplicitAny": false, + "noImplicitReturns": true, + "noUnusedParameters": false, + "noUnusedLocals": true, + "noFallthroughCasesInSwitch": true, + "declaration": false, + "sourceMap": false, + "target": "es2017", + "module": "commonjs", + "removeComments": false, + "noLib": false, + "strict": true, + "strictNullChecks": false + }, + "compileOnSave": false, + "include": [ + "./**/*.ts" + ] +} diff --git a/src/web/app/v.d.ts b/src/web/app/v.d.ts new file mode 100644 index 0000000000..8f3a240d80 --- /dev/null +++ b/src/web/app/v.d.ts @@ -0,0 +1,4 @@ +declare module "*.vue" { + import Vue from 'vue'; + export default Vue; +} diff --git a/tsconfig.json b/tsconfig.json index 68f6809b99..9d26429c51 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,9 @@ }, "compileOnSave": false, "include": [ - "./gulpfile.ts" + "./src/**/*.ts" + ], + "exclude": [ + "./src/web/app/**/*.ts" ] } diff --git a/webpack/module/rules/index.ts b/webpack/module/rules/index.ts index b02bdef723..093f07330b 100644 --- a/webpack/module/rules/index.ts +++ b/webpack/module/rules/index.ts @@ -3,7 +3,7 @@ import license from './license'; import fa from './fa'; import base64 from './base64'; import themeColor from './theme-color'; -import tag from './tag'; +import vue from './vue'; import stylus from './stylus'; import typescript from './typescript'; @@ -13,7 +13,7 @@ export default lang => [ fa(), base64(), themeColor(), - tag(), + vue(), stylus(), typescript() ]; diff --git a/webpack/module/rules/tag.ts b/webpack/module/rules/tag.ts deleted file mode 100644 index 706af35b40..0000000000 --- a/webpack/module/rules/tag.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Riot tags - */ - -export default () => ({ - test: /\.tag$/, - exclude: /node_modules/, - loader: 'riot-tag-loader', - query: { - hot: false, - style: 'stylus', - expr: false, - compact: true, - parserOptions: { - style: { - compress: true - } - } - } -}); diff --git a/webpack/module/rules/typescript.ts b/webpack/module/rules/typescript.ts index eb2b279a55..2c94137318 100644 --- a/webpack/module/rules/typescript.ts +++ b/webpack/module/rules/typescript.ts @@ -4,5 +4,9 @@ export default () => ({ test: /\.ts$/, - use: 'awesome-typescript-loader' + loader: 'ts-loader', + options: { + configFile: __dirname + '/../../../src/web/app/tsconfig.json', + appendTsSuffixTo: [/\.vue$/] + } }); diff --git a/webpack/module/rules/vue.ts b/webpack/module/rules/vue.ts new file mode 100644 index 0000000000..0d38b4deb3 --- /dev/null +++ b/webpack/module/rules/vue.ts @@ -0,0 +1,9 @@ +/** + * Vue + */ + +export default () => ({ + test: /\.vue$/, + exclude: /node_modules/, + loader: 'vue-loader' +}); diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts index d67b8ef774..4386de3db9 100644 --- a/webpack/webpack.config.ts +++ b/webpack/webpack.config.ts @@ -15,12 +15,12 @@ module.exports = Object.keys(langs).map(lang => { // Entries const entry = { desktop: './src/web/app/desktop/script.ts', - mobile: './src/web/app/mobile/script.ts', - ch: './src/web/app/ch/script.ts', - stats: './src/web/app/stats/script.ts', - status: './src/web/app/status/script.ts', - dev: './src/web/app/dev/script.ts', - auth: './src/web/app/auth/script.ts', + //mobile: './src/web/app/mobile/script.ts', + //ch: './src/web/app/ch/script.ts', + //stats: './src/web/app/stats/script.ts', + //status: './src/web/app/status/script.ts', + //dev: './src/web/app/dev/script.ts', + //auth: './src/web/app/auth/script.ts', sw: './src/web/app/sw.js' }; -- cgit v1.2.3-freya From f339d028d26b5218a77e7b411d98c2dc60c853b4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 10 Feb 2018 10:32:59 +0900 Subject: wip --- src/common/build/i18n.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/common/build/i18n.ts b/src/common/build/i18n.ts index 500b8814fd..5e3c0381a9 100644 --- a/src/common/build/i18n.ts +++ b/src/common/build/i18n.ts @@ -24,12 +24,12 @@ export default class Replacer { return key; // Fallback } - let text; + let text = texts; // Check the key existance const error = key.split('.').some(k => { - if (texts.hasOwnProperty(k)) { - text = texts[k]; + if (text.hasOwnProperty(k)) { + text = text[k]; return false; } else { return true; -- cgit v1.2.3-freya From 29b1541a8e8506cd211026d5cf982a1e66e38dd6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 10 Feb 2018 10:52:26 +0900 Subject: wip --- src/web/app/app.vue | 3 +++ src/web/app/common/mios.ts | 5 +++++ src/web/app/init.ts | 9 +++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/web/app/app.vue (limited to 'src') diff --git a/src/web/app/app.vue b/src/web/app/app.vue new file mode 100644 index 0000000000..497d47003f --- /dev/null +++ b/src/web/app/app.vue @@ -0,0 +1,3 @@ + diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index b947e0743c..4ff2333e8a 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -62,6 +62,11 @@ export default class MiOS extends EventEmitter { serverStream: ServerStreamManager; requestsStream: RequestsStreamManager; messagingIndexStream: MessagingIndexStreamManager; + } = { + driveStream: null, + serverStream: null, + requestsStream: null, + messagingIndexStream: null }; /** diff --git a/src/web/app/init.ts b/src/web/app/init.ts index f0c36f6c12..91797a95ac 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -12,6 +12,8 @@ import VueRouter from 'vue-router'; Vue.use(VueRouter); +import App from './app.vue'; + import checkForUpdate from './common/scripts/check-for-update'; import MiOS from './common/mios'; @@ -64,10 +66,13 @@ export default (callback, sw = false) => { mios.init(() => { // アプリ基底要素マウント - document.body.innerHTML = '
    '; + document.body.innerHTML = '
    '; const app = new Vue({ - router: new VueRouter() + router: new VueRouter({ + mode: 'history' + }), + render: createEl => createEl(App) }).$mount('#app'); try { -- cgit v1.2.3-freya From 08ee9e4eaffa4b6809440ec2cbe4daad084c00df Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 10 Feb 2018 14:56:33 +0900 Subject: wip --- src/web/app/common/mios.ts | 4 +- src/web/app/desktop/router.ts | 2 +- src/web/app/desktop/script.ts | 15 +- src/web/app/desktop/style.styl | 10 +- src/web/app/desktop/tags/home.vue | 372 -------------------------- src/web/app/desktop/tags/pages/index.vue | 3 - src/web/app/desktop/views/components/index.ts | 5 + src/web/app/desktop/views/components/ui.vue | 6 + src/web/app/desktop/views/home.vue | 370 +++++++++++++++++++++++++ src/web/app/desktop/views/pages/home.vue | 17 ++ src/web/app/desktop/views/pages/index.vue | 17 ++ src/web/app/desktop/views/pages/welcome.vue | 119 ++++++++ src/web/app/init.ts | 18 +- src/web/app/mobile/router.ts | 2 +- webpack/module/rules/theme-color.ts | 2 +- 15 files changed, 563 insertions(+), 399 deletions(-) delete mode 100644 src/web/app/desktop/tags/home.vue delete mode 100644 src/web/app/desktop/tags/pages/index.vue create mode 100644 src/web/app/desktop/views/components/index.ts create mode 100644 src/web/app/desktop/views/components/ui.vue create mode 100644 src/web/app/desktop/views/home.vue create mode 100644 src/web/app/desktop/views/pages/home.vue create mode 100644 src/web/app/desktop/views/pages/index.vue create mode 100644 src/web/app/desktop/views/pages/welcome.vue (limited to 'src') diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index 4ff2333e8a..e91def521b 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -38,7 +38,7 @@ export default class MiOS extends EventEmitter { /** * Whether signed in */ - public get isSignedin() { + public get isSignedIn() { return this.i != null; } @@ -251,7 +251,7 @@ export default class MiOS extends EventEmitter { if (!isSwSupported) return; // Reject when not signed in to Misskey - if (!this.isSignedin) return; + if (!this.isSignedIn) return; // When service worker activated navigator.serviceWorker.ready.then(registration => { diff --git a/src/web/app/desktop/router.ts b/src/web/app/desktop/router.ts index ce68c4f2d1..6ba8bda124 100644 --- a/src/web/app/desktop/router.ts +++ b/src/web/app/desktop/router.ts @@ -23,7 +23,7 @@ export default (mios: MiOS) => { route('*', notFound); function index() { - mios.isSignedin ? home() : entrance(); + mios.isSignedIn ? home() : entrance(); } function home() { diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts index 4aef69b077..e4e5f19140 100644 --- a/src/web/app/desktop/script.ts +++ b/src/web/app/desktop/script.ts @@ -5,19 +5,17 @@ // Style import './style.styl'; -import Vue from 'vue'; import init from '../init'; import fuckAdBlock from './scripts/fuck-ad-block'; -import MiOS from '../common/mios'; import HomeStreamManager from '../common/scripts/streaming/home-stream-manager'; import composeNotification from '../common/scripts/compose-notification'; -import MkIndex from './tags/pages/index.vue'; +import MkIndex from './views/pages/index.vue'; /** * init */ -init(async (mios: MiOS, app: Vue) => { +init(async (os, launch) => { /** * Fuck AD Block */ @@ -33,12 +31,17 @@ init(async (mios: MiOS, app: Vue) => { } if ((Notification as any).permission == 'granted') { - registerNotifications(mios.stream); + registerNotifications(os.stream); } } + // Register components + require('./views/components'); + + const app = launch(); + app.$router.addRoutes([{ - path: '/', component: MkIndex, props: { os: mios } + path: '/', component: MkIndex, props: { os } }]); }, true); diff --git a/src/web/app/desktop/style.styl b/src/web/app/desktop/style.styl index c893e2ed67..4d295035f7 100644 --- a/src/web/app/desktop/style.styl +++ b/src/web/app/desktop/style.styl @@ -42,10 +42,10 @@ background rgba(0, 0, 0, 0.2) html + height 100% background #f7f7f7 - // ↓ workaround of https://github.com/riot/riot/issues/2134 - &[data-page='entrance'] - #wait - right auto - left 15px +body + display flex + flex-direction column + min-height 100% diff --git a/src/web/app/desktop/tags/home.vue b/src/web/app/desktop/tags/home.vue deleted file mode 100644 index 981123c56a..0000000000 --- a/src/web/app/desktop/tags/home.vue +++ /dev/null @@ -1,372 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/tags/pages/index.vue b/src/web/app/desktop/tags/pages/index.vue deleted file mode 100644 index 6bd036fc22..0000000000 --- a/src/web/app/desktop/tags/pages/index.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/web/app/desktop/views/components/index.ts b/src/web/app/desktop/views/components/index.ts new file mode 100644 index 0000000000..f628dee883 --- /dev/null +++ b/src/web/app/desktop/views/components/index.ts @@ -0,0 +1,5 @@ +import Vue from 'vue'; + +import ui from './ui.vue'; + +Vue.component('mk-ui', ui); diff --git a/src/web/app/desktop/views/components/ui.vue b/src/web/app/desktop/views/components/ui.vue new file mode 100644 index 0000000000..34ac86f70c --- /dev/null +++ b/src/web/app/desktop/views/components/ui.vue @@ -0,0 +1,6 @@ + diff --git a/src/web/app/desktop/views/home.vue b/src/web/app/desktop/views/home.vue new file mode 100644 index 0000000000..d054127daf --- /dev/null +++ b/src/web/app/desktop/views/home.vue @@ -0,0 +1,370 @@ + + + + + diff --git a/src/web/app/desktop/views/pages/home.vue b/src/web/app/desktop/views/pages/home.vue new file mode 100644 index 0000000000..8a380fad0c --- /dev/null +++ b/src/web/app/desktop/views/pages/home.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/web/app/desktop/views/pages/index.vue b/src/web/app/desktop/views/pages/index.vue new file mode 100644 index 0000000000..dbe77e081b --- /dev/null +++ b/src/web/app/desktop/views/pages/index.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/web/app/desktop/views/pages/welcome.vue b/src/web/app/desktop/views/pages/welcome.vue new file mode 100644 index 0000000000..a99a31d6b1 --- /dev/null +++ b/src/web/app/desktop/views/pages/welcome.vue @@ -0,0 +1,119 @@ + + + + + + + diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 91797a95ac..796a966940 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -61,22 +61,24 @@ if (localStorage.getItem('should-refresh') == 'true') { } // MiOSを初期化してコールバックする -export default (callback, sw = false) => { +export default (callback: (os: MiOS, launch: () => Vue) => void, sw = false) => { const mios = new MiOS(sw); mios.init(() => { // アプリ基底要素マウント document.body.innerHTML = '
    '; - const app = new Vue({ - router: new VueRouter({ - mode: 'history' - }), - render: createEl => createEl(App) - }).$mount('#app'); + const launch = () => { + return new Vue({ + router: new VueRouter({ + mode: 'history' + }), + render: createEl => createEl(App) + }).$mount('#app'); + }; try { - callback(mios, app); + callback(mios, launch); } catch (e) { panic(e); } diff --git a/src/web/app/mobile/router.ts b/src/web/app/mobile/router.ts index afb9aa6201..050fa7fc2b 100644 --- a/src/web/app/mobile/router.ts +++ b/src/web/app/mobile/router.ts @@ -32,7 +32,7 @@ export default (mios: MiOS) => { route('*', notFound); function index() { - mios.isSignedin ? home() : entrance(); + mios.isSignedIn ? home() : entrance(); } function home() { diff --git a/webpack/module/rules/theme-color.ts b/webpack/module/rules/theme-color.ts index 7ee545191c..a65338465a 100644 --- a/webpack/module/rules/theme-color.ts +++ b/webpack/module/rules/theme-color.ts @@ -8,7 +8,7 @@ const constants = require('../../../src/const.json'); export default () => ({ enforce: 'pre', - test: /\.tag$/, + test: /\.vue$/, exclude: /node_modules/, loader: StringReplacePlugin.replace({ replacements: [ -- cgit v1.2.3-freya From dd60907abec23520c96b736bf3d91160e63a67fe Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 10 Feb 2018 15:06:11 +0900 Subject: wip --- src/web/app/desktop/views/pages/welcome.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/web/app/desktop/views/pages/welcome.vue b/src/web/app/desktop/views/pages/welcome.vue index a99a31d6b1..c0e1c0bd4f 100644 --- a/src/web/app/desktop/views/pages/welcome.vue +++ b/src/web/app/desktop/views/pages/welcome.vue @@ -2,7 +2,7 @@
    -

    繋がるNotes

    +

    Share
    Everything!

    ようこそ! MisskeyはTwitter風ミニブログSNSです――思ったこと、共有したいことをシンプルに書き残せます。タイムラインを見れば、皆の反応や皆がどう思っているのかもすぐにわかります。詳しく...

    @@ -50,6 +50,8 @@ > h1 margin 0 font-weight normal + font-variant small-caps + letter-spacing 12px > p margin 0.5em 0 -- cgit v1.2.3-freya From 4f1795b97b43e324d47653c5b172afa984446868 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 10 Feb 2018 16:22:14 +0900 Subject: wip --- package.json | 1 + src/web/app/common/-tags/signin.tag | 155 ---------- src/web/app/common/-tags/signup.tag | 307 ------------------- src/web/app/common/tags/poll.vue | 118 -------- src/web/app/common/tags/reaction-icon.vue | 20 -- src/web/app/common/tags/reaction-picker.vue | 188 ------------ src/web/app/common/tags/reactions-viewer.vue | 49 --- src/web/app/common/tags/stream-indicator.vue | 74 ----- src/web/app/common/tags/time.vue | 63 ---- src/web/app/common/tags/url-preview.vue | 126 -------- src/web/app/common/tags/url.vue | 65 ---- src/web/app/common/views/components/index.ts | 7 + src/web/app/common/views/components/poll.vue | 118 ++++++++ .../app/common/views/components/reaction-icon.vue | 20 ++ .../common/views/components/reaction-picker.vue | 188 ++++++++++++ .../common/views/components/reactions-viewer.vue | 49 +++ src/web/app/common/views/components/signin.vue | 138 +++++++++ src/web/app/common/views/components/signup.vue | 331 +++++++++++++++++++++ .../common/views/components/stream-indicator.vue | 74 +++++ src/web/app/common/views/components/time.vue | 63 ++++ .../app/common/views/components/url-preview.vue | 126 ++++++++ src/web/app/common/views/components/url.vue | 65 ++++ src/web/app/desktop/views/pages/welcome.vue | 158 +++++----- src/web/app/init.ts | 2 + 24 files changed, 1265 insertions(+), 1240 deletions(-) delete mode 100644 src/web/app/common/-tags/signin.tag delete mode 100644 src/web/app/common/-tags/signup.tag delete mode 100644 src/web/app/common/tags/poll.vue delete mode 100644 src/web/app/common/tags/reaction-icon.vue delete mode 100644 src/web/app/common/tags/reaction-picker.vue delete mode 100644 src/web/app/common/tags/reactions-viewer.vue delete mode 100644 src/web/app/common/tags/stream-indicator.vue delete mode 100644 src/web/app/common/tags/time.vue delete mode 100644 src/web/app/common/tags/url-preview.vue delete mode 100644 src/web/app/common/tags/url.vue create mode 100644 src/web/app/common/views/components/index.ts create mode 100644 src/web/app/common/views/components/poll.vue create mode 100644 src/web/app/common/views/components/reaction-icon.vue create mode 100644 src/web/app/common/views/components/reaction-picker.vue create mode 100644 src/web/app/common/views/components/reactions-viewer.vue create mode 100644 src/web/app/common/views/components/signin.vue create mode 100644 src/web/app/common/views/components/signup.vue create mode 100644 src/web/app/common/views/components/stream-indicator.vue create mode 100644 src/web/app/common/views/components/time.vue create mode 100644 src/web/app/common/views/components/url-preview.vue create mode 100644 src/web/app/common/views/components/url.vue (limited to 'src') diff --git a/package.json b/package.json index 56501266b6..fee512c7ff 100644 --- a/package.json +++ b/package.json @@ -173,6 +173,7 @@ "uuid": "3.2.1", "vhost": "3.0.2", "vue": "^2.5.13", + "vue-js-modal": "^1.3.9", "vue-loader": "^14.1.1", "vue-router": "^3.0.1", "vue-template-compiler": "^2.5.13", diff --git a/src/web/app/common/-tags/signin.tag b/src/web/app/common/-tags/signin.tag deleted file mode 100644 index 89213d1f73..0000000000 --- a/src/web/app/common/-tags/signin.tag +++ /dev/null @@ -1,155 +0,0 @@ - -
    - - - - -
    - - -
    diff --git a/src/web/app/common/-tags/signup.tag b/src/web/app/common/-tags/signup.tag deleted file mode 100644 index 99be10609b..0000000000 --- a/src/web/app/common/-tags/signup.tag +++ /dev/null @@ -1,307 +0,0 @@ - -
    - - - - - - -
    - - -
    diff --git a/src/web/app/common/tags/poll.vue b/src/web/app/common/tags/poll.vue deleted file mode 100644 index d85caa00ce..0000000000 --- a/src/web/app/common/tags/poll.vue +++ /dev/null @@ -1,118 +0,0 @@ - - - - - diff --git a/src/web/app/common/tags/reaction-icon.vue b/src/web/app/common/tags/reaction-icon.vue deleted file mode 100644 index 317daf0feb..0000000000 --- a/src/web/app/common/tags/reaction-icon.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - diff --git a/src/web/app/common/tags/reaction-picker.vue b/src/web/app/common/tags/reaction-picker.vue deleted file mode 100644 index dd4d1380b7..0000000000 --- a/src/web/app/common/tags/reaction-picker.vue +++ /dev/null @@ -1,188 +0,0 @@ - - - - - diff --git a/src/web/app/common/tags/reactions-viewer.vue b/src/web/app/common/tags/reactions-viewer.vue deleted file mode 100644 index f6e37caa44..0000000000 --- a/src/web/app/common/tags/reactions-viewer.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - - - diff --git a/src/web/app/common/tags/stream-indicator.vue b/src/web/app/common/tags/stream-indicator.vue deleted file mode 100644 index 0721c77ad7..0000000000 --- a/src/web/app/common/tags/stream-indicator.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - - - diff --git a/src/web/app/common/tags/time.vue b/src/web/app/common/tags/time.vue deleted file mode 100644 index 7d165fc006..0000000000 --- a/src/web/app/common/tags/time.vue +++ /dev/null @@ -1,63 +0,0 @@ - - - diff --git a/src/web/app/common/tags/url-preview.vue b/src/web/app/common/tags/url-preview.vue deleted file mode 100644 index 88158db845..0000000000 --- a/src/web/app/common/tags/url-preview.vue +++ /dev/null @@ -1,126 +0,0 @@ - - - - - diff --git a/src/web/app/common/tags/url.vue b/src/web/app/common/tags/url.vue deleted file mode 100644 index 4cc76f7e24..0000000000 --- a/src/web/app/common/tags/url.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - - - diff --git a/src/web/app/common/views/components/index.ts b/src/web/app/common/views/components/index.ts new file mode 100644 index 0000000000..b1c5df8197 --- /dev/null +++ b/src/web/app/common/views/components/index.ts @@ -0,0 +1,7 @@ +import Vue from 'vue'; + +import signin from './signin.vue'; +import signup from './signup.vue'; + +Vue.component('mk-signin', signin); +Vue.component('mk-signup', signup); diff --git a/src/web/app/common/views/components/poll.vue b/src/web/app/common/views/components/poll.vue new file mode 100644 index 0000000000..d85caa00ce --- /dev/null +++ b/src/web/app/common/views/components/poll.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/src/web/app/common/views/components/reaction-icon.vue b/src/web/app/common/views/components/reaction-icon.vue new file mode 100644 index 0000000000..317daf0feb --- /dev/null +++ b/src/web/app/common/views/components/reaction-icon.vue @@ -0,0 +1,20 @@ + + + diff --git a/src/web/app/common/views/components/reaction-picker.vue b/src/web/app/common/views/components/reaction-picker.vue new file mode 100644 index 0000000000..dd4d1380b7 --- /dev/null +++ b/src/web/app/common/views/components/reaction-picker.vue @@ -0,0 +1,188 @@ + + + + + diff --git a/src/web/app/common/views/components/reactions-viewer.vue b/src/web/app/common/views/components/reactions-viewer.vue new file mode 100644 index 0000000000..f6e37caa44 --- /dev/null +++ b/src/web/app/common/views/components/reactions-viewer.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/src/web/app/common/views/components/signin.vue b/src/web/app/common/views/components/signin.vue new file mode 100644 index 0000000000..5ffc518b3c --- /dev/null +++ b/src/web/app/common/views/components/signin.vue @@ -0,0 +1,138 @@ + + + + + diff --git a/src/web/app/common/views/components/signup.vue b/src/web/app/common/views/components/signup.vue new file mode 100644 index 0000000000..1734f77316 --- /dev/null +++ b/src/web/app/common/views/components/signup.vue @@ -0,0 +1,331 @@ + + + + + + + diff --git a/src/web/app/common/views/components/stream-indicator.vue b/src/web/app/common/views/components/stream-indicator.vue new file mode 100644 index 0000000000..0721c77ad7 --- /dev/null +++ b/src/web/app/common/views/components/stream-indicator.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/src/web/app/common/views/components/time.vue b/src/web/app/common/views/components/time.vue new file mode 100644 index 0000000000..7d165fc006 --- /dev/null +++ b/src/web/app/common/views/components/time.vue @@ -0,0 +1,63 @@ + + + diff --git a/src/web/app/common/views/components/url-preview.vue b/src/web/app/common/views/components/url-preview.vue new file mode 100644 index 0000000000..88158db845 --- /dev/null +++ b/src/web/app/common/views/components/url-preview.vue @@ -0,0 +1,126 @@ + + + + + diff --git a/src/web/app/common/views/components/url.vue b/src/web/app/common/views/components/url.vue new file mode 100644 index 0000000000..4cc76f7e24 --- /dev/null +++ b/src/web/app/common/views/components/url.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/web/app/desktop/views/pages/welcome.vue b/src/web/app/desktop/views/pages/welcome.vue index c0e1c0bd4f..68b5f4cc98 100644 --- a/src/web/app/desktop/views/pages/welcome.vue +++ b/src/web/app/desktop/views/pages/welcome.vue @@ -17,105 +17,113 @@

    { _COPYRIGHT_ }

    + + + - - - diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 796a966940..20ea1df8b2 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -9,8 +9,10 @@ declare const _HOST_: string; import Vue from 'vue'; import VueRouter from 'vue-router'; +import VModal from 'vue-js-modal'; Vue.use(VueRouter); +Vue.use(VModal); import App from './app.vue'; -- cgit v1.2.3-freya From c869883d76455844e8d56ec4e863c6405489f897 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 10 Feb 2018 17:01:32 +0900 Subject: wip --- src/web/app/common/views/components/signin.vue | 2 +- src/web/app/common/views/components/signup.vue | 462 +++++++++++-------------- src/web/app/config.ts | 11 + src/web/app/desktop/views/pages/welcome.vue | 2 +- src/web/app/init.ts | 3 + webpack/module/rules/fa.ts | 2 +- webpack/module/rules/i18n.ts | 2 +- 7 files changed, 222 insertions(+), 262 deletions(-) create mode 100644 src/web/app/config.ts (limited to 'src') diff --git a/src/web/app/common/views/components/signin.vue b/src/web/app/common/views/components/signin.vue index 5ffc518b3c..ee26110a43 100644 --- a/src/web/app/common/views/components/signin.vue +++ b/src/web/app/common/views/components/signin.vue @@ -13,7 +13,7 @@ - - - - - - if (err) { - this.update({ - usernameState: err - }); - return; - } + diff --git a/src/web/app/config.ts b/src/web/app/config.ts new file mode 100644 index 0000000000..8357cf6c72 --- /dev/null +++ b/src/web/app/config.ts @@ -0,0 +1,11 @@ +declare const _HOST_: string; +declare const _URL_: string; +declare const _DOCS_URL_: string; +declare const _LANG_: string; +declare const _RECAPTCHA_SITEKEY_: string; + +export const host = _HOST_; +export const url = _URL_; +export const docsUrl = _DOCS_URL_; +export const lang = _LANG_; +export const recaptchaSitekey = _RECAPTCHA_SITEKEY_; diff --git a/src/web/app/desktop/views/pages/welcome.vue b/src/web/app/desktop/views/pages/welcome.vue index 68b5f4cc98..b47e82faed 100644 --- a/src/web/app/desktop/views/pages/welcome.vue +++ b/src/web/app/desktop/views/pages/welcome.vue @@ -18,7 +18,7 @@ - + diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 20ea1df8b2..3ae2a8adcd 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -70,6 +70,9 @@ export default (callback: (os: MiOS, launch: () => Vue) => void, sw = false) => // アプリ基底要素マウント document.body.innerHTML = '
    '; + // Register global components + require('./common/views/components'); + const launch = () => { return new Vue({ router: new VueRouter({ diff --git a/webpack/module/rules/fa.ts b/webpack/module/rules/fa.ts index 891b78ece2..2679089239 100644 --- a/webpack/module/rules/fa.ts +++ b/webpack/module/rules/fa.ts @@ -7,7 +7,7 @@ import { pattern, replacement } from '../../../src/common/build/fa'; export default () => ({ enforce: 'pre', - test: /\.(tag|js|ts)$/, + test: /\.(vue|js|ts)$/, exclude: /node_modules/, loader: StringReplacePlugin.replace({ replacements: [{ diff --git a/webpack/module/rules/i18n.ts b/webpack/module/rules/i18n.ts index 7261548be5..f8063a311f 100644 --- a/webpack/module/rules/i18n.ts +++ b/webpack/module/rules/i18n.ts @@ -10,7 +10,7 @@ export default lang => { return { enforce: 'pre', - test: /\.(tag|js|ts)$/, + test: /\.(vue|js|ts)$/, exclude: /node_modules/, loader: StringReplacePlugin.replace({ replacements: [{ -- cgit v1.2.3-freya From 7664354187a3847484f2a635e2eecd8a5be0b9f1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 10 Feb 2018 19:57:37 +0900 Subject: wip --- src/web/app/common/views/components/signup.vue | 10 +++++----- src/web/app/desktop/views/pages/welcome.vue | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/web/app/common/views/components/signup.vue b/src/web/app/common/views/components/signup.vue index 723555cdc4..5bb4647854 100644 --- a/src/web/app/common/views/components/signup.vue +++ b/src/web/app/common/views/components/signup.vue @@ -1,5 +1,5 @@ - - diff --git a/src/web/app/common/views/components/index.ts b/src/web/app/common/views/components/index.ts index 968d5d7a96..9097c30814 100644 --- a/src/web/app/common/views/components/index.ts +++ b/src/web/app/common/views/components/index.ts @@ -3,7 +3,9 @@ import Vue from 'vue'; import signin from './signin.vue'; import signup from './signup.vue'; import forkit from './forkit.vue'; +import nav from './nav.vue'; Vue.component('mk-signin', signin); Vue.component('mk-signup', signup); Vue.component('mk-forkit', forkit); +Vue.component('mk-nav', nav); diff --git a/src/web/app/common/views/components/nav.vue b/src/web/app/common/views/components/nav.vue new file mode 100644 index 0000000000..6cd86216cd --- /dev/null +++ b/src/web/app/common/views/components/nav.vue @@ -0,0 +1,35 @@ + + + diff --git a/src/web/app/common/views/components/signin.vue b/src/web/app/common/views/components/signin.vue index fe28ddd24c..989c017054 100644 --- a/src/web/app/common/views/components/signin.vue +++ b/src/web/app/common/views/components/signin.vue @@ -1,5 +1,5 @@ @@ -53,10 +53,7 @@ export default Vue.extend({ @@ -156,4 +156,8 @@ export default Vue.extend({ font-size 1.5em color #777 border-bottom solid 1px #eee + +.nav + a + color #666 -- cgit v1.2.3-freya From cd5786d7fb15f48da353939f8d52f714069fdb01 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 11 Feb 2018 13:02:35 +0900 Subject: wip --- src/web/app/desktop/views/components/home.vue | 364 +++++++++++++++++++++++++ src/web/app/desktop/views/components/index.ts | 2 + src/web/app/desktop/views/home.vue | 370 -------------------------- 3 files changed, 366 insertions(+), 370 deletions(-) create mode 100644 src/web/app/desktop/views/components/home.vue delete mode 100644 src/web/app/desktop/views/home.vue (limited to 'src') diff --git a/src/web/app/desktop/views/components/home.vue b/src/web/app/desktop/views/components/home.vue new file mode 100644 index 0000000000..987f272a09 --- /dev/null +++ b/src/web/app/desktop/views/components/home.vue @@ -0,0 +1,364 @@ + + + + + diff --git a/src/web/app/desktop/views/components/index.ts b/src/web/app/desktop/views/components/index.ts index f628dee883..8c490ef6da 100644 --- a/src/web/app/desktop/views/components/index.ts +++ b/src/web/app/desktop/views/components/index.ts @@ -1,5 +1,7 @@ import Vue from 'vue'; import ui from './ui.vue'; +import home from './home.vue'; Vue.component('mk-ui', ui); +Vue.component('mk-home', home); diff --git a/src/web/app/desktop/views/home.vue b/src/web/app/desktop/views/home.vue deleted file mode 100644 index d054127daf..0000000000 --- a/src/web/app/desktop/views/home.vue +++ /dev/null @@ -1,370 +0,0 @@ - - - - - -- cgit v1.2.3-freya From 7d6a38d455e7b4360ee42956166190d920c7ca8c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 11 Feb 2018 13:09:46 +0900 Subject: wip --- src/web/app/desktop/views/components/home.vue | 20 ++++++++++---------- src/web/app/desktop/views/components/timeline.vue | 0 src/web/app/desktop/views/pages/home.vue | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 src/web/app/desktop/views/components/timeline.vue (limited to 'src') diff --git a/src/web/app/desktop/views/components/home.vue b/src/web/app/desktop/views/components/home.vue index 987f272a09..076cbabe8e 100644 --- a/src/web/app/desktop/views/components/home.vue +++ b/src/web/app/desktop/views/components/home.vue @@ -41,10 +41,10 @@
    @@ -53,24 +53,24 @@
    - - + +
    @@ -79,9 +79,9 @@
    - - diff --git a/src/web/app/desktop/-tags/timeline.tag b/src/web/app/desktop/-tags/timeline.tag deleted file mode 100644 index 7f79d18b47..0000000000 --- a/src/web/app/desktop/-tags/timeline.tag +++ /dev/null @@ -1,704 +0,0 @@ - - -
    - -
    - - -
    - - -
    - -
    -
    -

    - - avatar - - %fa:retweet%{'%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('{'))}{ post.user.name }{'%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr('%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1)} -

    - -
    -
    - - avatar - -
    -
    - { p.user.name } - bot - @{ p.user.username } -
    - via { p.app.name } - - - -
    -
    -
    - -
    - -
    - -
    %fa:quote-right -flip-h% - -
    -
    -
    - - - - - - -
    -
    -
    -
    - -
    - - -
    - - - - - - diff --git a/src/web/app/desktop/views/components/sub-post-content.vue b/src/web/app/desktop/views/components/sub-post-content.vue new file mode 100644 index 0000000000..2463e8a9bb --- /dev/null +++ b/src/web/app/desktop/views/components/sub-post-content.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/src/web/app/desktop/views/components/timeline-post-sub.vue b/src/web/app/desktop/views/components/timeline-post-sub.vue new file mode 100644 index 0000000000..27820901f2 --- /dev/null +++ b/src/web/app/desktop/views/components/timeline-post-sub.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/src/web/app/desktop/views/components/timeline-post.vue b/src/web/app/desktop/views/components/timeline-post.vue new file mode 100644 index 0000000000..a50d0c7bd0 --- /dev/null +++ b/src/web/app/desktop/views/components/timeline-post.vue @@ -0,0 +1,515 @@ + + + + + + diff --git a/src/web/app/desktop/views/components/timeline.vue b/src/web/app/desktop/views/components/timeline.vue index e69de29bb2..1431166a4f 100644 --- a/src/web/app/desktop/views/components/timeline.vue +++ b/src/web/app/desktop/views/components/timeline.vue @@ -0,0 +1,85 @@ + + + + + -- cgit v1.2.3-freya From b427807bf62504d1f249bf36662f7fd3ba87498b Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Sun, 11 Feb 2018 17:04:03 +0900 Subject: wip --- src/web/app/desktop/views/components/timeline.vue | 66 +++++++++-------------- 1 file changed, 24 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/web/app/desktop/views/components/timeline.vue b/src/web/app/desktop/views/components/timeline.vue index 1431166a4f..c9cb7c8f84 100644 --- a/src/web/app/desktop/views/components/timeline.vue +++ b/src/web/app/desktop/views/components/timeline.vue @@ -1,5 +1,5 @@ - - - diff --git a/src/web/app/desktop/views/components/index.ts b/src/web/app/desktop/views/components/index.ts index b2de82b4d4..9788a27f1a 100644 --- a/src/web/app/desktop/views/components/index.ts +++ b/src/web/app/desktop/views/components/index.ts @@ -8,6 +8,7 @@ import timelinePostSub from './timeline-post-sub.vue'; import subPostContent from './sub-post-content.vue'; import window from './window.vue'; import postFormWindow from './post-form-window.vue'; +import repostFormWindow from './repost-form-window.vue'; Vue.component('mk-ui', ui); Vue.component('mk-home', home); @@ -17,3 +18,4 @@ Vue.component('mk-timeline-post-sub', timelinePostSub); Vue.component('mk-sub-post-content', subPostContent); Vue.component('mk-window', window); Vue.component('post-form-window', postFormWindow); +Vue.component('repost-form-window', repostFormWindow); diff --git a/src/web/app/desktop/views/components/post-form-window.vue b/src/web/app/desktop/views/components/post-form-window.vue index f488b6c34b..90e694c922 100644 --- a/src/web/app/desktop/views/components/post-form-window.vue +++ b/src/web/app/desktop/views/components/post-form-window.vue @@ -1,5 +1,5 @@ + + + -- cgit v1.2.3-freya From 99f6e1a2e1f6066b188c3c09486bfa1c0a5302f1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 12 Feb 2018 18:49:06 +0900 Subject: wip --- src/web/app/desktop/-tags/post-form.tag | 540 --------------------- src/web/app/desktop/views/components/post-form.vue | 476 +++++++++++++++++- 2 files changed, 465 insertions(+), 551 deletions(-) delete mode 100644 src/web/app/desktop/-tags/post-form.tag (limited to 'src') diff --git a/src/web/app/desktop/-tags/post-form.tag b/src/web/app/desktop/-tags/post-form.tag deleted file mode 100644 index ddbb485d99..0000000000 --- a/src/web/app/desktop/-tags/post-form.tag +++ /dev/null @@ -1,540 +0,0 @@ - -
    - -
    -
      -
    • -
      - -
    • -
    -

    { 4 - files.length }/4

    -
    - -
    - - - - - -

    { '%i18n:desktop.tags.mk-post-form.text-remain%'.replace('{}', 1000 - refs.text.value.length) }

    - - -
    - - -
    diff --git a/src/web/app/desktop/views/components/post-form.vue b/src/web/app/desktop/views/components/post-form.vue index 52efaf849f..9efca5ddc8 100644 --- a/src/web/app/desktop/views/components/post-form.vue +++ b/src/web/app/desktop/views/components/post-form.vue @@ -1,54 +1,508 @@ + -- cgit v1.2.3-freya From f35f94ef8f02b095eb59ad34b970d21359554cc3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 12 Feb 2018 19:02:19 +0900 Subject: wip --- src/web/app/desktop/-tags/repost-form.tag | 127 -------------------- .../app/desktop/views/components/repost-form.vue | 131 +++++++++++++++++++++ 2 files changed, 131 insertions(+), 127 deletions(-) delete mode 100644 src/web/app/desktop/-tags/repost-form.tag create mode 100644 src/web/app/desktop/views/components/repost-form.vue (limited to 'src') diff --git a/src/web/app/desktop/-tags/repost-form.tag b/src/web/app/desktop/-tags/repost-form.tag deleted file mode 100644 index afe555b6d6..0000000000 --- a/src/web/app/desktop/-tags/repost-form.tag +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - diff --git a/src/web/app/desktop/views/components/repost-form.vue b/src/web/app/desktop/views/components/repost-form.vue new file mode 100644 index 0000000000..9e9f7174f7 --- /dev/null +++ b/src/web/app/desktop/views/components/repost-form.vue @@ -0,0 +1,131 @@ + + + + + -- cgit v1.2.3-freya From c0aec849c3d8c2a545b644f2c346bf61ec9072d8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 12 Feb 2018 19:17:47 +0900 Subject: wip --- src/web/app/desktop/-tags/post-preview.tag | 94 ------------------ .../app/desktop/views/components/post-preview.vue | 108 +++++++++++++++++++++ 2 files changed, 108 insertions(+), 94 deletions(-) delete mode 100644 src/web/app/desktop/-tags/post-preview.tag create mode 100644 src/web/app/desktop/views/components/post-preview.vue (limited to 'src') diff --git a/src/web/app/desktop/-tags/post-preview.tag b/src/web/app/desktop/-tags/post-preview.tag deleted file mode 100644 index eb71e5e879..0000000000 --- a/src/web/app/desktop/-tags/post-preview.tag +++ /dev/null @@ -1,94 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/views/components/post-preview.vue b/src/web/app/desktop/views/components/post-preview.vue new file mode 100644 index 0000000000..fc297dccc8 --- /dev/null +++ b/src/web/app/desktop/views/components/post-preview.vue @@ -0,0 +1,108 @@ + + + + + + -- cgit v1.2.3-freya From 61838246b3b281c571f6a9b25002e1a3b5f31af4 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Mon, 12 Feb 2018 19:59:24 +0900 Subject: wip --- src/web/app/desktop/-tags/ui.tag | 37 ----------------------------- src/web/app/desktop/views/components/ui.vue | 35 +++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/web/app/desktop/-tags/ui.tag b/src/web/app/desktop/-tags/ui.tag index e5008b838f..f8b7b3f4f0 100644 --- a/src/web/app/desktop/-tags/ui.tag +++ b/src/web/app/desktop/-tags/ui.tag @@ -1,40 +1,3 @@ - - - - -
    - -
    - - - -
    diff --git a/src/web/app/desktop/views/components/ui.vue b/src/web/app/desktop/views/components/ui.vue index 34ac86f70c..39ec057f88 100644 --- a/src/web/app/desktop/views/components/ui.vue +++ b/src/web/app/desktop/views/components/ui.vue @@ -1,6 +1,37 @@ + + + -- cgit v1.2.3-freya From dd724b609f892f12aa5ca5fe7f6edde420a70151 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Mon, 12 Feb 2018 21:10:16 +0900 Subject: wip --- src/web/app/desktop/-tags/donation.tag | 66 -- src/web/app/desktop/-tags/ui.tag | 859 --------------------- .../desktop/views/components/ui-header-account.vue | 210 +++++ .../desktop/views/components/ui-header-clock.vue | 109 +++ .../app/desktop/views/components/ui-header-nav.vue | 151 ++++ .../views/components/ui-header-notifications.vue | 156 ++++ .../views/components/ui-header-post-button.vue | 52 ++ .../desktop/views/components/ui-header-search.vue | 68 ++ src/web/app/desktop/views/components/ui-header.vue | 86 +++ .../desktop/views/components/ui-notification.vue | 59 ++ 10 files changed, 891 insertions(+), 925 deletions(-) delete mode 100644 src/web/app/desktop/-tags/donation.tag delete mode 100644 src/web/app/desktop/-tags/ui.tag create mode 100644 src/web/app/desktop/views/components/ui-header-account.vue create mode 100644 src/web/app/desktop/views/components/ui-header-clock.vue create mode 100644 src/web/app/desktop/views/components/ui-header-nav.vue create mode 100644 src/web/app/desktop/views/components/ui-header-notifications.vue create mode 100644 src/web/app/desktop/views/components/ui-header-post-button.vue create mode 100644 src/web/app/desktop/views/components/ui-header-search.vue create mode 100644 src/web/app/desktop/views/components/ui-header.vue create mode 100644 src/web/app/desktop/views/components/ui-notification.vue (limited to 'src') diff --git a/src/web/app/desktop/-tags/donation.tag b/src/web/app/desktop/-tags/donation.tag deleted file mode 100644 index fe446f2e61..0000000000 --- a/src/web/app/desktop/-tags/donation.tag +++ /dev/null @@ -1,66 +0,0 @@ - - -
    -

    利用者の皆さま、

    -

    - 今日は、日本の皆さまにお知らせがあります。 - Misskeyの援助をお願いいたします。 - 私は独立性を守るため、一切の広告を掲載いたしません。 - 平均で約¥1,500の寄付をいただき、運営しております。 - 援助をしてくださる利用者はほんの少数です。 - お願いいたします。 - 今日、利用者の皆さまが¥300ご援助くだされば、募金活動を一時間で終了することができます。 - コーヒー1杯ほどの金額です。 - Misskeyを活用しておられるのでしたら、広告を掲載せずにもう1年活動できるよう、どうか1分だけお時間をください。 - 私は小さな非営利個人ですが、サーバー、プログラム、人件費など、世界でトップクラスのウェブサイト同等のコストがかかります。 - 利用者は何億人といますが、他の大きなサイトに比べてほんの少額の費用で運営しているのです。 - 人間の可能性、自由、そして機会。知識こそ、これらの基盤を成すものです。 - 私は、誰もが無料かつ制限なく知識に触れられるべきだと信じています。 - 募金活動を終了し、Misskeyの改善に戻れるようご援助ください。 - よろしくお願いいたします。 -

    -
    - - -
    diff --git a/src/web/app/desktop/-tags/ui.tag b/src/web/app/desktop/-tags/ui.tag deleted file mode 100644 index f8b7b3f4f0..0000000000 --- a/src/web/app/desktop/-tags/ui.tag +++ /dev/null @@ -1,859 +0,0 @@ - - - - -
    -
    -
    -
    -
    - -
    -
    - - - - - -
    -
    -
    -
    - - -
    - - - - - - - - - - - - - - - -
    - -
    - - -
    - - - - - - - - -
    - -
    -
    - -
    - - -
    - - - - - - - - - -

    { opts.message }

    - - -
    diff --git a/src/web/app/desktop/views/components/ui-header-account.vue b/src/web/app/desktop/views/components/ui-header-account.vue new file mode 100644 index 0000000000..435a0dcaf2 --- /dev/null +++ b/src/web/app/desktop/views/components/ui-header-account.vue @@ -0,0 +1,210 @@ + + + + + diff --git a/src/web/app/desktop/views/components/ui-header-clock.vue b/src/web/app/desktop/views/components/ui-header-clock.vue new file mode 100644 index 0000000000..cfed1e84a6 --- /dev/null +++ b/src/web/app/desktop/views/components/ui-header-clock.vue @@ -0,0 +1,109 @@ + + + + + diff --git a/src/web/app/desktop/views/components/ui-header-nav.vue b/src/web/app/desktop/views/components/ui-header-nav.vue new file mode 100644 index 0000000000..5295787b9f --- /dev/null +++ b/src/web/app/desktop/views/components/ui-header-nav.vue @@ -0,0 +1,151 @@ + + + + + diff --git a/src/web/app/desktop/views/components/ui-header-notifications.vue b/src/web/app/desktop/views/components/ui-header-notifications.vue new file mode 100644 index 0000000000..779ee48864 --- /dev/null +++ b/src/web/app/desktop/views/components/ui-header-notifications.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/src/web/app/desktop/views/components/ui-header-post-button.vue b/src/web/app/desktop/views/components/ui-header-post-button.vue new file mode 100644 index 0000000000..754e05b23f --- /dev/null +++ b/src/web/app/desktop/views/components/ui-header-post-button.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/web/app/desktop/views/components/ui-header-search.vue b/src/web/app/desktop/views/components/ui-header-search.vue new file mode 100644 index 0000000000..a9cddd8aed --- /dev/null +++ b/src/web/app/desktop/views/components/ui-header-search.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/web/app/desktop/views/components/ui-header.vue b/src/web/app/desktop/views/components/ui-header.vue new file mode 100644 index 0000000000..19e4fe697f --- /dev/null +++ b/src/web/app/desktop/views/components/ui-header.vue @@ -0,0 +1,86 @@ + + + diff --git a/src/web/app/desktop/views/components/ui-notification.vue b/src/web/app/desktop/views/components/ui-notification.vue new file mode 100644 index 0000000000..f240037d0b --- /dev/null +++ b/src/web/app/desktop/views/components/ui-notification.vue @@ -0,0 +1,59 @@ + + + + + -- cgit v1.2.3-freya From d3a0546390109922a22c17220d2bde53de333bc2 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Mon, 12 Feb 2018 22:07:28 +0900 Subject: wip --- src/web/app/desktop/-tags/analog-clock.tag | 95 ------------------ .../app/desktop/views/components/analog-clock.vue | 108 +++++++++++++++++++++ 2 files changed, 108 insertions(+), 95 deletions(-) delete mode 100644 src/web/app/desktop/-tags/analog-clock.tag create mode 100644 src/web/app/desktop/views/components/analog-clock.vue (limited to 'src') diff --git a/src/web/app/desktop/-tags/analog-clock.tag b/src/web/app/desktop/-tags/analog-clock.tag deleted file mode 100644 index 6b2bce3b2c..0000000000 --- a/src/web/app/desktop/-tags/analog-clock.tag +++ /dev/null @@ -1,95 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/views/components/analog-clock.vue b/src/web/app/desktop/views/components/analog-clock.vue new file mode 100644 index 0000000000..a45bafda62 --- /dev/null +++ b/src/web/app/desktop/views/components/analog-clock.vue @@ -0,0 +1,108 @@ + + + + + -- cgit v1.2.3-freya From ff6ca604f7d6b4125a915e4190efcbbfb0dd42b8 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Mon, 12 Feb 2018 22:18:13 +0900 Subject: wip --- src/web/app/desktop/-tags/settings.tag | 129 -------------------- src/web/app/desktop/views/components/settings.vue | 136 ++++++++++++++++++++++ 2 files changed, 136 insertions(+), 129 deletions(-) create mode 100644 src/web/app/desktop/views/components/settings.vue (limited to 'src') diff --git a/src/web/app/desktop/-tags/settings.tag b/src/web/app/desktop/-tags/settings.tag index 4bf210cef4..f4e2910d88 100644 --- a/src/web/app/desktop/-tags/settings.tag +++ b/src/web/app/desktop/-tags/settings.tag @@ -1,132 +1,3 @@ - - -
    -
    -

    %i18n:desktop.tags.mk-settings.profile%

    - -
    - -
    -

    デザイン

    - ホームをカスタマイズ -
    - -
    -

    %i18n:desktop.tags.mk-settings.drive%

    - -
    - -
    -

    %i18n:desktop.tags.mk-settings.mute%

    - -
    - -
    -

    アプリケーション

    - -
    - - - -
    -

    %i18n:desktop.tags.mk-settings.password%

    - -
    - -
    -

    %i18n:desktop.tags.mk-settings.2fa%

    - -
    - - - -
    -

    API

    - -
    - -
    -

    %i18n:desktop.tags.mk-settings.license%

    - %license% -
    -
    - - -
    diff --git a/src/web/app/desktop/-tags/pages/entrance.tag b/src/web/app/desktop/-tags/pages/entrance.tag deleted file mode 100644 index 56cec34909..0000000000 --- a/src/web/app/desktop/-tags/pages/entrance.tag +++ /dev/null @@ -1,342 +0,0 @@ - -
    -
    -

    どこにいても、ここにあります

    -

    ようこそ! MisskeyはTwitter風ミニブログSNSです――思ったこと、共有したいことをシンプルに書き残せます。タイムラインを見れば、皆の反応や皆がどう思っているのかもすぐにわかります。

    -

    これまでに{ stats.posts_count }投稿されました

    -
    -
    - - -
    - - -
    -
    -
    - -
    -
    - -

    { _COPYRIGHT_ }

    -
    -
    - - - - -
    - - - %fa:question% -
    -

    -

    { user ? user.name : 'アカウント' }

    -

    - -
    - Twitterでサインイン -
    or
    - Misskeyについて - - -
    - - - - - - diff --git a/src/web/app/desktop/views/components/ellipsis-icon.vue b/src/web/app/desktop/views/components/ellipsis-icon.vue new file mode 100644 index 0000000000..c54a7db29d --- /dev/null +++ b/src/web/app/desktop/views/components/ellipsis-icon.vue @@ -0,0 +1,37 @@ + + + diff --git a/src/web/app/desktop/views/components/index.ts b/src/web/app/desktop/views/components/index.ts index 71a049a62c..a529537442 100644 --- a/src/web/app/desktop/views/components/index.ts +++ b/src/web/app/desktop/views/components/index.ts @@ -11,13 +11,15 @@ import uiHeaderSearch from './ui-header-search.vue'; import uiNotification from './ui-notification.vue'; import home from './home.vue'; import timeline from './timeline.vue'; -import timelinePost from './timeline-post.vue'; -import timelinePostSub from './timeline-post-sub.vue'; +import posts from './posts.vue'; +import postsPost from './posts-post.vue'; +import postsPostSub from './posts-post-sub.vue'; import subPostContent from './sub-post-content.vue'; import window from './window.vue'; import postFormWindow from './post-form-window.vue'; import repostFormWindow from './repost-form-window.vue'; import analogClock from './analog-clock.vue'; +import ellipsisIcon from './ellipsis-icon.vue'; Vue.component('mk-ui', ui); Vue.component('mk-ui-header', uiHeader); @@ -30,10 +32,12 @@ Vue.component('mk-ui-header-search', uiHeaderSearch); Vue.component('mk-ui-notification', uiNotification); Vue.component('mk-home', home); Vue.component('mk-timeline', timeline); -Vue.component('mk-timeline-post', timelinePost); -Vue.component('mk-timeline-post-sub', timelinePostSub); +Vue.component('mk-posts', posts); +Vue.component('mk-posts-post', postsPost); +Vue.component('mk-posts-post-sub', postsPostSub); Vue.component('mk-sub-post-content', subPostContent); Vue.component('mk-window', window); Vue.component('mk-post-form-window', postFormWindow); Vue.component('mk-repost-form-window', repostFormWindow); Vue.component('mk-analog-clock', analogClock); +Vue.component('mk-ellipsis-icon', ellipsisIcon); diff --git a/src/web/app/desktop/views/components/posts-post-sub.vue b/src/web/app/desktop/views/components/posts-post-sub.vue new file mode 100644 index 0000000000..89aeb04829 --- /dev/null +++ b/src/web/app/desktop/views/components/posts-post-sub.vue @@ -0,0 +1,113 @@ + + + + + diff --git a/src/web/app/desktop/views/components/posts-post.vue b/src/web/app/desktop/views/components/posts-post.vue new file mode 100644 index 0000000000..9991d145e4 --- /dev/null +++ b/src/web/app/desktop/views/components/posts-post.vue @@ -0,0 +1,501 @@ + + + + + + diff --git a/src/web/app/desktop/views/components/posts.vue b/src/web/app/desktop/views/components/posts.vue new file mode 100644 index 0000000000..b685bff6af --- /dev/null +++ b/src/web/app/desktop/views/components/posts.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/web/app/desktop/views/components/timeline-post-sub.vue b/src/web/app/desktop/views/components/timeline-post-sub.vue deleted file mode 100644 index 1209396996..0000000000 --- a/src/web/app/desktop/views/components/timeline-post-sub.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - diff --git a/src/web/app/desktop/views/components/timeline-post.vue b/src/web/app/desktop/views/components/timeline-post.vue deleted file mode 100644 index 6c3d525d59..0000000000 --- a/src/web/app/desktop/views/components/timeline-post.vue +++ /dev/null @@ -1,501 +0,0 @@ - - - - - - diff --git a/src/web/app/desktop/views/components/timeline.vue b/src/web/app/desktop/views/components/timeline.vue index c580e59f66..b24e78fe45 100644 --- a/src/web/app/desktop/views/components/timeline.vue +++ b/src/web/app/desktop/views/components/timeline.vue @@ -1,12 +1,11 @@ @@ -15,28 +14,85 @@ import Vue from 'vue'; export default Vue.extend({ props: { - posts: { - type: Array, - default: [] + date: { + type: Date, + required: false } }, + data() { + return { + fetching: true, + moreFetching: false, + posts: [], + connection: null, + connectionId: null + }; + }, computed: { - _posts(): any[] { - return this.posts.map(post => { - const date = new Date(post.created_at).getDate(); - const month = new Date(post.created_at).getMonth() + 1; - post._date = date; - post._datetext = `${month}月 ${date}日`; - return post; - }); - }, - tail(): any { - return this.posts[this.posts.length - 1]; + alone(): boolean { + return this.$root.$data.os.i.following_count == 0; } }, + mounted() { + this.connection = this.$root.$data.os.stream.getConnection(); + this.connectionId = this.$root.$data.os.stream.use(); + + this.connection.on('post', this.onPost); + this.connection.on('follow', this.onChangeFollowing); + this.connection.on('unfollow', this.onChangeFollowing); + + document.addEventListener('keydown', this.onKeydown); + window.addEventListener('scroll', this.onScroll); + + this.fetch(); + }, + beforeDestroy() { + this.connection.off('post', this.onPost); + this.connection.off('follow', this.onChangeFollowing); + this.connection.off('unfollow', this.onChangeFollowing); + this.$root.$data.os.stream.dispose(this.connectionId); + + document.removeEventListener('keydown', this.onKeydown); + window.removeEventListener('scroll', this.onScroll); + }, methods: { - focus() { - (this.$el as any).children[0].focus(); + fetch(cb?) { + this.fetching = true; + + this.$root.$data.os.api('posts/timeline', { + until_date: this.date ? (this.date as any).getTime() : undefined + }).then(posts => { + this.fetching = false; + this.posts = posts; + if (cb) cb(); + }); + }, + more() { + if (this.moreFetching || this.fetching || this.posts.length == 0) return; + this.moreFetching = true; + this.$root.$data.os.api('posts/timeline', { + until_id: this.posts[this.posts.length - 1].id + }).then(posts => { + this.moreFetching = false; + this.posts.unshift(posts); + }); + }, + onPost(post) { + this.posts.unshift(post); + }, + onChangeFollowing() { + this.fetch(); + }, + onScroll() { + const current = window.scrollY + window.innerHeight; + if (current > document.body.offsetHeight - 8) this.more(); + }, + onKeydown(e) { + if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') { + if (e.which == 84) { // t + (this.$refs.timeline as any).focus(); + } + } } } }); @@ -44,29 +100,28 @@ export default Vue.extend({ -- cgit v1.2.3-freya From e8affdc730b39ba749f14cd7db05dfd68343e767 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 13 Feb 2018 09:27:57 +0900 Subject: wip --- src/web/app/common/views/components/post-menu.vue | 2 +- .../common/views/components/reaction-picker.vue | 2 +- .../common/views/components/stream-indicator.vue | 2 +- src/web/app/desktop/-tags/contextmenu.tag | 2 +- src/web/app/desktop/-tags/detailed-post-window.tag | 2 +- src/web/app/desktop/-tags/dialog.tag | 2 +- src/web/app/desktop/-tags/drive/file.tag | 2 +- .../app/desktop/-tags/home-widgets/slideshow.tag | 2 +- src/web/app/desktop/-tags/home-widgets/tips.tag | 2 +- src/web/app/desktop/-tags/user-preview.tag | 2 +- .../views/components/images-image-dialog.vue | 2 +- .../app/desktop/views/components/images-image.vue | 14 +++--- src/web/app/desktop/views/components/images.vue | 58 +++++++++++----------- src/web/app/desktop/views/components/index.ts | 6 +++ src/web/app/desktop/views/components/posts.vue | 2 +- .../desktop/views/components/ui-notification.vue | 2 +- src/web/app/desktop/views/components/window.vue | 2 +- src/web/app/mobile/tags/notify.tag | 2 +- 18 files changed, 58 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/web/app/common/views/components/post-menu.vue b/src/web/app/common/views/components/post-menu.vue index 078e4745a4..7a33360f60 100644 --- a/src/web/app/common/views/components/post-menu.vue +++ b/src/web/app/common/views/components/post-menu.vue @@ -9,7 +9,7 @@ - diff --git a/src/web/app/common/views/components/messaging.vue b/src/web/app/common/views/components/messaging.vue new file mode 100644 index 0000000000..2e81325cb3 --- /dev/null +++ b/src/web/app/common/views/components/messaging.vue @@ -0,0 +1,448 @@ + + + + + + -- cgit v1.2.3-freya From 1136457fb811b0fd192df9474f2919228a714305 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 13 Feb 2018 12:21:02 +0900 Subject: wip --- src/web/app/common/views/components/messaging.vue | 49 ++++++++++++++--------- 1 file changed, 29 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/web/app/common/views/components/messaging.vue b/src/web/app/common/views/components/messaging.vue index 2e81325cb3..386e705b01 100644 --- a/src/web/app/common/views/components/messaging.vue +++ b/src/web/app/common/views/components/messaging.vue @@ -6,38 +6,45 @@
    -
      -
    1. +
    2. - - { user.name } - @{ user.username } + + {{ user.name }} + @{{ user.username }}
    -
    - @@ -123,26 +130,29 @@ export default Vue.extend({ } }, onSearchResultKeydown(i, e) { + const list = this.$refs.searchResult as any; + const cancel = () => { e.preventDefault(); e.stopPropagation(); }; + switch (true) { case e.which == 27: // [ESC] cancel(); - this.$refs.search.focus(); + (this.$refs.search as any).focus(); break; case e.which == 9 && e.shiftKey: // [TAB] + [Shift] case e.which == 38: // [↑] cancel(); - (this.$refs.searchResult.childNodes[i].previousElementSibling || this.$refs.searchResult.childNodes[this.searchResult.length - 1]).focus(); + (list.childNodes[i].previousElementSibling || list.childNodes[this.result.length - 1]).focus(); break; case e.which == 9: // [TAB] case e.which == 40: // [↓] cancel(); - (this.$refs.searchResult.childNodes[i].nextElementSibling || this.$refs.searchResult.childNodes[0]).focus(); + (list.childNodes[i].nextElementSibling || list.childNodes[0]).focus(); break; } } @@ -150,7 +160,6 @@ export default Vue.extend({ }); - - - diff --git a/src/web/app/common/views/components/messaging-room.vue b/src/web/app/common/views/components/messaging-room.vue new file mode 100644 index 0000000000..2fb6671b8c --- /dev/null +++ b/src/web/app/common/views/components/messaging-room.vue @@ -0,0 +1,314 @@ + + + + + diff --git a/src/web/app/desktop/views/components/posts.vue b/src/web/app/desktop/views/components/posts.vue index 880ee52242..6c73731bf5 100644 --- a/src/web/app/desktop/views/components/posts.vue +++ b/src/web/app/desktop/views/components/posts.vue @@ -2,7 +2,7 @@