From 1436617aab030fa5b3760a3eeae37a1cdeeba2df Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 21 Nov 2017 03:40:09 +0900 Subject: wip --- src/web/app/boot.js | 4 ++- src/web/app/common/mios.ts | 49 ++++++++++++++++++++++++++++++++++++ src/web/app/common/scripts/config.ts | 10 +++++--- src/web/assets/sw.js | 31 +++++++++++++++++++++++ src/web/server.ts | 27 ++++++++++++++++---- 5 files changed, 111 insertions(+), 10 deletions(-) create mode 100644 src/web/assets/sw.js (limited to 'src/web') diff --git a/src/web/app/boot.js b/src/web/app/boot.js index ac6c18d649..4a8ea030a1 100644 --- a/src/web/app/boot.js +++ b/src/web/app/boot.js @@ -27,7 +27,9 @@ // misskey.alice => misskey // misskey.strawberry.pasta => misskey // dev.misskey.arisu.tachibana => dev - let app = url.host.split('.')[0]; + let app = url.host == 'localhost' + ? 'misskey' + : url.host.split('.')[0]; // Detect the user language // Note: The default language is English diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index 9704e92af8..4a36d6375f 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -37,6 +37,11 @@ export default class MiOS extends EventEmitter { */ public stream: HomeStreamManager; + /** + * A registration of service worker + */ + private swRegistration: ServiceWorkerRegistration = null; + constructor() { super(); @@ -44,6 +49,7 @@ export default class MiOS extends EventEmitter { this.init = this.init.bind(this); this.api = this.api.bind(this); this.getMeta = this.getMeta.bind(this); + this.swSubscribe = this.swSubscribe.bind(this); //#endregion } @@ -126,6 +132,25 @@ export default class MiOS extends EventEmitter { // Finish init callback(); + + //#region Service worker + const isSwSupported = + ('serviceWorker' in navigator) && ('PushManager' in window); + + if (isSwSupported && this.isSignedin) { + // When service worker activated + navigator.serviceWorker.ready.then(this.swSubscribe); + + // Register service worker + navigator.serviceWorker.register('/sw.js').then(registration => { + // 登録成功 + console.info('ServiceWorker registration successful with scope: ', registration.scope); + }).catch(err => { + // 登録失敗 :( + console.error('ServiceWorker registration failed: ', err); + }); + } + //#endregion }; // Get cached account data @@ -147,6 +172,30 @@ export default class MiOS extends EventEmitter { } } + private async swSubscribe(swRegistration: ServiceWorkerRegistration) { + this.swRegistration = swRegistration; + + // Subscribe + this.swRegistration.pushManager.subscribe({ + // A boolean indicating that the returned push subscription + // will only be used for messages whose effect is made visible to the user. + userVisibleOnly: true + }).then(subscription => { + console.log('Subscribe OK:', subscription); + + // Register + this.api('sw/register', { + endpoint: subscription.endpoint, + auth: subscription.getKey('auth') ? btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('auth')))) : '', + publickey: subscription.getKey('p256dh') ? btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('p256dh')))) : '' + }); + }).then(() => { + console.log('Server Stored Subscription.'); + }).catch(err => { + console.error('Subscribe Error:', err); + }); + } + /** * Misskey APIにリクエストします * @param endpoint エンドポイント名 diff --git a/src/web/app/common/scripts/config.ts b/src/web/app/common/scripts/config.ts index c5015622f0..b4801a44de 100644 --- a/src/web/app/common/scripts/config.ts +++ b/src/web/app/common/scripts/config.ts @@ -1,9 +1,11 @@ -const Url = new URL(location.href); +const _url = new URL(location.href); -const isRoot = Url.host.split('.')[0] == 'misskey'; +const isRoot = _url.host == 'localhost' + ? true + : _url.host.split('.')[0] == 'misskey'; -const host = isRoot ? Url.host : Url.host.substring(Url.host.indexOf('.') + 1, Url.host.length); -const scheme = Url.protocol; +const host = isRoot ? _url.host : _url.host.substring(_url.host.indexOf('.') + 1, _url.host.length); +const scheme = _url.protocol; const url = `${scheme}//${host}`; const apiUrl = `${scheme}//api.${host}`; const chUrl = `${scheme}//ch.${host}`; diff --git a/src/web/assets/sw.js b/src/web/assets/sw.js new file mode 100644 index 0000000000..6a1251614a --- /dev/null +++ b/src/web/assets/sw.js @@ -0,0 +1,31 @@ +/** + * Service Worker + */ + +// インストールされたとき +self.addEventListener('install', () => { + console.log('[sw]', 'Your ServiceWorker is installed'); +}); + +// プッシュ通知を受け取ったとき +self.addEventListener('push', ev => { + // クライアント取得 + self.clients.matchAll({ + includeUncontrolled: true + }).then(clients => { + // クライアントがあったらストリームに接続しているということなので通知しない + if (clients.length != 0) return; + + const { type, body } = ev.data.json(); + handlers[type](body); + }); +}); + +const handlers = { + mention: body => { + self.registration.showNotification('mentioned', { + body: body.text, + icon: body.user.avatar_url + '?thumbnail&size=64', + }); + } +}; diff --git a/src/web/server.ts b/src/web/server.ts index dde4eca5ec..300f3ed477 100644 --- a/src/web/server.ts +++ b/src/web/server.ts @@ -37,28 +37,45 @@ app.use((req, res, next) => { * Static assets */ app.use(favicon(`${__dirname}/assets/favicon.ico`)); -app.get('/manifest.json', (req, res) => res.sendFile(`${__dirname}/assets/manifest.json`)); app.get('/apple-touch-icon.png', (req, res) => res.sendFile(`${__dirname}/assets/apple-touch-icon.png`)); app.use('/assets', express.static(`${__dirname}/assets`, { maxAge: ms('7 days') })); +app.get('/sw.js', (req, res) => res.sendFile(`${__dirname}/assets/sw.js`)); + /** - * Common API + * Manifest */ -app.get(/\/api:url/, require('./service/url-preview')); +app.get('/manifest.json', (req, res) => { + const manifest = require((`${__dirname}/assets/manifest.json`)); + + // Service Worker + if (config.sw) { + manifest['gcm_sender_id'] = config.sw.gcm_sender_id; + } + + res.send(manifest); +}); /** * Serve config */ app.get('/config.json', (req, res) => { - res.send({ + const conf = { recaptcha: { siteKey: config.recaptcha.siteKey } - }); + }; + + res.send(conf); }); +/** + * Common API + */ +app.get(/\/api:url/, require('./service/url-preview')); + /** * Routing */ -- cgit v1.2.3-freya From c598a9cba2d4cdecf2aec3dcde1a893ee039bce3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 21 Nov 2017 05:09:45 +0900 Subject: wip --- src/api/endpoints/messaging/messages/create.ts | 4 +- src/web/app/common/mios.ts | 5 ++- src/web/app/common/scripts/compose-notification.ts | 52 ++++++++++++++++++++++ src/web/app/desktop/script.ts | 37 ++++++++------- src/web/app/sw.js | 30 +++++++++++++ src/web/assets/sw.js | 31 ------------- src/web/server.ts | 2 +- webpack/webpack.config.ts | 3 +- 8 files changed, 112 insertions(+), 52 deletions(-) create mode 100644 src/web/app/common/scripts/compose-notification.ts create mode 100644 src/web/app/sw.js delete mode 100644 src/web/assets/sw.js (limited to 'src/web') diff --git a/src/api/endpoints/messaging/messages/create.ts b/src/api/endpoints/messaging/messages/create.ts index 29a4671f84..3c7689f967 100644 --- a/src/api/endpoints/messaging/messages/create.ts +++ b/src/api/endpoints/messaging/messages/create.ts @@ -9,8 +9,7 @@ import User from '../../../models/user'; import DriveFile from '../../../models/drive-file'; import serialize from '../../../serializers/messaging-message'; import publishUserStream from '../../../event'; -import { publishMessagingStream } from '../../../event'; -import { publishMessagingIndexStream } from '../../../event'; +import { publishMessagingStream, publishMessagingIndexStream, pushSw } from '../../../event'; import config from '../../../../conf'; /** @@ -99,6 +98,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { const freshMessage = await Message.findOne({ _id: message._id }, { is_read: true }); if (!freshMessage.is_read) { publishUserStream(message.recipient_id, 'unread_messaging_message', messageObj); + pushSw(message.recipient_id, 'unread_messaging_message', messageObj); } }, 3000); diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index 4a36d6375f..a98ef5f477 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -6,6 +6,9 @@ import HomeStreamManager from './scripts/streaming/home-stream-manager'; import CONFIG from './scripts/config'; import api from './scripts/api'; +declare var VERSION: string; +declare var LANG: string; + /** * Misskey Operating System */ @@ -142,7 +145,7 @@ export default class MiOS extends EventEmitter { navigator.serviceWorker.ready.then(this.swSubscribe); // Register service worker - navigator.serviceWorker.register('/sw.js').then(registration => { + navigator.serviceWorker.register(`/sw.${VERSION}.${LANG}.js`).then(registration => { // 登録成功 console.info('ServiceWorker registration successful with scope: ', registration.scope); }).catch(err => { diff --git a/src/web/app/common/scripts/compose-notification.ts b/src/web/app/common/scripts/compose-notification.ts new file mode 100644 index 0000000000..181dca734f --- /dev/null +++ b/src/web/app/common/scripts/compose-notification.ts @@ -0,0 +1,52 @@ +import getPostSummary from '../../../../common/get-post-summary'; + +type Notification = { + title: string; + body: string; + icon: string; + onclick?: any; +}; + +// TODO: i18n + +export default function(type, data): Notification { + switch (type) { + case 'drive_file_created': + return { + title: 'ファイルがアップロードされました', + body: data.name, + icon: data.url + '?thumbnail&size=64' + }; + + case 'mention': + return { + title: `${data.user.name}さんから:`, + body: getPostSummary(data), + icon: data.user.avatar_url + '?thumbnail&size=64' + }; + + case 'reply': + return { + title: `${data.user.name}さんから返信:`, + body: getPostSummary(data), + icon: data.user.avatar_url + '?thumbnail&size=64' + }; + + case 'quote': + return { + title: `${data.user.name}さんが引用:`, + body: getPostSummary(data), + icon: data.user.avatar_url + '?thumbnail&size=64' + }; + + case 'unread_messaging_message': + return { + title: `${data.user.name}さんからメッセージ:`, + body: data.text, // TODO: getMessagingMessageSummary(data), + icon: data.user.avatar_url + '?thumbnail&size=64' + }; + + default: + return null; + } +} diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts index bc0fc8dfe3..694cb7879c 100644 --- a/src/web/app/desktop/script.ts +++ b/src/web/app/desktop/script.ts @@ -11,9 +11,9 @@ import * as riot from 'riot'; import init from '../init'; import route from './router'; import fuckAdBlock from './scripts/fuck-ad-block'; -import getPostSummary from '../../../common/get-post-summary'; import MiOS from '../common/mios'; import HomeStreamManager from '../common/scripts/streaming/home-stream-manager'; +import composeNotification from '../common/scripts/compose-notification'; /** * init @@ -55,41 +55,46 @@ function registerNotifications(stream: HomeStreamManager) { function attach(connection) { connection.on('drive_file_created', file => { - const n = new Notification('ファイルがアップロードされました', { - body: file.name, - icon: file.url + '?thumbnail&size=64' + const _n = composeNotification('drive_file_created', file); + const n = new Notification(_n.title, { + body: _n.body, + icon: _n.icon }); setTimeout(n.close.bind(n), 5000); }); connection.on('mention', post => { - const n = new Notification(`${post.user.name}さんから:`, { - body: getPostSummary(post), - icon: post.user.avatar_url + '?thumbnail&size=64' + const _n = composeNotification('mention', post); + const n = new Notification(_n.title, { + body: _n.body, + icon: _n.icon }); setTimeout(n.close.bind(n), 6000); }); connection.on('reply', post => { - const n = new Notification(`${post.user.name}さんから返信:`, { - body: getPostSummary(post), - icon: post.user.avatar_url + '?thumbnail&size=64' + const _n = composeNotification('reply', post); + const n = new Notification(_n.title, { + body: _n.body, + icon: _n.icon }); setTimeout(n.close.bind(n), 6000); }); connection.on('quote', post => { - const n = new Notification(`${post.user.name}さんが引用:`, { - body: getPostSummary(post), - icon: post.user.avatar_url + '?thumbnail&size=64' + const _n = composeNotification('quote', post); + const n = new Notification(_n.title, { + body: _n.body, + icon: _n.icon }); setTimeout(n.close.bind(n), 6000); }); connection.on('unread_messaging_message', message => { - const n = new Notification(`${message.user.name}さんからメッセージ:`, { - body: message.text, // TODO: getMessagingMessageSummary(message), - icon: message.user.avatar_url + '?thumbnail&size=64' + const _n = composeNotification('unread_messaging_message', message); + const n = new Notification(_n.title, { + body: _n.body, + icon: _n.icon }); n.onclick = () => { n.close(); diff --git a/src/web/app/sw.js b/src/web/app/sw.js new file mode 100644 index 0000000000..463ae0c75e --- /dev/null +++ b/src/web/app/sw.js @@ -0,0 +1,30 @@ +/** + * Service Worker + */ + +import composeNotification from './common/scripts/compose-notification'; + +// インストールされたとき +self.addEventListener('install', () => { + console.log('[sw]', 'Your ServiceWorker is installed'); +}); + +// プッシュ通知を受け取ったとき +self.addEventListener('push', ev => { + // クライアント取得 + self.clients.matchAll({ + includeUncontrolled: true + }).then(clients => { + // クライアントがあったらストリームに接続しているということなので通知しない + if (clients.length != 0) return; + + const { type, body } = ev.data.json(); + const n = composeNotification(type, body); + if (n) { + self.registration.showNotification(n.title, { + body: n.body, + icon: n.icon, + }); + } + }); +}); diff --git a/src/web/assets/sw.js b/src/web/assets/sw.js deleted file mode 100644 index 6a1251614a..0000000000 --- a/src/web/assets/sw.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Service Worker - */ - -// インストールされたとき -self.addEventListener('install', () => { - console.log('[sw]', 'Your ServiceWorker is installed'); -}); - -// プッシュ通知を受け取ったとき -self.addEventListener('push', ev => { - // クライアント取得 - self.clients.matchAll({ - includeUncontrolled: true - }).then(clients => { - // クライアントがあったらストリームに接続しているということなので通知しない - if (clients.length != 0) return; - - const { type, body } = ev.data.json(); - handlers[type](body); - }); -}); - -const handlers = { - mention: body => { - self.registration.showNotification('mentioned', { - body: body.text, - icon: body.user.avatar_url + '?thumbnail&size=64', - }); - } -}; diff --git a/src/web/server.ts b/src/web/server.ts index 300f3ed477..0be07b2d8b 100644 --- a/src/web/server.ts +++ b/src/web/server.ts @@ -42,7 +42,7 @@ app.use('/assets', express.static(`${__dirname}/assets`, { maxAge: ms('7 days') })); -app.get('/sw.js', (req, res) => res.sendFile(`${__dirname}/assets/sw.js`)); +app.get(/^\/sw\.(.+?)\.js$/, (req, res) => res.sendFile(`${__dirname}/assets/sw.${req.params[0]}.js`)); /** * Manifest diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts index f2bcf48f31..753d89fede 100644 --- a/webpack/webpack.config.ts +++ b/webpack/webpack.config.ts @@ -20,7 +20,8 @@ module.exports = langs.map(([lang, locale]) => { 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' + auth: './src/web/app/auth/script.ts', + sw: './src/web/app/sw.js' }; const output = { -- cgit v1.2.3-freya From cad1e0458ff7f24c984ccc64d18759d9b9da451a Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 21 Nov 2017 05:37:29 +0900 Subject: Update mios.ts --- src/web/app/common/mios.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/web') diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index a98ef5f477..5e76d82a38 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -189,8 +189,8 @@ export default class MiOS extends EventEmitter { // Register this.api('sw/register', { endpoint: subscription.endpoint, - auth: subscription.getKey('auth') ? btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('auth')))) : '', - publickey: subscription.getKey('p256dh') ? btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('p256dh')))) : '' + auth: btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('auth')))), + publickey: btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('p256dh')))) }); }).then(() => { console.log('Server Stored Subscription.'); -- cgit v1.2.3-freya From 411c006d9fc525d8abccc3880eefa8a1e422a6a1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 21 Nov 2017 07:06:36 +0900 Subject: :v: --- src/web/app/common/mios.ts | 132 ++++++++++++++++++++++++++++++++------------- src/web/app/sw.js | 21 ++++---- 2 files changed, 107 insertions(+), 46 deletions(-) (limited to 'src/web') diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index 5e76d82a38..cf7841d848 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -35,6 +35,13 @@ export default class MiOS extends EventEmitter { return this.i != null; } + /** + * Whether is debug mode + */ + public get debug() { + return localStorage.getItem('debug') == 'true'; + } + /** * A connection manager of home stream */ @@ -49,13 +56,37 @@ export default class MiOS extends EventEmitter { super(); //#region BIND + this.log = this.log.bind(this); + this.logInfo = this.logInfo.bind(this); + this.logWarn = this.logWarn.bind(this); + this.logError = this.logError.bind(this); this.init = this.init.bind(this); this.api = this.api.bind(this); this.getMeta = this.getMeta.bind(this); - this.swSubscribe = this.swSubscribe.bind(this); + this.registerSw = this.registerSw.bind(this); //#endregion } + public log(...args) { + if (!this.debug) return; + console.log.apply(null, args); + } + + public logInfo(...args) { + if (!this.debug) return; + console.info.apply(null, args); + } + + public logWarn(...args) { + if (!this.debug) return; + console.warn.apply(null, args); + } + + public logError(...args) { + if (!this.debug) return; + console.error.apply(null, args); + } + /** * Initialize MiOS (boot) * @param callback A function that call when initialized @@ -136,30 +167,20 @@ export default class MiOS extends EventEmitter { // Finish init callback(); - //#region Service worker - const isSwSupported = - ('serviceWorker' in navigator) && ('PushManager' in window); - - if (isSwSupported && this.isSignedin) { - // When service worker activated - navigator.serviceWorker.ready.then(this.swSubscribe); - - // Register service worker - navigator.serviceWorker.register(`/sw.${VERSION}.${LANG}.js`).then(registration => { - // 登録成功 - console.info('ServiceWorker registration successful with scope: ', registration.scope); - }).catch(err => { - // 登録失敗 :( - console.error('ServiceWorker registration failed: ', err); - }); - } + //#region Post + + // Init service worker + this.registerSw(); + //#endregion }; // Get cached account data const cachedMe = JSON.parse(localStorage.getItem('me')); + // キャッシュがあったとき if (cachedMe) { + // とりあえずキャッシュされたデータでお茶を濁して(?)おいて、 fetched(cachedMe); // 後から新鮮なデータをフェッチ @@ -175,27 +196,64 @@ export default class MiOS extends EventEmitter { } } - private async swSubscribe(swRegistration: ServiceWorkerRegistration) { - this.swRegistration = swRegistration; - - // Subscribe - this.swRegistration.pushManager.subscribe({ - // A boolean indicating that the returned push subscription - // will only be used for messages whose effect is made visible to the user. - userVisibleOnly: true - }).then(subscription => { - console.log('Subscribe OK:', subscription); - - // Register - this.api('sw/register', { - endpoint: subscription.endpoint, - auth: btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('auth')))), - publickey: btoa(String.fromCharCode.apply(null, new Uint8Array(subscription.getKey('p256dh')))) + /** + * Register service worker + */ + private registerSw() { + // Check whether service worker and push manager supported + const isSwSupported = + ('serviceWorker' in navigator) && ('PushManager' in window); + + // Reject when browser not service worker supported + if (!isSwSupported) return; + + // Reject when not signed in to Misskey + if (!this.isSignedin) return; + + // When service worker activated + navigator.serviceWorker.ready.then(registration => { + this.log('[sw] ready: ', registration); + + this.swRegistration = registration; + + // Options of pushManager.subscribe + const opts = { + // A boolean indicating that the returned push subscription + // will only be used for messages whose effect is made visible to the user. + userVisibleOnly: true + }; + + // Subscribe push notification + this.swRegistration.pushManager.subscribe(opts).then(subscription => { + this.log('[sw] Subscribe OK:', subscription); + + function encode(buffer: ArrayBuffer) { + return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))); + } + + // Register + this.api('sw/register', { + endpoint: subscription.endpoint, + auth: encode(subscription.getKey('auth')), + publickey: encode(subscription.getKey('p256dh')) + }); + }).then(() => { + this.logInfo('[sw] Server Stored Subscription.'); + }).catch(err => { + this.logError('[sw] Subscribe Error:', err); }); - }).then(() => { - console.log('Server Stored Subscription.'); + }); + + // The path of service worker script + const sw = `/sw.${VERSION}.${LANG}.js`; + + // Register service worker + navigator.serviceWorker.register(sw).then(registration => { + // 登録成功 + this.logInfo('[sw] Registration successful with scope: ', registration.scope); }).catch(err => { - console.error('Subscribe Error:', err); + // 登録失敗 :( + this.logError('[sw] Registration failed: ', err); }); } diff --git a/src/web/app/sw.js b/src/web/app/sw.js index 463ae0c75e..a7c84d022a 100644 --- a/src/web/app/sw.js +++ b/src/web/app/sw.js @@ -6,25 +6,28 @@ import composeNotification from './common/scripts/compose-notification'; // インストールされたとき self.addEventListener('install', () => { - console.log('[sw]', 'Your ServiceWorker is installed'); + console.info('installed'); }); // プッシュ通知を受け取ったとき self.addEventListener('push', ev => { + console.log('pushed'); + // クライアント取得 - self.clients.matchAll({ + ev.waitUntil(self.clients.matchAll({ includeUncontrolled: true }).then(clients => { // クライアントがあったらストリームに接続しているということなので通知しない if (clients.length != 0) return; const { type, body } = ev.data.json(); + + console.log(type, body); + const n = composeNotification(type, body); - if (n) { - self.registration.showNotification(n.title, { - body: n.body, - icon: n.icon, - }); - } - }); + return self.registration.showNotification(n.title, { + body: n.body, + icon: n.icon, + }); + })); }); -- cgit v1.2.3-freya From 93140daf796c046747643ce6028d81863d5ffd85 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 21 Nov 2017 07:16:13 +0900 Subject: Fix bug --- src/web/app/init.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/web') diff --git a/src/web/app/init.ts b/src/web/app/init.ts index 0bb687ec6a..652cbfde40 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -18,7 +18,9 @@ require('./common/tags'); console.info(`Misskey v${VERSION} (葵 aoi)`); -document.domain = CONFIG.host; +if (CONFIG.host != 'localhost') { + document.domain = CONFIG.host; +} { // Set lang attr const html = document.documentElement; -- cgit v1.2.3-freya