From fe98dd927de6906671dfd3aa9671080ab6a065c6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 7 Oct 2017 06:58:50 +0900 Subject: :v: --- webpack/module/rules/index.ts | 4 +++- webpack/module/rules/typescript.ts | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 webpack/module/rules/typescript.ts (limited to 'webpack') diff --git a/webpack/module/rules/index.ts b/webpack/module/rules/index.ts index 2308f4e535..2707a9c2f1 100644 --- a/webpack/module/rules/index.ts +++ b/webpack/module/rules/index.ts @@ -2,10 +2,12 @@ import i18n from './i18n'; import themeColor from './theme-color'; import tag from './tag'; import stylus from './stylus'; +import typescript from './typescript'; export default (lang, locale) => [ i18n(lang, locale), themeColor(), tag(), - stylus() + stylus(), + typescript() ]; diff --git a/webpack/module/rules/typescript.ts b/webpack/module/rules/typescript.ts new file mode 100644 index 0000000000..eb2b279a55 --- /dev/null +++ b/webpack/module/rules/typescript.ts @@ -0,0 +1,8 @@ +/** + * TypeScript + */ + +export default () => ({ + test: /\.ts$/, + use: 'awesome-typescript-loader' +}); -- cgit v1.2.3-freya From 5f40e7eaa46fd8a3f60d2306a21364e38db73012 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Sun, 22 Oct 2017 14:11:28 +0900 Subject: オフラインでも画像を表示できるようにbase64にして埋め込むようにした MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/web/app/common/tags/error.tag | 2 +- webpack/module/rules/base64.ts | 19 +++++++++++++++++++ webpack/module/rules/index.ts | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 webpack/module/rules/base64.ts (limited to 'webpack') diff --git a/src/web/app/common/tags/error.tag b/src/web/app/common/tags/error.tag index e4e0272a49..a06f17cd1c 100644 --- a/src/web/app/common/tags/error.tag +++ b/src/web/app/common/tags/error.tag @@ -1,5 +1,5 @@ - +

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

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

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

diff --git a/webpack/module/rules/base64.ts b/webpack/module/rules/base64.ts new file mode 100644 index 0000000000..529816bd20 --- /dev/null +++ b/webpack/module/rules/base64.ts @@ -0,0 +1,19 @@ +/** + * Replace base64 symbols + */ + +import * as fs from 'fs'; +const StringReplacePlugin = require('string-replace-webpack-plugin'); + +export default () => ({ + enforce: 'pre', + test: /\.(tag|js)$/, + exclude: /node_modules/, + loader: StringReplacePlugin.replace({ + replacements: [{ + pattern: /%base64:(.+?)%/g, replacement: (_, key) => { + return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64'); + } + }] + }) +}); diff --git a/webpack/module/rules/index.ts b/webpack/module/rules/index.ts index 2707a9c2f1..9c1262b3d6 100644 --- a/webpack/module/rules/index.ts +++ b/webpack/module/rules/index.ts @@ -1,4 +1,5 @@ import i18n from './i18n'; +import base64 from './base64'; import themeColor from './theme-color'; import tag from './tag'; import stylus from './stylus'; @@ -6,6 +7,7 @@ import typescript from './typescript'; export default (lang, locale) => [ i18n(lang, locale), + base64(), themeColor(), tag(), stylus(), -- cgit v1.2.3-freya From 866d5428bcb06b4978f8039fe7197c560559d1aa Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 22 Oct 2017 15:01:02 +0900 Subject: Use uglifyjs-webpack-plugin instead of uglify-es-webpack-plugin Because uglify-es-webpack-plugin is now deprecated --- package.json | 8 ++++---- webpack/plugins/index.ts | 8 +++----- webpack/plugins/minify.ts | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'webpack') diff --git a/package.json b/package.json index e6fc742913..befa8b2b4e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "misskey", "author": "syuilo ", - "version": "0.0.2584", + "version": "0.0.2732", "license": "MIT", "description": "A miniblog-based SNS", "bugs": "https://github.com/syuilo/misskey/issues", @@ -64,7 +64,7 @@ "@types/webpack": "3.0.13", "@types/webpack-stream": "3.2.7", "@types/websocket": "0.0.34", - "awesome-typescript-loader": "^3.2.3", + "awesome-typescript-loader": "3.2.3", "chai": "4.1.2", "chai-http": "3.0.0", "css-loader": "0.28.7", @@ -90,8 +90,8 @@ "swagger-jsdoc": "1.9.7", "tslint": "5.7.0", "uglify-es": "3.0.27", - "uglify-es-webpack-plugin": "0.10.0", "uglify-js": "git+https://github.com/mishoo/UglifyJS2.git#harmony", + "uglifyjs-webpack-plugin": "1.0.0-beta.2", "webpack": "3.8.1" }, "dependencies": { @@ -109,7 +109,7 @@ "debug": "3.1.0", "deep-equal": "1.0.1", "deepcopy": "0.6.3", - "diskusage": "^0.2.2", + "diskusage": "0.2.2", "download": "6.2.5", "elasticsearch": "13.3.1", "escape-regexp": "0.0.1", diff --git a/webpack/plugins/index.ts b/webpack/plugins/index.ts index 99b16c2b05..d5191f1555 100644 --- a/webpack/plugins/index.ts +++ b/webpack/plugins/index.ts @@ -2,13 +2,11 @@ const StringReplacePlugin = require('string-replace-webpack-plugin'); import constant from './const'; import hoist from './hoist'; -//import minify from './minify'; +import minify from './minify'; import banner from './banner'; -/* const env = process.env.NODE_ENV; const isProduction = env === 'production'; -*/ export default version => { const plugins = [ @@ -16,11 +14,11 @@ export default version => { new StringReplacePlugin(), hoist() ]; -/* + if (isProduction) { plugins.push(minify()); } -*/ + plugins.push(banner(version)); return plugins; diff --git a/webpack/plugins/minify.ts b/webpack/plugins/minify.ts index ec4c9b3405..e46d4c5a10 100644 --- a/webpack/plugins/minify.ts +++ b/webpack/plugins/minify.ts @@ -1,3 +1,3 @@ -const UglifyEsPlugin = require('uglify-es-webpack-plugin'); +const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); -export default () => new UglifyEsPlugin(); +export default () => new UglifyJsPlugin(); -- cgit v1.2.3-freya From 4cac6316f77e4c31d8caa1e7bb74ea9a063e02c7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 25 Oct 2017 20:29:14 +0900 Subject: [Client] Fix bug --- webpack/module/rules/i18n.ts | 70 ++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 29 deletions(-) (limited to 'webpack') diff --git a/webpack/module/rules/i18n.ts b/webpack/module/rules/i18n.ts index 3023253cab..9a4acde686 100644 --- a/webpack/module/rules/i18n.ts +++ b/webpack/module/rules/i18n.ts @@ -4,34 +4,46 @@ const StringReplacePlugin = require('string-replace-webpack-plugin'); -export default (lang, locale) => ({ - enforce: 'pre', - test: /\.(tag|js)$/, - exclude: /node_modules/, - loader: StringReplacePlugin.replace({ - replacements: [ - { +export default (lang, locale) => { + function get(key: string) { + let text = locale; + + // Check the key existance + const error = key.split('.').some(k => { + if (text.hasOwnProperty(k)) { + text = text[k]; + return false; + } else { + return true; + } + }); + + if (error) { + console.warn(`key '${key}' not found in '${lang}'`); + return key; // Fallback + } else { + return text; + } + } + + return { + enforce: 'pre', + test: /\.(tag|js)$/, + exclude: /node_modules/, + loader: StringReplacePlugin.replace({ + replacements: [{ + pattern: /"%i18n:(.+?)%"/g, replacement: (_, key) => { + return '"' + get(key).replace(/"/g, '\\"') + '"'; + } + }, { + pattern: /'%i18n:(.+?)%'/g, replacement: (_, key) => { + return '\'' + get(key).replace(/'/g, '\\\'') + '\''; + } + }, { pattern: /%i18n:(.+?)%/g, replacement: (_, key) => { - let text = locale; - - // Check the key existance - const error = key.split('.').some(k => { - if (text.hasOwnProperty(k)) { - text = text[k]; - return false; - } else { - return true; - } - }); - - if (error) { - console.warn(`key '${key}' not found in '${lang}'`); - return key; // Fallback - } else { - return text.replace(/'/g, '\\\'').replace(/"/g, '\\"'); - } + return get(key); } - } - ] - }) -}); + }] + }) + }; +}; -- cgit v1.2.3-freya From f37fb38640a31c4b8865a5562628197ff21f3cce Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 1 Nov 2017 03:17:14 +0900 Subject: wip --- docs/setup.en.md | 1 + docs/setup.ja.md | 1 + locales/en.yml | 13 +- locales/ja.yml | 13 +- src/api/endpoints/posts/create.ts | 7 +- src/api/event.ts | 6 + src/api/stream/channel.ts | 12 ++ src/api/streaming.ts | 22 +-- src/config.ts | 2 + src/web/app/ch/router.js | 32 +++++ src/web/app/ch/script.js | 18 +++ src/web/app/ch/style.styl | 4 + src/web/app/ch/tags/channel.tag | 204 +++++++++++++++++++++++++++ src/web/app/ch/tags/index.js | 2 + src/web/app/ch/tags/index.tag | 24 ++++ src/web/app/common/scripts/channel-stream.js | 6 +- src/web/app/common/scripts/config.js | 2 + src/web/app/desktop/router.js | 12 -- src/web/app/desktop/tags/index.js | 2 - src/web/app/desktop/tags/pages/channel.tag | 184 ------------------------ src/web/app/desktop/tags/pages/channels.tag | 28 ---- src/web/app/desktop/tags/timeline.tag | 2 +- src/web/app/desktop/tags/ui.tag | 6 +- src/web/app/mobile/tags/timeline.tag | 2 +- src/web/app/mobile/tags/ui.tag | 5 +- webpack/webpack.config.ts | 1 + 26 files changed, 357 insertions(+), 254 deletions(-) create mode 100644 src/api/stream/channel.ts create mode 100644 src/web/app/ch/router.js create mode 100644 src/web/app/ch/script.js create mode 100644 src/web/app/ch/style.styl create mode 100644 src/web/app/ch/tags/channel.tag create mode 100644 src/web/app/ch/tags/index.js create mode 100644 src/web/app/ch/tags/index.tag delete mode 100644 src/web/app/desktop/tags/pages/channel.tag delete mode 100644 src/web/app/desktop/tags/pages/channels.tag (limited to 'webpack') diff --git a/docs/setup.en.md b/docs/setup.en.md index 3e48935346..dbc0599b5a 100644 --- a/docs/setup.en.md +++ b/docs/setup.en.md @@ -25,6 +25,7 @@ Note that Misskey uses following subdomains: * **api**.*{primary domain}* * **auth**.*{primary domain}* * **about**.*{primary domain}* +* **ch**.*{primary domain}* * **stats**.*{primary domain}* * **status**.*{primary domain}* * **dev**.*{primary domain}* diff --git a/docs/setup.ja.md b/docs/setup.ja.md index 4f48a08088..602fd9b6a1 100644 --- a/docs/setup.ja.md +++ b/docs/setup.ja.md @@ -26,6 +26,7 @@ Misskeyは以下のサブドメインを使います: * **api**.*{primary domain}* * **auth**.*{primary domain}* * **about**.*{primary domain}* +* **ch**.*{primary domain}* * **stats**.*{primary domain}* * **status**.*{primary domain}* * **dev**.*{primary domain}* diff --git a/locales/en.yml b/locales/en.yml index 5c7a1165ba..643649b46c 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -164,6 +164,12 @@ common: mk-uploader: waiting: "Waiting" +ch: + tags: + mk-index: + new: "Create new channel" + channel-title: "Channel title" + desktop: tags: mk-api-info: @@ -241,7 +247,7 @@ desktop: mk-ui-header-nav: home: "Home" messaging: "Messages" - channels: "Channels" + ch: "Channels" info: "News" mk-ui-header-search: @@ -352,10 +358,6 @@ desktop: mk-repost-form-window: title: "Are you sure you want to repost this post?" - mk-channels-page: - new: "Create new channel" - channel-title: "Channel title" - mobile: tags: mk-drive-file-viewer: @@ -496,6 +498,7 @@ mobile: home: "Home" notifications: "Notifications" messaging: "Messages" + ch: "Channels" drive: "Drive" settings: "Settings" about: "About Misskey" diff --git a/locales/ja.yml b/locales/ja.yml index dd76a2b900..9fd7d94f0b 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -164,6 +164,12 @@ common: mk-uploader: waiting: "待機中" +ch: + tags: + mk-index: + new: "チャンネルを作成" + channel-title: "チャンネルのタイトル" + desktop: tags: mk-api-info: @@ -241,7 +247,7 @@ desktop: mk-ui-header-nav: home: "ホーム" messaging: "メッセージ" - channels: "チャンネル" + ch: "チャンネル" info: "お知らせ" mk-ui-header-search: @@ -352,10 +358,6 @@ desktop: mk-repost-form-window: title: "この投稿をRepostしますか?" - mk-channels-page: - new: "チャンネルを作成" - channel-title: "チャンネルのタイトル" - mobile: tags: mk-drive-file-viewer: @@ -496,6 +498,7 @@ mobile: home: "ホーム" notifications: "通知" messaging: "メッセージ" + ch: "チャンネル" search: "検索" drive: "ドライブ" settings: "設定" diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index 183cabf135..34265dcbc3 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -13,7 +13,7 @@ import Watching from '../../models/post-watching'; import serialize from '../../serializers/post'; import notify from '../../common/notify'; import watch from '../../common/watch-post'; -import event from '../../event'; +import { default as event, publishChannelStream } from '../../event'; import config from '../../../conf'; /** @@ -258,6 +258,11 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { // Publish event to myself's stream event(user._id, 'post', postObj); + // Publish event to channel + if (channel) { + publishChannelStream(channel._id, 'post', postObj); + } + // Fetch all followers const followers = await Following .find({ diff --git a/src/api/event.ts b/src/api/event.ts index 9613a9f7cc..909b0d2556 100644 --- a/src/api/event.ts +++ b/src/api/event.ts @@ -25,6 +25,10 @@ class MisskeyEvent { this.publish(`messaging-stream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value); } + public publishChannelStream(channelId: ID, type: string, value?: any): void { + this.publish(`channel-stream:${channelId}`, type, typeof value === 'undefined' ? null : value); + } + private publish(channel: string, type: string, value?: any): void { const message = value == null ? { type: type } : @@ -41,3 +45,5 @@ export default ev.publishUserStream.bind(ev); export const publishPostStream = ev.publishPostStream.bind(ev); export const publishMessagingStream = ev.publishMessagingStream.bind(ev); + +export const publishChannelStream = ev.publishChannelStream.bind(ev); diff --git a/src/api/stream/channel.ts b/src/api/stream/channel.ts new file mode 100644 index 0000000000..d67d77cbf4 --- /dev/null +++ b/src/api/stream/channel.ts @@ -0,0 +1,12 @@ +import * as websocket from 'websocket'; +import * as redis from 'redis'; + +export default function(request: websocket.request, connection: websocket.connection, subscriber: redis.RedisClient): void { + const channel = request.resourceURL.query.channel; + + // Subscribe channel stream + subscriber.subscribe(`misskey:channel-stream:${channel}`); + subscriber.on('message', (_, data) => { + connection.send(data); + }); +} diff --git a/src/api/streaming.ts b/src/api/streaming.ts index db600013b9..0e512fb210 100644 --- a/src/api/streaming.ts +++ b/src/api/streaming.ts @@ -9,6 +9,7 @@ import isNativeToken from './common/is-native-token'; import homeStream from './stream/home'; import messagingStream from './stream/messaging'; import serverStream from './stream/server'; +import channelStream from './stream/channel'; module.exports = (server: http.Server) => { /** @@ -26,14 +27,6 @@ module.exports = (server: http.Server) => { return; } - const user = await authenticate(request.resourceURL.query.i); - - if (user == null) { - connection.send('authentication-failed'); - connection.close(); - return; - } - // Connect to Redis const subscriber = redis.createClient( config.redis.port, config.redis.host); @@ -43,6 +36,19 @@ module.exports = (server: http.Server) => { subscriber.quit(); }); + if (request.resourceURL.pathname === '/channel') { + channelStream(request, connection, subscriber); + return; + } + + const user = await authenticate(request.resourceURL.query.i); + + if (user == null) { + connection.send('authentication-failed'); + connection.close(); + return; + } + const channel = request.resourceURL.pathname === '/' ? homeStream : request.resourceURL.pathname === '/messaging' ? messagingStream : diff --git a/src/config.ts b/src/config.ts index 46a93f5fef..18017e9740 100644 --- a/src/config.ts +++ b/src/config.ts @@ -88,6 +88,7 @@ type Mixin = { api_url: string; auth_url: string; about_url: string; + ch_url: stirng; stats_url: string; status_url: string; dev_url: string; @@ -122,6 +123,7 @@ export default function load() { mixin.secondary_scheme = config.secondary_url.substr(0, config.secondary_url.indexOf('://')); mixin.api_url = `${mixin.scheme}://api.${mixin.host}`; 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.stats_url = `${mixin.scheme}://stats.${mixin.host}`; diff --git a/src/web/app/ch/router.js b/src/web/app/ch/router.js new file mode 100644 index 0000000000..424158f403 --- /dev/null +++ b/src/web/app/ch/router.js @@ -0,0 +1,32 @@ +import * as riot from 'riot'; +const route = require('page'); +let page = null; + +export default me => { + route('/', index); + route('/:channel', channel); + route('*', notFound); + + function index() { + mount(document.createElement('mk-index')); + } + + function channel(ctx) { + const el = document.createElement('mk-channel'); + el.setAttribute('id', ctx.params.channel); + mount(el); + } + + function notFound() { + mount(document.createElement('mk-not-found')); + } + + // EXEC + route(); +}; + +function mount(content) { + if (page) page.unmount(); + const body = document.getElementById('app'); + page = riot.mount(body.appendChild(content))[0]; +} diff --git a/src/web/app/ch/script.js b/src/web/app/ch/script.js new file mode 100644 index 0000000000..760d405c52 --- /dev/null +++ b/src/web/app/ch/script.js @@ -0,0 +1,18 @@ +/** + * Channels + */ + +// Style +import './style.styl'; + +require('./tags'); +import init from '../init'; +import route from './router'; + +/** + * init + */ +init(me => { + // Start routing + route(me); +}); diff --git a/src/web/app/ch/style.styl b/src/web/app/ch/style.styl new file mode 100644 index 0000000000..2fc3ac3fca --- /dev/null +++ b/src/web/app/ch/style.styl @@ -0,0 +1,4 @@ +@import "../base" + +html + background #efefef diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag new file mode 100644 index 0000000000..b16844b8bc --- /dev/null +++ b/src/web/app/ch/tags/channel.tag @@ -0,0 +1,204 @@ + +
+

{ channel.title }

+ + + +
+ +
+

参加するにはログインまたは新規登録してください

+
+
+
+ Misskey ver { version } (葵 aoi) +
+
+ + +
+ + +
+ { post.index }: + { post.user.name } + + ID:{ post.user.username } +
+
+ >>{ post.reply_to.index } + { post.text } +
+ + { + +
+
+ + +
+ + +

>>{ reply.index } ({ reply.user.name }): [x]

+ + +
+ +
    +
  1. { name }
  2. +
+ + +
diff --git a/src/web/app/ch/tags/index.js b/src/web/app/ch/tags/index.js new file mode 100644 index 0000000000..1e99ccd43e --- /dev/null +++ b/src/web/app/ch/tags/index.js @@ -0,0 +1,2 @@ +require('./index.tag'); +require('./channel.tag'); diff --git a/src/web/app/ch/tags/index.tag b/src/web/app/ch/tags/index.tag new file mode 100644 index 0000000000..1c0a037c2d --- /dev/null +++ b/src/web/app/ch/tags/index.tag @@ -0,0 +1,24 @@ + + + + + diff --git a/src/web/app/common/scripts/channel-stream.js b/src/web/app/common/scripts/channel-stream.js index 38e7d91132..17944dbe45 100644 --- a/src/web/app/common/scripts/channel-stream.js +++ b/src/web/app/common/scripts/channel-stream.js @@ -6,8 +6,10 @@ import Stream from './stream'; * Channel stream connection */ class Connection extends Stream { - constructor() { - super('channel'); + constructor(channelId) { + super('channel', { + channel: channelId + }); } } diff --git a/src/web/app/common/scripts/config.js b/src/web/app/common/scripts/config.js index 75a7abba29..c5015622f0 100644 --- a/src/web/app/common/scripts/config.js +++ b/src/web/app/common/scripts/config.js @@ -6,6 +6,7 @@ const host = isRoot ? Url.host : Url.host.substring(Url.host.indexOf('.') + 1, U const scheme = Url.protocol; const url = `${scheme}//${host}`; const apiUrl = `${scheme}//api.${host}`; +const chUrl = `${scheme}//ch.${host}`; const devUrl = `${scheme}//dev.${host}`; const aboutUrl = `${scheme}//about.${host}`; const statsUrl = `${scheme}//stats.${host}`; @@ -16,6 +17,7 @@ export default { scheme, url, apiUrl, + chUrl, devUrl, aboutUrl, statsUrl, diff --git a/src/web/app/desktop/router.js b/src/web/app/desktop/router.js index df67bb7b7c..977e3fa9a6 100644 --- a/src/web/app/desktop/router.js +++ b/src/web/app/desktop/router.js @@ -10,8 +10,6 @@ export default me => { route('/', index); route('/selectdrive', selectDrive); route('/i>mentions', mentions); - route('/channel', channels); - route('/channel/:channel', channel); route('/post::post', post); route('/search::query', search); route('/:user', user.bind(null, 'home')); @@ -57,16 +55,6 @@ export default me => { mount(el); } - function channel(ctx) { - const el = document.createElement('mk-channel-page'); - el.setAttribute('id', ctx.params.channel); - mount(el); - } - - function channels() { - mount(document.createElement('mk-channels-page')); - } - function selectDrive() { mount(document.createElement('mk-selectdrive-page')); } diff --git a/src/web/app/desktop/tags/index.js b/src/web/app/desktop/tags/index.js index 0b92d8c236..37fdfe37e4 100644 --- a/src/web/app/desktop/tags/index.js +++ b/src/web/app/desktop/tags/index.js @@ -61,8 +61,6 @@ require('./pages/user.tag'); require('./pages/post.tag'); require('./pages/search.tag'); require('./pages/not-found.tag'); -require('./pages/channel.tag'); -require('./pages/channels.tag'); require('./pages/selectdrive.tag'); require('./autocomplete-suggestion.tag'); require('./progress-dialog.tag'); diff --git a/src/web/app/desktop/tags/pages/channel.tag b/src/web/app/desktop/tags/pages/channel.tag deleted file mode 100644 index a14c0648c4..0000000000 --- a/src/web/app/desktop/tags/pages/channel.tag +++ /dev/null @@ -1,184 +0,0 @@ - - -
-

{ parent.channel.title }

- - - -
- -
-
- - -
- - -
- { post.index }: - { post.user.name } - - ID:{ post.user.username } -
-
- >>{ post.reply_to.index } - { post.text } -
- - { - -
-
- - -
- - -

>>{ reply.index } ({ reply.user.name }): [x]

- - -
- -
    -
  1. { name }
  2. -
- - -
diff --git a/src/web/app/desktop/tags/pages/channels.tag b/src/web/app/desktop/tags/pages/channels.tag deleted file mode 100644 index 220f1ca50e..0000000000 --- a/src/web/app/desktop/tags/pages/channels.tag +++ /dev/null @@ -1,28 +0,0 @@ - - -
- -
-
- - -
diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag index 17b2c66dc8..64b64f902f 100644 --- a/src/web/app/desktop/tags/timeline.tag +++ b/src/web/app/desktop/tags/timeline.tag @@ -112,7 +112,7 @@
-

{ p.channel.title }:

+

{ p.channel.title }:

diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag index 7527358dce..3123c34f4f 100644 --- a/src/web/app/desktop/tags/ui.tag +++ b/src/web/app/desktop/tags/ui.tag @@ -335,10 +335,10 @@ -
  • - +
  • + -

    %i18n:desktop.tags.mk-ui-header-nav.channels%

    +

    %i18n:desktop.tags.mk-ui-header-nav.ch%

  • diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag index b26a5cb108..ad18521df6 100644 --- a/src/web/app/mobile/tags/timeline.tag +++ b/src/web/app/mobile/tags/timeline.tag @@ -164,7 +164,7 @@
    -

    { p.channel.title }:

    +

    { p.channel.title }:

    diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag index fb8cbcdbd2..b2d96f6b8b 100644 --- a/src/web/app/mobile/tags/ui.tag +++ b/src/web/app/mobile/tags/ui.tag @@ -231,10 +231,11 @@
  • %i18n:mobile.tags.mk-ui-nav.messaging%
    • %i18n:mobile.tags.mk-ui-nav.settings%
    • diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts index 5199285d55..066df18157 100644 --- a/webpack/webpack.config.ts +++ b/webpack/webpack.config.ts @@ -16,6 +16,7 @@ module.exports = langs.map(([lang, locale]) => { const entry = { desktop: './src/web/app/desktop/script.js', mobile: './src/web/app/mobile/script.js', + ch: './src/web/app/ch/script.js', stats: './src/web/app/stats/script.js', status: './src/web/app/status/script.js', dev: './src/web/app/dev/script.js', -- cgit v1.2.3-freya From 97f0b29d4a716bf1bba7d12c250062da9b2e7c03 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 3 Nov 2017 17:46:42 +0900 Subject: [Client] set lang --- src/web/app/init.js | 5 +++++ webpack/plugins/const.ts | 3 ++- webpack/plugins/index.ts | 4 ++-- webpack/webpack.config.ts | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'webpack') diff --git a/src/web/app/init.js b/src/web/app/init.js index cb661c2595..5a6899ed4f 100644 --- a/src/web/app/init.js +++ b/src/web/app/init.js @@ -21,6 +21,11 @@ require('./common/tags'); console.info(`Misskey v${VERSION} (葵 aoi)`); +{ // 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'); diff --git a/webpack/plugins/const.ts b/webpack/plugins/const.ts index ccfcb45260..f64160b01a 100644 --- a/webpack/plugins/const.ts +++ b/webpack/plugins/const.ts @@ -7,7 +7,8 @@ import * as webpack from 'webpack'; import version from '../../src/version'; const constants = require('../../src/const.json'); -export default () => new webpack.DefinePlugin({ +export default lang => new webpack.DefinePlugin({ VERSION: JSON.stringify(version), + LANG: JSON.stringify(lang), THEME_COLOR: JSON.stringify(constants.themeColor) }); diff --git a/webpack/plugins/index.ts b/webpack/plugins/index.ts index d5191f1555..345af7df9e 100644 --- a/webpack/plugins/index.ts +++ b/webpack/plugins/index.ts @@ -8,9 +8,9 @@ import banner from './banner'; const env = process.env.NODE_ENV; const isProduction = env === 'production'; -export default version => { +export default (version, lang) => { const plugins = [ - constant(), + constant(lang), new StringReplacePlugin(), hoist() ]; diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts index 066df18157..97782a4102 100644 --- a/webpack/webpack.config.ts +++ b/webpack/webpack.config.ts @@ -32,7 +32,7 @@ module.exports = langs.map(([lang, locale]) => { name, entry, module: module_(lang, locale), - plugins: plugins(version), + plugins: plugins(version, lang), output }; }); -- cgit v1.2.3-freya