This commit is contained in:
syuilo 2018-02-25 00:18:09 +09:00
parent 89a98b2644
commit 36c11e1f0f
48 changed files with 105 additions and 191 deletions

View File

@ -68,7 +68,6 @@
"@types/redis": "2.8.5", "@types/redis": "2.8.5",
"@types/request": "2.47.0", "@types/request": "2.47.0",
"@types/rimraf": "2.0.2", "@types/rimraf": "2.0.2",
"@types/riot": "3.6.1",
"@types/seedrandom": "2.4.27", "@types/seedrandom": "2.4.27",
"@types/serve-favicon": "2.2.30", "@types/serve-favicon": "2.2.30",
"@types/speakeasy": "2.0.2", "@types/speakeasy": "2.0.2",
@ -148,8 +147,6 @@
"redis": "2.8.0", "redis": "2.8.0",
"request": "2.83.0", "request": "2.83.0",
"rimraf": "2.6.2", "rimraf": "2.6.2",
"riot": "3.8.1",
"riot-tag-loader": "2.0.2",
"rndstr": "1.0.0", "rndstr": "1.0.0",
"s-age": "1.1.2", "s-age": "1.1.2",
"seedrandom": "2.4.3", "seedrandom": "2.4.3",

View File

@ -1,3 +1,3 @@
<template> <template>
<router-view id="app"></router-view> <router-view id="app"></router-view>
</template> </template>

View File

@ -1,23 +0,0 @@
/**
* Authorize Form
*/
// Style
import './style.styl';
import * as riot from 'riot';
require('./tags');
import init from '../init';
document.title = 'Misskey | アプリの連携';
/**
* init
*/
init(() => {
mount(document.createElement('mk-index'));
});
function mount(content) {
riot.mount(document.getElementById('app').appendChild(content));
}

View File

@ -1,5 +1,7 @@
import Vue from 'vue'; import Vue from 'vue';
import { EventEmitter } from 'eventemitter3'; import { EventEmitter } from 'eventemitter3';
import { apiUrl, swPublickey, version, lang } from '../config';
import api from './scripts/api'; import api from './scripts/api';
import signout from './scripts/signout'; import signout from './scripts/signout';
import Progress from './scripts/loading'; import Progress from './scripts/loading';
@ -11,13 +13,6 @@ import MessagingIndexStreamManager from './scripts/streaming/messaging-index-str
import Err from '../common/views/components/connect-failed.vue'; import Err from '../common/views/components/connect-failed.vue';
//#region environment variables
declare const _VERSION_: string;
declare const _LANG_: string;
declare const _API_URL_: string;
declare const _SW_PUBLICKEY_: string;
//#endregion
export type API = { export type API = {
chooseDriveFile: (opts: { chooseDriveFile: (opts: {
title?: string; title?: string;
@ -204,7 +199,7 @@ export default class MiOS extends EventEmitter {
} }
// Fetch user // Fetch user
fetch(`${_API_URL_}/i`, { fetch(`${apiUrl}/i`, {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
i: token i: token
@ -311,7 +306,7 @@ export default class MiOS extends EventEmitter {
// A public key your push server will use to send // A public key your push server will use to send
// messages to client apps via a push server. // messages to client apps via a push server.
applicationServerKey: urlBase64ToUint8Array(_SW_PUBLICKEY_) applicationServerKey: urlBase64ToUint8Array(swPublickey)
}; };
// Subscribe push notification // Subscribe push notification
@ -348,7 +343,7 @@ export default class MiOS extends EventEmitter {
}); });
// The path of service worker script // The path of service worker script
const sw = `/sw.${_VERSION_}.${_LANG_}.js`; const sw = `/sw.${version}.${lang}.js`;
// Register service worker // Register service worker
navigator.serviceWorker.register(sw).then(registration => { navigator.serviceWorker.register(sw).then(registration => {

View File

@ -21,20 +21,6 @@ import urlPreview from './url-preview.vue';
import twitterSetting from './twitter-setting.vue'; import twitterSetting from './twitter-setting.vue';
import fileTypeIcon from './file-type-icon.vue'; import fileTypeIcon from './file-type-icon.vue';
//#region widgets
import wAccessLog from './widgets/access-log.vue';
import wVersion from './widgets/version.vue';
import wRss from './widgets/rss.vue';
import wServer from './widgets/server.vue';
import wBroadcast from './widgets/broadcast.vue';
import wCalendar from './widgets/calendar.vue';
import wPhotoStream from './widgets/photo-stream.vue';
import wSlideshow from './widgets/slideshow.vue';
import wTips from './widgets/tips.vue';
import wDonation from './widgets/donation.vue';
import wNav from './widgets/nav.vue';
//#endregion
Vue.component('mk-signin', signin); Vue.component('mk-signin', signin);
Vue.component('mk-signup', signup); Vue.component('mk-signup', signup);
Vue.component('mk-forkit', forkit); Vue.component('mk-forkit', forkit);
@ -55,17 +41,3 @@ Vue.component('mk-messaging-room', messagingRoom);
Vue.component('mk-url-preview', urlPreview); Vue.component('mk-url-preview', urlPreview);
Vue.component('mk-twitter-setting', twitterSetting); Vue.component('mk-twitter-setting', twitterSetting);
Vue.component('mk-file-type-icon', fileTypeIcon); Vue.component('mk-file-type-icon', fileTypeIcon);
//#region widgets
Vue.component('mkw-nav', wNav);
Vue.component('mkw-calendar', wCalendar);
Vue.component('mkw-photo-stream', wPhotoStream);
Vue.component('mkw-slideshow', wSlideshow);
Vue.component('mkw-tips', wTips);
Vue.component('mkw-donation', wDonation);
Vue.component('mkw-broadcast', wBroadcast);
Vue.component('mkw-server', wServer);
Vue.component('mkw-rss', wRss);
Vue.component('mkw-version', wVersion);
Vue.component('mkw-access-log', wAccessLog);
//#endregion

View File

@ -15,7 +15,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
import * as seedrandom from 'seedrandom'; import * as seedrandom from 'seedrandom';
export default define({ export default define({

View File

@ -24,8 +24,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
import { lang } from '../../../../config'; import { lang } from '../../../config';
export default define({ export default define({
name: 'broadcast', name: 'broadcast',

View File

@ -36,7 +36,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'calendar', name: 'calendar',
props: () => ({ props: () => ({

View File

@ -12,7 +12,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'donation' name: 'donation'
}); });

View File

@ -0,0 +1,25 @@
import Vue from 'vue';
import wAccessLog from './access-log.vue';
import wVersion from './version.vue';
import wRss from './rss.vue';
import wServer from './server.vue';
import wBroadcast from './broadcast.vue';
import wCalendar from './calendar.vue';
import wPhotoStream from './photo-stream.vue';
import wSlideshow from './slideshow.vue';
import wTips from './tips.vue';
import wDonation from './donation.vue';
import wNav from './nav.vue';
Vue.component('mkw-nav', wNav);
Vue.component('mkw-calendar', wCalendar);
Vue.component('mkw-photo-stream', wPhotoStream);
Vue.component('mkw-slideshow', wSlideshow);
Vue.component('mkw-tips', wTips);
Vue.component('mkw-donation', wDonation);
Vue.component('mkw-broadcast', wBroadcast);
Vue.component('mkw-server', wServer);
Vue.component('mkw-rss', wRss);
Vue.component('mkw-version', wVersion);
Vue.component('mkw-access-log', wAccessLog);

View File

@ -9,7 +9,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'nav' name: 'nav'
}); });

View File

@ -13,7 +13,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'photo-stream', name: 'photo-stream',
props: () => ({ props: () => ({

View File

@ -13,7 +13,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'rss', name: 'rss',
props: () => ({ props: () => ({

View File

@ -18,7 +18,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
import XCpuMemory from './server.cpu-memory.vue'; import XCpuMemory from './server.cpu-memory.vue';
import XCpu from './server.cpu.vue'; import XCpu from './server.cpu.vue';
import XMemory from './server.memory.vue'; import XMemory from './server.memory.vue';

View File

@ -12,7 +12,7 @@
<script lang="ts"> <script lang="ts">
import * as anime from 'animejs'; import * as anime from 'animejs';
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'slideshow', name: 'slideshow',
props: () => ({ props: () => ({

View File

@ -6,7 +6,7 @@
<script lang="ts"> <script lang="ts">
import * as anime from 'animejs'; import * as anime from 'animejs';
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
const tips = [ const tips = [
'<kbd>t</kbd>でタイムラインにフォーカスできます', '<kbd>t</kbd>でタイムラインにフォーカスできます',

View File

@ -3,8 +3,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { version } from '../../../../config'; import { version } from '../../../config';
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'version' name: 'version'
}).extend({ }).extend({

View File

@ -37,6 +37,7 @@ init(async (launch) => {
// Register components // Register components
require('./views/components'); require('./views/components');
require('./views/widgets');
// Launch the app // Launch the app
const [app, os] = launch(os => ({ const [app, os] = launch(os => ({

View File

@ -29,19 +29,6 @@ import following from './following.vue';
import usersList from './users-list.vue'; import usersList from './users-list.vue';
import widgetContainer from './widget-container.vue'; import widgetContainer from './widget-container.vue';
//#region widgets
import wNotifications from './widgets/notifications.vue';
import wTimemachine from './widgets/timemachine.vue';
import wActivity from './widgets/activity.vue';
import wTrends from './widgets/trends.vue';
import wUsers from './widgets/users.vue';
import wPolls from './widgets/polls.vue';
import wPostForm from './widgets/post-form.vue';
import wMessaging from './widgets/messaging.vue';
import wChannel from './widgets/channel.vue';
import wProfile from './widgets/profile.vue';
//#endregion
Vue.component('mk-ui', ui); Vue.component('mk-ui', ui);
Vue.component('mk-ui-notification', uiNotification); Vue.component('mk-ui-notification', uiNotification);
Vue.component('mk-home', home); Vue.component('mk-home', home);
@ -70,16 +57,3 @@ Vue.component('mk-followers', followers);
Vue.component('mk-following', following); Vue.component('mk-following', following);
Vue.component('mk-users-list', usersList); Vue.component('mk-users-list', usersList);
Vue.component('mk-widget-container', widgetContainer); Vue.component('mk-widget-container', widgetContainer);
//#region widgets
Vue.component('mkw-notifications', wNotifications);
Vue.component('mkw-timemachine', wTimemachine);
Vue.component('mkw-activity', wActivity);
Vue.component('mkw-trends', wTrends);
Vue.component('mkw-users', wUsers);
Vue.component('mkw-polls', wPolls);
Vue.component('mkw-post-form', wPostForm);
Vue.component('mkw-messaging', wMessaging);
Vue.component('mkw-channel', wChannel);
Vue.component('mkw-profile', wProfile);
//#endregion

View File

@ -7,7 +7,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'activity', name: 'activity',
props: () => ({ props: () => ({

View File

@ -11,7 +11,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import ChannelStream from '../../../../common/scripts/streaming/channel-stream'; import ChannelStream from '../../../common/scripts/streaming/channel-stream';
import XForm from './channel.channel.form.vue'; import XForm from './channel.channel.form.vue';
import XPost from './channel.channel.post.vue'; import XPost from './channel.channel.post.vue';

View File

@ -10,7 +10,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
import XChannel from './channel.channel.vue'; import XChannel from './channel.channel.vue';
export default define({ export default define({

View File

@ -0,0 +1,23 @@
import Vue from 'vue';
import wNotifications from './notifications.vue';
import wTimemachine from './timemachine.vue';
import wActivity from './activity.vue';
import wTrends from './trends.vue';
import wUsers from './users.vue';
import wPolls from './polls.vue';
import wPostForm from './post-form.vue';
import wMessaging from './messaging.vue';
import wChannel from './channel.vue';
import wProfile from './profile.vue';
Vue.component('mkw-notifications', wNotifications);
Vue.component('mkw-timemachine', wTimemachine);
Vue.component('mkw-activity', wActivity);
Vue.component('mkw-trends', wTrends);
Vue.component('mkw-users', wUsers);
Vue.component('mkw-polls', wPolls);
Vue.component('mkw-post-form', wPostForm);
Vue.component('mkw-messaging', wMessaging);
Vue.component('mkw-channel', wChannel);
Vue.component('mkw-profile', wProfile);

View File

@ -6,8 +6,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
import MkMessagingRoomWindow from '../messaging-room-window.vue'; import MkMessagingRoomWindow from '../components/messaging-room-window.vue';
export default define({ export default define({
name: 'messaging', name: 'messaging',

View File

@ -9,7 +9,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'notifications', name: 'notifications',
props: () => ({ props: () => ({

View File

@ -15,7 +15,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'polls', name: 'polls',
props: () => ({ props: () => ({

View File

@ -9,7 +9,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'post-form', name: 'post-form',
props: () => ({ props: () => ({

View File

@ -21,7 +21,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'profile', name: 'profile',
props: () => ({ props: () => ({

View File

@ -5,7 +5,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'timemachine', name: 'timemachine',
props: () => ({ props: () => ({

View File

@ -14,7 +14,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'trends', name: 'trends',
props: () => ({ props: () => ({

View File

@ -22,7 +22,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
const limit = 3; const limit = 3;

View File

@ -2,11 +2,6 @@
* App initializer * App initializer
*/ */
declare const _VERSION_: string;
declare const _LANG_: string;
declare const _HOST_: string;
//declare const __CONSTS__: any;
import Vue from 'vue'; import Vue from 'vue';
import VueRouter from 'vue-router'; import VueRouter from 'vue-router';
import VModal from 'vue-js-modal'; import VModal from 'vue-js-modal';
@ -19,6 +14,7 @@ require('./common/views/directives');
// Register global components // Register global components
require('./common/views/components'); require('./common/views/components');
require('./common/views/widgets');
// Register global filters // Register global filters
require('./common/filters'); require('./common/filters');
@ -35,12 +31,13 @@ import App from './app.vue';
import checkForUpdate from './common/scripts/check-for-update'; import checkForUpdate from './common/scripts/check-for-update';
import MiOS, { API } from './common/mios'; import MiOS, { API } from './common/mios';
import { version, host, lang } from './config';
/** /**
* APP ENTRY POINT! * APP ENTRY POINT!
*/ */
console.info(`Misskey v${_VERSION_} (葵 aoi)`); console.info(`Misskey v${version} (葵 aoi)`);
console.info( console.info(
'%cここにコードを入力したり張り付けたりしないでください。アカウントが不正利用される可能性があります。', '%cここにコードを入力したり張り付けたりしないでください。アカウントが不正利用される可能性があります。',
'color: red; background: yellow; font-size: 16px;'); 'color: red; background: yellow; font-size: 16px;');
@ -49,13 +46,13 @@ console.info(
window.clearTimeout((window as any).mkBootTimer); window.clearTimeout((window as any).mkBootTimer);
delete (window as any).mkBootTimer; delete (window as any).mkBootTimer;
if (_HOST_ != 'localhost') { if (host != 'localhost') {
document.domain = _HOST_; document.domain = host;
} }
//#region Set lang attr //#region Set lang attr
const html = document.documentElement; const html = document.documentElement;
html.setAttribute('lang', _LANG_); html.setAttribute('lang', lang);
//#endregion //#endregion
//#region Set description meta tag //#region Set description meta tag
@ -66,9 +63,6 @@ meta.setAttribute('content', '%i18n:common.misskey%');
head.appendChild(meta); head.appendChild(meta);
//#endregion //#endregion
// Set global configuration
//(riot as any).mixin(__CONSTS__);
// iOSでプライベートモードだとlocalStorageが使えないので既存のメソッドを上書きする // iOSでプライベートモードだとlocalStorageが使えないので既存のメソッドを上書きする
try { try {
localStorage.setItem('kyoppie', 'yuppie'); localStorage.setItem('kyoppie', 'yuppie');
@ -132,10 +126,14 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
panic(e); panic(e);
} }
// 更新チェック //#region 更新チェック
setTimeout(() => { const preventUpdate = localStorage.getItem('preventUpdate') == 'true';
checkForUpdate(os); if (!preventUpdate) {
}, 3000); setTimeout(() => {
checkForUpdate(os);
}, 3000);
}
//#endregion
}); });
}; };
@ -152,7 +150,7 @@ function panic(e) {
+ '<hr>' + '<hr>'
+ `<p>エラーコード: ${e.toString()}</p>` + `<p>エラーコード: ${e.toString()}</p>`
+ `<p>ブラウザ バージョン: ${navigator.userAgent}</p>` + `<p>ブラウザ バージョン: ${navigator.userAgent}</p>`
+ `<p>クライアント バージョン: ${_VERSION_}</p>` + `<p>クライアント バージョン: ${version}</p>`
+ '<hr>' + '<hr>'
+ '<p>問題が解決しない場合は、上記の情報をお書き添えの上 syuilotan@yahoo.co.jp までご連絡ください。</p>' + '<p>問題が解決しない場合は、上記の情報をお書き添えの上 syuilotan@yahoo.co.jp までご連絡ください。</p>'
+ '<p>Thank you for using Misskey.</p>' + '<p>Thank you for using Misskey.</p>'

View File

@ -38,6 +38,7 @@ init((launch) => {
// Register components // Register components
require('./views/components'); require('./views/components');
require('./views/widgets');
// http://qiita.com/junya/items/3ff380878f26ca447f85 // http://qiita.com/junya/items/3ff380878f26ca447f85
document.body.setAttribute('ontouchstart', ''); document.body.setAttribute('ontouchstart', '');

View File

@ -21,11 +21,6 @@ import userTimeline from './user-timeline.vue';
import activity from './activity.vue'; import activity from './activity.vue';
import widgetContainer from './widget-container.vue'; import widgetContainer from './widget-container.vue';
//#region widgets
import wActivity from './widgets/activity.vue';
import wProfile from './widgets/profile.vue';
//#endregion
Vue.component('mk-ui', ui); Vue.component('mk-ui', ui);
Vue.component('mk-timeline', timeline); Vue.component('mk-timeline', timeline);
Vue.component('mk-posts', posts); Vue.component('mk-posts', posts);
@ -46,8 +41,3 @@ Vue.component('mk-user-preview', userPreview);
Vue.component('mk-user-timeline', userTimeline); Vue.component('mk-user-timeline', userTimeline);
Vue.component('mk-activity', activity); Vue.component('mk-activity', activity);
Vue.component('mk-widget-container', widgetContainer); Vue.component('mk-widget-container', widgetContainer);
//#region widgets
Vue.component('mkw-activity', wActivity);
Vue.component('mkw-profile', wProfile);
//#endregion

View File

@ -10,7 +10,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'activity', name: 'activity',

View File

@ -0,0 +1,7 @@
import Vue from 'vue';
import wActivity from './activity.vue';
import wProfile from './profile.vue';
Vue.component('mkw-activity', wActivity);
Vue.component('mkw-profile', wProfile);

View File

@ -14,7 +14,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../../common/define-widget'; import define from '../../../common/define-widget';
export default define({ export default define({
name: 'profile' name: 'profile'
}); });

View File

@ -1,23 +0,0 @@
/**
* Stats
*/
// Style
import './style.styl';
import * as riot from 'riot';
require('./tags');
import init from '../init';
document.title = 'Misskey Statistics';
/**
* init
*/
init(() => {
mount(document.createElement('mk-index'));
});
function mount(content) {
riot.mount(document.getElementById('app').appendChild(content));
}

View File

@ -1,23 +0,0 @@
/**
* Status
*/
// Style
import './style.styl';
import * as riot from 'riot';
require('./tags');
import init from '../init';
document.title = 'Misskey System Status';
/**
* init
*/
init(() => {
mount(document.createElement('mk-index'));
});
function mount(content) {
riot.mount(document.getElementById('app').appendChild(content));
}