mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 00:49:17 +09:00
wip
This commit is contained in:
parent
29b1541a8e
commit
08ee9e4eaf
@ -38,7 +38,7 @@ export default class MiOS extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* Whether signed in
|
* Whether signed in
|
||||||
*/
|
*/
|
||||||
public get isSignedin() {
|
public get isSignedIn() {
|
||||||
return this.i != null;
|
return this.i != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ export default class MiOS extends EventEmitter {
|
|||||||
if (!isSwSupported) return;
|
if (!isSwSupported) return;
|
||||||
|
|
||||||
// Reject when not signed in to Misskey
|
// Reject when not signed in to Misskey
|
||||||
if (!this.isSignedin) return;
|
if (!this.isSignedIn) return;
|
||||||
|
|
||||||
// When service worker activated
|
// When service worker activated
|
||||||
navigator.serviceWorker.ready.then(registration => {
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
|
@ -23,7 +23,7 @@ export default (mios: MiOS) => {
|
|||||||
route('*', notFound);
|
route('*', notFound);
|
||||||
|
|
||||||
function index() {
|
function index() {
|
||||||
mios.isSignedin ? home() : entrance();
|
mios.isSignedIn ? home() : entrance();
|
||||||
}
|
}
|
||||||
|
|
||||||
function home() {
|
function home() {
|
||||||
|
@ -5,19 +5,17 @@
|
|||||||
// Style
|
// Style
|
||||||
import './style.styl';
|
import './style.styl';
|
||||||
|
|
||||||
import Vue from 'vue';
|
|
||||||
import init from '../init';
|
import init from '../init';
|
||||||
import fuckAdBlock from './scripts/fuck-ad-block';
|
import fuckAdBlock from './scripts/fuck-ad-block';
|
||||||
import MiOS from '../common/mios';
|
|
||||||
import HomeStreamManager from '../common/scripts/streaming/home-stream-manager';
|
import HomeStreamManager from '../common/scripts/streaming/home-stream-manager';
|
||||||
import composeNotification from '../common/scripts/compose-notification';
|
import composeNotification from '../common/scripts/compose-notification';
|
||||||
|
|
||||||
import MkIndex from './tags/pages/index.vue';
|
import MkIndex from './views/pages/index.vue';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init
|
* init
|
||||||
*/
|
*/
|
||||||
init(async (mios: MiOS, app: Vue) => {
|
init(async (os, launch) => {
|
||||||
/**
|
/**
|
||||||
* Fuck AD Block
|
* Fuck AD Block
|
||||||
*/
|
*/
|
||||||
@ -33,12 +31,17 @@ init(async (mios: MiOS, app: Vue) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((Notification as any).permission == 'granted') {
|
if ((Notification as any).permission == 'granted') {
|
||||||
registerNotifications(mios.stream);
|
registerNotifications(os.stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register components
|
||||||
|
require('./views/components');
|
||||||
|
|
||||||
|
const app = launch();
|
||||||
|
|
||||||
app.$router.addRoutes([{
|
app.$router.addRoutes([{
|
||||||
path: '/', component: MkIndex, props: { os: mios }
|
path: '/', component: MkIndex, props: { os }
|
||||||
}]);
|
}]);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
@ -42,10 +42,10 @@
|
|||||||
background rgba(0, 0, 0, 0.2)
|
background rgba(0, 0, 0, 0.2)
|
||||||
|
|
||||||
html
|
html
|
||||||
|
height 100%
|
||||||
background #f7f7f7
|
background #f7f7f7
|
||||||
|
|
||||||
// ↓ workaround of https://github.com/riot/riot/issues/2134
|
body
|
||||||
&[data-page='entrance']
|
display flex
|
||||||
#wait
|
flex-direction column
|
||||||
right auto
|
min-height 100%
|
||||||
left 15px
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<template>
|
|
||||||
<h1>hi</h1>
|
|
||||||
</template>
|
|
5
src/web/app/desktop/views/components/index.ts
Normal file
5
src/web/app/desktop/views/components/index.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Vue from 'vue';
|
||||||
|
|
||||||
|
import ui from './ui.vue';
|
||||||
|
|
||||||
|
Vue.component('mk-ui', ui);
|
6
src/web/app/desktop/views/components/ui.vue
Normal file
6
src/web/app/desktop/views/components/ui.vue
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<header>misskey</header>
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -82,8 +82,6 @@
|
|||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import uuid from 'uuid';
|
import uuid from 'uuid';
|
||||||
import Sortable from 'sortablejs';
|
import Sortable from 'sortablejs';
|
||||||
import I from '../../common/i';
|
|
||||||
import { resolveSrv } from 'dns';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
17
src/web/app/desktop/views/pages/home.vue
Normal file
17
src/web/app/desktop/views/pages/home.vue
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<mk-ui>
|
||||||
|
<home ref="home" :mode="mode"/>
|
||||||
|
</mk-ui>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import Vue from 'vue';
|
||||||
|
export default Vue.extend({
|
||||||
|
props: {
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
default: 'timeline'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
17
src/web/app/desktop/views/pages/index.vue
Normal file
17
src/web/app/desktop/views/pages/index.vue
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<component v-bind:is="os.isSignedIn ? 'home' : 'welcome'"></component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import Vue from 'vue';
|
||||||
|
import HomeView from './home.vue';
|
||||||
|
import WelcomeView from './welcome.vue';
|
||||||
|
|
||||||
|
export default Vue.extend({
|
||||||
|
props: ['os'],
|
||||||
|
components: {
|
||||||
|
home: HomeView,
|
||||||
|
welcome: WelcomeView
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
119
src/web/app/desktop/views/pages/welcome.vue
Normal file
119
src/web/app/desktop/views/pages/welcome.vue
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<template>
|
||||||
|
<div class="root">
|
||||||
|
<main>
|
||||||
|
<div>
|
||||||
|
<h1>繋がるNotes</h1>
|
||||||
|
<p>ようこそ! <b>Misskey</b>はTwitter風ミニブログSNSです――思ったこと、共有したいことをシンプルに書き残せます。タイムラインを見れば、皆の反応や皆がどう思っているのかもすぐにわかります。<a>詳しく...</a></p>
|
||||||
|
<p><button class="signup" @click="signup">はじめる</button><button class="signin" @click="signin">ログイン</button></p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<mk-forkit/>
|
||||||
|
<footer>
|
||||||
|
<div>
|
||||||
|
<mk-nav-links/>
|
||||||
|
<p class="c">{ _COPYRIGHT_ }</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#wait {
|
||||||
|
right: auto;
|
||||||
|
left: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
.root
|
||||||
|
display flex
|
||||||
|
flex-direction column
|
||||||
|
flex 1
|
||||||
|
background #eee
|
||||||
|
$width = 1000px
|
||||||
|
|
||||||
|
> main
|
||||||
|
display flex
|
||||||
|
flex 1
|
||||||
|
max-width $width
|
||||||
|
margin 0 auto
|
||||||
|
padding 80px 0 0 0
|
||||||
|
|
||||||
|
> div:first-child
|
||||||
|
margin 0 auto 0 0
|
||||||
|
width calc(100% - 500px)
|
||||||
|
color #777
|
||||||
|
|
||||||
|
> h1
|
||||||
|
margin 0
|
||||||
|
font-weight normal
|
||||||
|
|
||||||
|
> p
|
||||||
|
margin 0.5em 0
|
||||||
|
line-height 2em
|
||||||
|
|
||||||
|
button
|
||||||
|
padding 8px 16px
|
||||||
|
font-size inherit
|
||||||
|
|
||||||
|
.signup
|
||||||
|
color $theme-color
|
||||||
|
border solid 2px $theme-color
|
||||||
|
border-radius 4px
|
||||||
|
|
||||||
|
&:focus
|
||||||
|
box-shadow 0 0 0 3px rgba($theme-color, 0.2)
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
color $theme-color-foreground
|
||||||
|
background $theme-color
|
||||||
|
|
||||||
|
&:active
|
||||||
|
color $theme-color-foreground
|
||||||
|
background darken($theme-color, 10%)
|
||||||
|
border-color darken($theme-color, 10%)
|
||||||
|
|
||||||
|
.signin
|
||||||
|
&:focus
|
||||||
|
color #444
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
color #444
|
||||||
|
|
||||||
|
&:active
|
||||||
|
color #333
|
||||||
|
|
||||||
|
> div:last-child
|
||||||
|
margin 0 0 0 auto
|
||||||
|
|
||||||
|
> footer
|
||||||
|
background #fff
|
||||||
|
|
||||||
|
*
|
||||||
|
color #fff !important
|
||||||
|
text-shadow 0 0 8px #000
|
||||||
|
font-weight bold
|
||||||
|
|
||||||
|
> div
|
||||||
|
max-width $width
|
||||||
|
margin 0 auto
|
||||||
|
padding 16px 0
|
||||||
|
text-align center
|
||||||
|
border-top solid 1px #fff
|
||||||
|
|
||||||
|
> .c
|
||||||
|
margin 0
|
||||||
|
line-height 64px
|
||||||
|
font-size 10px
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import Vue from 'vue'
|
||||||
|
export default Vue.extend({
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
@ -61,22 +61,24 @@ if (localStorage.getItem('should-refresh') == 'true') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MiOSを初期化してコールバックする
|
// MiOSを初期化してコールバックする
|
||||||
export default (callback, sw = false) => {
|
export default (callback: (os: MiOS, launch: () => Vue) => void, sw = false) => {
|
||||||
const mios = new MiOS(sw);
|
const mios = new MiOS(sw);
|
||||||
|
|
||||||
mios.init(() => {
|
mios.init(() => {
|
||||||
// アプリ基底要素マウント
|
// アプリ基底要素マウント
|
||||||
document.body.innerHTML = '<div id="app"></div>';
|
document.body.innerHTML = '<div id="app"></div>';
|
||||||
|
|
||||||
const app = new Vue({
|
const launch = () => {
|
||||||
|
return new Vue({
|
||||||
router: new VueRouter({
|
router: new VueRouter({
|
||||||
mode: 'history'
|
mode: 'history'
|
||||||
}),
|
}),
|
||||||
render: createEl => createEl(App)
|
render: createEl => createEl(App)
|
||||||
}).$mount('#app');
|
}).$mount('#app');
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
callback(mios, app);
|
callback(mios, launch);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
panic(e);
|
panic(e);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ export default (mios: MiOS) => {
|
|||||||
route('*', notFound);
|
route('*', notFound);
|
||||||
|
|
||||||
function index() {
|
function index() {
|
||||||
mios.isSignedin ? home() : entrance();
|
mios.isSignedIn ? home() : entrance();
|
||||||
}
|
}
|
||||||
|
|
||||||
function home() {
|
function home() {
|
||||||
|
@ -8,7 +8,7 @@ const constants = require('../../../src/const.json');
|
|||||||
|
|
||||||
export default () => ({
|
export default () => ({
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
test: /\.tag$/,
|
test: /\.vue$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: StringReplacePlugin.replace({
|
loader: StringReplacePlugin.replace({
|
||||||
replacements: [
|
replacements: [
|
||||||
|
Loading…
Reference in New Issue
Block a user