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/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.2",
@ -148,8 +147,6 @@
"redis": "2.8.0",
"request": "2.83.0",
"rimraf": "2.6.2",
"riot": "3.8.1",
"riot-tag-loader": "2.0.2",
"rndstr": "1.0.0",
"s-age": "1.1.2",
"seedrandom": "2.4.3",

View file

@ -1,3 +1,3 @@
<template>
<router-view id="app"></router-view>
<router-view id="app"></router-view>
</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 { EventEmitter } from 'eventemitter3';
import { apiUrl, swPublickey, version, lang } from '../config';
import api from './scripts/api';
import signout from './scripts/signout';
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';
//#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 = {
chooseDriveFile: (opts: {
title?: string;
@ -204,7 +199,7 @@ export default class MiOS extends EventEmitter {
}
// Fetch user
fetch(`${_API_URL_}/i`, {
fetch(`${apiUrl}/i`, {
method: 'POST',
body: JSON.stringify({
i: token
@ -311,7 +306,7 @@ export default class MiOS extends EventEmitter {
// A public key your push server will use to send
// messages to client apps via a push server.
applicationServerKey: urlBase64ToUint8Array(_SW_PUBLICKEY_)
applicationServerKey: urlBase64ToUint8Array(swPublickey)
};
// Subscribe push notification
@ -348,7 +343,7 @@ export default class MiOS extends EventEmitter {
});
// The path of service worker script
const sw = `/sw.${_VERSION_}.${_LANG_}.js`;
const sw = `/sw.${version}.${lang}.js`;
// Register service worker
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 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-signup', signup);
Vue.component('mk-forkit', forkit);
@ -55,17 +41,3 @@ Vue.component('mk-messaging-room', messagingRoom);
Vue.component('mk-url-preview', urlPreview);
Vue.component('mk-twitter-setting', twitterSetting);
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>
<script lang="ts">
import define from '../../../../common/define-widget';
import define from '../../../common/define-widget';
import * as seedrandom from 'seedrandom';
export default define({

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -29,19 +29,6 @@ import following from './following.vue';
import usersList from './users-list.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-notification', uiNotification);
Vue.component('mk-home', home);
@ -70,16 +57,3 @@ Vue.component('mk-followers', followers);
Vue.component('mk-following', following);
Vue.component('mk-users-list', usersList);
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>
<script lang="ts">
import define from '../../../../common/define-widget';
import define from '../../../common/define-widget';
export default define({
name: 'activity',
props: () => ({

View file

@ -11,7 +11,7 @@
<script lang="ts">
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 XPost from './channel.channel.post.vue';

View file

@ -10,7 +10,7 @@
</template>
<script lang="ts">
import define from '../../../../common/define-widget';
import define from '../../../common/define-widget';
import XChannel from './channel.channel.vue';
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>
<script lang="ts">
import define from '../../../../common/define-widget';
import MkMessagingRoomWindow from '../messaging-room-window.vue';
import define from '../../../common/define-widget';
import MkMessagingRoomWindow from '../components/messaging-room-window.vue';
export default define({
name: 'messaging',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -21,11 +21,6 @@ import userTimeline from './user-timeline.vue';
import activity from './activity.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-timeline', timeline);
Vue.component('mk-posts', posts);
@ -46,8 +41,3 @@ Vue.component('mk-user-preview', userPreview);
Vue.component('mk-user-timeline', userTimeline);
Vue.component('mk-activity', activity);
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>
<script lang="ts">
import define from '../../../../common/define-widget';
import define from '../../../common/define-widget';
export default define({
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>
<script lang="ts">
import define from '../../../../common/define-widget';
import define from '../../../common/define-widget';
export default define({
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));
}