MisskeyShare

This commit is contained in:
syuilo 2018-06-16 18:42:49 +09:00
parent 792632d726
commit 555a0f276c
9 changed files with 185 additions and 16 deletions

View file

@ -87,7 +87,6 @@
"websocket": "1.0.26", "websocket": "1.0.26",
"ws": "5.2.0", "ws": "5.2.0",
"xev": "2.0.1", "xev": "2.0.1",
"@prezzemolo/zip": "0.0.3", "@prezzemolo/zip": "0.0.3",
"@types/bcryptjs": "2.4.1", "@types/bcryptjs": "2.4.1",
"@types/debug": "0.0.30", "@types/debug": "0.0.30",

View file

@ -21,7 +21,7 @@ export default (os: OS) => opts => {
res(file); res(file);
}; };
window.open(url + '/selectdrive', window.open(url + `/selectdrive?multiple=${o.multiple}`,
'choose_drive_window', 'choose_drive_window',
'height=500, width=800'); 'height=500, width=800');
} }

View file

@ -35,6 +35,7 @@ import MkNote from './views/pages/note.vue';
import MkSearch from './views/pages/search.vue'; import MkSearch from './views/pages/search.vue';
import MkTag from './views/pages/tag.vue'; import MkTag from './views/pages/tag.vue';
import MkOthello from './views/pages/othello.vue'; import MkOthello from './views/pages/othello.vue';
import MkShare from './views/pages/share.vue';
/** /**
* init * init
@ -62,6 +63,7 @@ init(async (launch) => {
{ path: '/selectdrive', component: MkSelectDrive }, { path: '/selectdrive', component: MkSelectDrive },
{ path: '/search', component: MkSearch }, { path: '/search', component: MkSearch },
{ path: '/tags/:tag', component: MkTag }, { path: '/tags/:tag', component: MkTag },
{ path: '/share', component: MkShare },
{ path: '/othello', component: MkOthello }, { path: '/othello', component: MkOthello },
{ path: '/othello/:game', component: MkOthello }, { path: '/othello/:game', component: MkOthello },
{ path: '/@:user', component: MkUser }, { path: '/@:user', component: MkUser },

View file

@ -58,7 +58,25 @@ export default Vue.extend({
MkVisibilityChooser MkVisibilityChooser
}, },
props: ['reply', 'renote'], props: {
reply: {
type: Object,
required: false
},
renote: {
type: Object,
required: false
},
initialText: {
type: String,
required: false
},
instant: {
type: Boolean,
required: false,
default: false
}
},
data() { data() {
return { return {
@ -118,6 +136,10 @@ export default Vue.extend({
}, },
mounted() { mounted() {
if (this.initialText) {
this.text = this.initialText;
}
if (this.reply && this.reply.user.host != null) { if (this.reply && this.reply.user.host != null) {
this.text = `@${this.reply.user.username}@${this.reply.user.host} `; this.text = `@${this.reply.user.username}@${this.reply.user.host} `;
} }
@ -141,17 +163,19 @@ export default Vue.extend({
this.$nextTick(() => { this.$nextTick(() => {
// 稿 // 稿
const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId]; if (!this.instant) {
if (draft) { const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId];
this.text = draft.data.text; if (draft) {
this.files = draft.data.files; this.text = draft.data.text;
if (draft.data.poll) { this.files = draft.data.files;
this.poll = true; if (draft.data.poll) {
this.$nextTick(() => { this.poll = true;
(this.$refs.poll as any).set(draft.data.poll); this.$nextTick(() => {
}); (this.$refs.poll as any).set(draft.data.poll);
});
}
this.$emit('change-attached-media', this.files);
} }
this.$emit('change-attached-media', this.files);
} }
this.$nextTick(() => this.watch()); this.$nextTick(() => this.watch());
@ -349,6 +373,8 @@ export default Vue.extend({
}, },
saveDraft() { saveDraft() {
if (this.instant) return;
const data = JSON.parse(localStorage.getItem('drafts') || '{}'); const data = JSON.parse(localStorage.getItem('drafts') || '{}');
data[this.draftId] = { data[this.draftId] = {

View file

@ -0,0 +1,58 @@
<template>
<div class="pptjhabgjtt7kwskbfv4y3uml6fpuhmr">
<h1>Misskeyで共有</h1>
<div>
<mk-signin v-if="!$store.getters.isSignedIn"/>
<mk-post-form v-else-if="!posted" :initial-text="text" :instant="true" @posted="posted = true"/>
<p v-if="posted" class="posted">%fa:check%</p>
</div>
<button v-if="posted" class="ui button" @click="close">閉じる</button>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
data() {
return {
posted: false,
text: new URLSearchParams(location.search).get('text')
};
},
methods: {
close() {
window.close();
}
}
});
</script>
<style lang="stylus" scoped>
.pptjhabgjtt7kwskbfv4y3uml6fpuhmr
padding 16px
> h1
margin 0 0 8px 0
color #555
font-size 20px
text-align center
> div
max-width 500px
margin 0 auto
background #fff
border solid 1px rgba(#000, 0.1)
border-radius 6px
overflow hidden
> .posted
display block
margin 0
padding 64px
text-align center
> button
display block
margin 16px auto
</style>

View file

@ -37,6 +37,7 @@ import MkUserList from './views/pages/user-list.vue';
import MkSettings from './views/pages/settings.vue'; import MkSettings from './views/pages/settings.vue';
import MkOthello from './views/pages/othello.vue'; import MkOthello from './views/pages/othello.vue';
import MkTag from './views/pages/tag.vue'; import MkTag from './views/pages/tag.vue';
import MkShare from './views/pages/share.vue';
/** /**
* init * init
@ -73,6 +74,7 @@ init((launch) => {
{ path: '/selectdrive', component: MkSelectDrive }, { path: '/selectdrive', component: MkSelectDrive },
{ path: '/search', component: MkSearch }, { path: '/search', component: MkSearch },
{ path: '/tags/:tag', component: MkTag }, { path: '/tags/:tag', component: MkTag },
{ path: '/share', component: MkShare },
{ path: '/othello', name: 'othello', component: MkOthello }, { path: '/othello', name: 'othello', component: MkOthello },
{ path: '/othello/:game', component: MkOthello }, { path: '/othello/:game', component: MkOthello },
{ path: '/@:user', component: MkUser }, { path: '/@:user', component: MkUser },

View file

@ -22,6 +22,7 @@ import userTimeline from './user-timeline.vue';
import userListTimeline from './user-list-timeline.vue'; import userListTimeline from './user-list-timeline.vue';
import activity from './activity.vue'; import activity from './activity.vue';
import widgetContainer from './widget-container.vue'; import widgetContainer from './widget-container.vue';
import postForm from './post-form.vue';
Vue.component('mk-ui', ui); Vue.component('mk-ui', ui);
Vue.component('mk-note', note); Vue.component('mk-note', note);
@ -45,3 +46,4 @@ Vue.component('mk-user-timeline', userTimeline);
Vue.component('mk-user-list-timeline', userListTimeline); Vue.component('mk-user-list-timeline', userListTimeline);
Vue.component('mk-activity', activity); Vue.component('mk-activity', activity);
Vue.component('mk-widget-container', widgetContainer); Vue.component('mk-widget-container', widgetContainer);
Vue.component('mk-post-form', postForm);

View file

@ -54,7 +54,25 @@ export default Vue.extend({
MkVisibilityChooser MkVisibilityChooser
}, },
props: ['reply', 'renote'], props: {
reply: {
type: Object,
required: false
},
renote: {
type: Object,
required: false
},
initialText: {
type: String,
required: false
},
instant: {
type: Boolean,
required: false,
default: false
}
},
data() { data() {
return { return {
@ -112,6 +130,10 @@ export default Vue.extend({
}, },
mounted() { mounted() {
if (this.initialText) {
this.text = this.initialText;
}
if (this.reply && this.reply.user.host != null) { if (this.reply && this.reply.user.host != null) {
this.text = `@${this.reply.user.username}@${this.reply.user.host} `; this.text = `@${this.reply.user.username}@${this.reply.user.host} `;
} }
@ -252,8 +274,10 @@ export default Vue.extend({
visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined, visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined,
viaMobile: viaMobile viaMobile: viaMobile
}).then(data => { }).then(data => {
this.$emit('note'); this.$emit('posted');
this.$destroy(); this.$nextTick(() => {
this.$destroy();
});
}).catch(err => { }).catch(err => {
this.posting = false; this.posting = false;
}); });

View file

@ -0,0 +1,56 @@
<template>
<div class="azibmfpleajagva420swmu4c3r7ni7iw">
<h1>Misskeyで共有</h1>
<div>
<mk-signin v-if="!$store.getters.isSignedIn"/>
<mk-post-form v-else-if="!posted" :initial-text="text" :instant="true" @posted="posted = true"/>
<p v-if="posted" class="posted">%fa:check%</p>
</div>
<ui-button class="close" v-if="posted" @click="close">閉じる</ui-button>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
data() {
return {
posted: false,
text: new URLSearchParams(location.search).get('text')
};
},
methods: {
close() {
window.close();
}
}
});
</script>
<style lang="stylus" scoped>
.azibmfpleajagva420swmu4c3r7ni7iw
> h1
margin 8px 0
color #555
font-size 20px
text-align center
> div
max-width 500px
margin 0 auto
> .posted
display block
margin 0 auto
padding 64px
text-align center
background #fff
border-radius 6px
width calc(100% - 32px)
> .close
display block
margin 16px auto
width calc(100% - 32px)
</style>