summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/admin/views/moderators.vue50
-rw-r--r--src/client/app/admin/views/users.user.vue18
-rw-r--r--src/client/app/admin/views/users.vue33
-rw-r--r--src/client/app/common/scripts/collect-page-vars.ts6
-rw-r--r--src/client/app/common/scripts/get-face.ts3
-rw-r--r--src/client/app/common/views/components/mention.vue17
-rw-r--r--src/client/app/common/views/components/misskey-flavored-markdown.vue1
-rw-r--r--src/client/app/common/views/components/page/page.block.vue3
-rw-r--r--src/client/app/common/views/components/page/page.radio-button.vue37
-rw-r--r--src/client/app/common/views/components/poll-editor.vue14
-rw-r--r--src/client/app/common/views/components/reaction-picker.vue1
-rw-r--r--src/client/app/common/views/components/settings/app-type.vue19
-rw-r--r--src/client/app/common/views/components/settings/profile.vue69
-rw-r--r--src/client/app/common/views/components/settings/settings.vue39
-rw-r--r--src/client/app/common/views/components/signup.vue8
-rw-r--r--src/client/app/common/views/components/url-preview.vue1
-rw-r--r--src/client/app/common/views/components/url.vue1
-rw-r--r--src/client/app/common/views/pages/page-editor/els/page-editor.el.radio-button.vue53
-rw-r--r--src/client/app/common/views/pages/page-editor/page-editor.blocks.vue3
-rw-r--r--src/client/app/common/views/pages/page-editor/page-editor.vue1
-rw-r--r--src/client/app/desktop/api/update-avatar.ts15
-rw-r--r--src/client/app/desktop/api/update-banner.ts15
-rw-r--r--src/client/app/desktop/views/components/drive.vue6
-rw-r--r--src/client/app/mobile/views/components/drive.vue6
24 files changed, 381 insertions, 38 deletions
diff --git a/src/client/app/admin/views/moderators.vue b/src/client/app/admin/views/moderators.vue
index bf7d951fc7..8ceab02d97 100644
--- a/src/client/app/admin/views/moderators.vue
+++ b/src/client/app/admin/views/moderators.vue
@@ -12,6 +12,31 @@
</ui-horizon-group>
</section>
</ui-card>
+
+ <ui-card>
+ <template #title>{{ $t('logs.title') }}</template>
+ <section class="fit-top">
+ <sequential-entrance animation="entranceFromTop" delay="25">
+ <div v-for="log in logs" :key="log.id" class="">
+ <ui-horizon-group inputs>
+ <ui-input :value="log.user | acct" type="text" readonly>
+ <span>{{ $t('logs.moderator') }}</span>
+ </ui-input>
+ <ui-input :value="log.type" type="text" readonly>
+ <span>{{ $t('logs.type') }}</span>
+ </ui-input>
+ <ui-input :value="log.createdAt | date" type="text" readonly>
+ <span>{{ $t('logs.at') }}</span>
+ </ui-input>
+ </ui-horizon-group>
+ <ui-textarea :value="JSON.stringify(log.info, null, 4)" readonly>
+ <span>{{ $t('logs.info') }}</span>
+ </ui-textarea>
+ </div>
+ </sequential-entrance>
+ <ui-button v-if="existMoreLogs" @click="fetchLogs">{{ $t('@.load-more') }}</ui-button>
+ </section>
+ </ui-card>
</div>
</template>
@@ -26,10 +51,17 @@ export default Vue.extend({
data() {
return {
username: '',
- changing: false
+ changing: false,
+ logs: [],
+ untilLogId: null,
+ existMoreLogs: false
};
},
+ created() {
+ this.fetchLogs();
+ },
+
methods: {
async add() {
this.changing = true;
@@ -74,6 +106,22 @@ export default Vue.extend({
this.changing = false;
},
+
+ fetchLogs() {
+ this.$root.api('admin/show-moderation-logs', {
+ untilId: this.untilId,
+ limit: 10 + 1
+ }).then(logs => {
+ if (logs.length == 10 + 1) {
+ logs.pop();
+ this.existMoreLogs = true;
+ } else {
+ this.existMoreLogs = false;
+ }
+ this.logs = this.logs.concat(logs);
+ this.untilLogId = this.logs[this.logs.length - 1].id;
+ });
+ },
}
});
</script>
diff --git a/src/client/app/admin/views/users.user.vue b/src/client/app/admin/views/users.user.vue
index 929fc8f4b3..9c3db2d6c2 100644
--- a/src/client/app/admin/views/users.user.vue
+++ b/src/client/app/admin/views/users.user.vue
@@ -5,7 +5,7 @@
<mk-avatar class="avatar" :user="user" :disable-link="true"/>
</a>
</div>
- <div>
+ <div @click="click(user.id)">
<header>
<b><mk-user-name :user="user"/></b>
<span class="username">@{{ user | acct }}</span>
@@ -32,7 +32,7 @@ import { faSnowflake } from '@fortawesome/free-regular-svg-icons';
export default Vue.extend({
i18n: i18n('admin/views/users.vue'),
- props: ['user'],
+ props: ['user', 'click'],
data() {
return {
faSnowflake, faMicrophoneSlash
@@ -44,7 +44,7 @@ export default Vue.extend({
<style lang="stylus" scoped>
.kofvwchc
display flex
- padding 16px 0
+ padding 16px
border-top solid 1px var(--faceDivider)
> div:first-child
@@ -55,6 +55,7 @@ export default Vue.extend({
> div:last-child
flex 1
+ cursor pointer
padding-left 16px
@media (max-width 500px)
@@ -80,4 +81,15 @@ export default Vue.extend({
> .is-suspended
margin 0 0 0 .5em
color #4dabf7
+
+ &:hover
+ color var(--primaryForeground)
+ background var(--primary)
+ text-decoration none
+ border-radius 3px
+
+ &:active
+ color var(--primaryForeground)
+ background var(--primaryDarken10)
+ border-radius 3px
</style>
diff --git a/src/client/app/admin/views/users.vue b/src/client/app/admin/views/users.vue
index fd9f0dd8b2..92b23749ff 100644
--- a/src/client/app/admin/views/users.vue
+++ b/src/client/app/admin/views/users.vue
@@ -8,7 +8,7 @@
</ui-input>
<ui-button @click="showUser"><fa :icon="faSearch"/> {{ $t('lookup') }}</ui-button>
- <div class="user" v-if="user">
+ <div ref="user" class="user" v-if="user" :key="user.id">
<x-user :user="user"/>
<div class="actions">
<ui-button v-if="user.host != null" @click="updateRemoteUser"><fa :icon="faSync"/> {{ $t('update-remote-user') }}</ui-button>
@@ -54,8 +54,16 @@
<option value="remote">{{ $t('users.origin.remote') }}</option>
</ui-select>
</ui-horizon-group>
+ <ui-horizon-group searchboxes>
+ <ui-input v-model="searchUsername" type="text" spellcheck="false" @input="fetchUsers(true)">
+ <span>{{ $t('username') }}</span>
+ </ui-input>
+ <ui-input v-model="searchHost" type="text" spellcheck="false" @input="fetchUsers(true)" :disabled="origin === 'local'">
+ <span>{{ $t('host') }}</span>
+ </ui-input>
+ </ui-horizon-group>
<sequential-entrance animation="entranceFromTop" delay="25">
- <x-user v-for="user in users" :user='user' :key="user.id"/>
+ <x-user v-for="user in users" :key="user.id" :user='user' :click="showUserOnClick"/>
</sequential-entrance>
<ui-button v-if="existMore" @click="fetchUsers">{{ $t('@.load-more') }}</ui-button>
</section>
@@ -85,6 +93,8 @@ export default Vue.extend({
sort: '+createdAt',
state: 'all',
origin: 'local',
+ searchUsername: '',
+ searchHost: '',
limit: 10,
offset: 0,
users: [],
@@ -107,6 +117,7 @@ export default Vue.extend({
},
origin() {
+ if (this.origin === 'local') this.searchHost = '';
this.users = [];
this.offset = 0;
this.fetchUsers();
@@ -157,6 +168,15 @@ export default Vue.extend({
this.target = '';
},
+ async showUserOnClick(userId: string) {
+ this.$root.api('admin/show-user', { userId: userId }).then(info => {
+ this.user = info;
+ this.$nextTick(() => {
+ this.$refs.user.scrollIntoView();
+ });
+ });
+ },
+
/** 処理対象ユーザーの情報を更新する */
async refreshUser() {
this.$root.api('admin/show-user', { userId: this.user.id }).then(info => {
@@ -308,13 +328,16 @@ export default Vue.extend({
return !confirm.canceled;
},
- fetchUsers() {
+ fetchUsers(truncate?: boolean) {
+ if (truncate) this.offset = 0;
this.$root.api('admin/show-users', {
state: this.state,
origin: this.origin,
sort: this.sort,
offset: this.offset,
- limit: this.limit + 1
+ limit: this.limit + 1,
+ username: this.searchUsername,
+ hostname: this.searchHost
}).then(users => {
if (users.length == this.limit + 1) {
users.pop();
@@ -322,7 +345,7 @@ export default Vue.extend({
} else {
this.existMore = false;
}
- this.users = this.users.concat(users);
+ this.users = truncate ? users : this.users.concat(users);
this.offset += this.limit;
});
}
diff --git a/src/client/app/common/scripts/collect-page-vars.ts b/src/client/app/common/scripts/collect-page-vars.ts
index 4c40d5d88e..a4096fb2c2 100644
--- a/src/client/app/common/scripts/collect-page-vars.ts
+++ b/src/client/app/common/scripts/collect-page-vars.ts
@@ -32,6 +32,12 @@ export function collectPageVars(content) {
type: 'number',
value: 0
});
+ } else if (x.type === 'radioButton') {
+ pageVars.push({
+ name: x.name,
+ type: 'string',
+ value: x.default || ''
+ });
} else if (x.children) {
collect(x.children);
}
diff --git a/src/client/app/common/scripts/get-face.ts b/src/client/app/common/scripts/get-face.ts
index b523948bd3..19f2bdb064 100644
--- a/src/client/app/common/scripts/get-face.ts
+++ b/src/client/app/common/scripts/get-face.ts
@@ -4,7 +4,8 @@ const faces = [
'🐡( \'-\' 🐡 )フグパンチ!!!!',
'✌️(´・_・`)✌️',
'(。>﹏<。)',
- '(Δ・x・Δ)'
+ '(Δ・x・Δ)',
+ '(コ`・ヘ・´ケ)'
];
export default () => faces[Math.floor(Math.random() * faces.length)];
diff --git a/src/client/app/common/views/components/mention.vue b/src/client/app/common/views/components/mention.vue
index f212fd3ca5..4e9f9e90d6 100644
--- a/src/client/app/common/views/components/mention.vue
+++ b/src/client/app/common/views/components/mention.vue
@@ -1,11 +1,17 @@
<template>
-<router-link class="ldlomzub" :to="`/${ canonical }`" v-user-preview="canonical">
+<router-link class="ldlomzub" :to="url" v-user-preview="canonical" v-if="url.startsWith('/')">
<span class="me" v-if="isMe">{{ $t('@.you') }}</span>
<span class="main">
<span class="username">@{{ username }}</span>
<span class="host" :class="{ fade: $store.state.settings.contrastedAcct }" v-if="(host != localHost) || $store.state.settings.showFullAcct">@{{ toUnicode(host) }}</span>
</span>
</router-link>
+<a class="ldlomzub" :href="url" target="_blank" rel="noopener" v-else>
+ <span class="main">
+ <span class="username">@{{ username }}</span>
+ <span class="host" :class="{ fade: $store.state.settings.contrastedAcct }">@{{ toUnicode(host) }}</span>
+ </span>
+</a>
</template>
<script lang="ts">
@@ -32,6 +38,15 @@ export default Vue.extend({
};
},
computed: {
+ url(): string {
+ switch (this.host) {
+ case 'twitter.com':
+ case 'github.com':
+ return `https://${this.host}/${this.username}`;
+ default:
+ return `/${this.canonical}`;
+ }
+ },
canonical(): string {
return this.host === localHost ? `@${this.username}` : `@${this.username}@${toUnicode(this.host)}`;
},
diff --git a/src/client/app/common/views/components/misskey-flavored-markdown.vue b/src/client/app/common/views/components/misskey-flavored-markdown.vue
index 64496f9c84..963efd9ab8 100644
--- a/src/client/app/common/views/components/misskey-flavored-markdown.vue
+++ b/src/client/app/common/views/components/misskey-flavored-markdown.vue
@@ -30,6 +30,7 @@ export default Vue.extend({
border-radius 4px
>>> .quote
+ display block
margin 8px
padding 6px 0 6px 12px
color var(--mfmQuote)
diff --git a/src/client/app/common/views/components/page/page.block.vue b/src/client/app/common/views/components/page/page.block.vue
index 1c421fc2c0..56d1822013 100644
--- a/src/client/app/common/views/components/page/page.block.vue
+++ b/src/client/app/common/views/components/page/page.block.vue
@@ -16,10 +16,11 @@ import XIf from './page.if.vue';
import XTextarea from './page.textarea.vue';
import XPost from './page.post.vue';
import XCounter from './page.counter.vue';
+import XRadioButton from './page.radio-button.vue';
export default Vue.extend({
components: {
- XText, XSection, XImage, XButton, XNumberInput, XTextInput, XTextareaInput, XTextarea, XPost, XSwitch, XIf, XCounter
+ XText, XSection, XImage, XButton, XNumberInput, XTextInput, XTextareaInput, XTextarea, XPost, XSwitch, XIf, XCounter, XRadioButton
},
props: {
diff --git a/src/client/app/common/views/components/page/page.radio-button.vue b/src/client/app/common/views/components/page/page.radio-button.vue
new file mode 100644
index 0000000000..27c11bebad
--- /dev/null
+++ b/src/client/app/common/views/components/page/page.radio-button.vue
@@ -0,0 +1,37 @@
+<template>
+<div>
+ <div>{{ script.interpolate(value.title) }}</div>
+ <ui-radio v-for="x in value.values" v-model="v" :value="x" :key="x">{{ x }}</ui-radio>
+</div>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+
+export default Vue.extend({
+ props: {
+ value: {
+ required: true
+ },
+ script: {
+ required: true
+ }
+ },
+
+ data() {
+ return {
+ v: this.value.default,
+ };
+ },
+
+ watch: {
+ v() {
+ this.script.aiScript.updatePageVar(this.value.name, this.v);
+ this.script.eval();
+ }
+ }
+});
+</script>
+
+<style lang="stylus" scoped>
+</style>
diff --git a/src/client/app/common/views/components/poll-editor.vue b/src/client/app/common/views/components/poll-editor.vue
index f7a4d3af8c..49940134c7 100644
--- a/src/client/app/common/views/components/poll-editor.vue
+++ b/src/client/app/common/views/components/poll-editor.vue
@@ -26,13 +26,19 @@
<option value="after">{{ $t('after') }}</option>
</ui-select>
<section v-if="expiration === 'at'">
- <ui-input v-model="atDate" type="date">{{ $t('deadline-date') }}</ui-input>
- <ui-input v-model="atTime" type="time">{{ $t('deadline-time') }}</ui-input>
+ <ui-input v-model="atDate" type="date">
+ <template #title>{{ $t('deadline-date') }}</template>
+ </ui-input>
+ <ui-input v-model="atTime" type="time">
+ <template #title>{{ $t('deadline-time') }}</template>
+ </ui-input>
</section>
<section v-if="expiration === 'after'">
- <ui-input v-model="after" type="number">{{ $t('interval') }}</ui-input>
+ <ui-input v-model="after" type="number">
+ <template #title>{{ $t('interval') }}</template>
+ </ui-input>
<ui-select v-model="unit">
- <template #label>{{ $t('unit') }}</template>
+ <template #title>{{ $t('unit') }}</template>
<option value="second">{{ $t('second') }}</option>
<option value="minute">{{ $t('minute') }}</option>
<option value="hour">{{ $t('hour') }}</option>
diff --git a/src/client/app/common/views/components/reaction-picker.vue b/src/client/app/common/views/components/reaction-picker.vue
index 970d430069..ff534d37ce 100644
--- a/src/client/app/common/views/components/reaction-picker.vue
+++ b/src/client/app/common/views/components/reaction-picker.vue
@@ -276,6 +276,7 @@ export default Vue.extend({
font-size 14px
color var(--popupFg)
border-bottom solid var(--lineWidth) var(--faceDivider)
+ line-height 20px
> .buttons
padding 4px 4px 8px 4px
diff --git a/src/client/app/common/views/components/settings/app-type.vue b/src/client/app/common/views/components/settings/app-type.vue
index 90ff28803b..d163f1e746 100644
--- a/src/client/app/common/views/components/settings/app-type.vue
+++ b/src/client/app/common/views/components/settings/app-type.vue
@@ -29,8 +29,25 @@ export default Vue.extend({
computed: {
appTypeForce: {
get() { return this.$store.state.device.appTypeForce; },
- set(value) { this.$store.commit('device/set', { key: 'appTypeForce', value }); }
+ set(value) {
+ this.$store.commit('device/set', { key: 'appTypeForce', value });
+ this.reload();
+ }
},
},
+
+ methods: {
+ reload() {
+ this.$root.dialog({
+ type: 'warning',
+ text: this.$t('@.reload-to-apply-the-setting'),
+ showCancelButton: true
+ }).then(({ canceled }) => {
+ if (!canceled) {
+ location.reload();
+ }
+ });
+ },
+ }
});
</script>
diff --git a/src/client/app/common/views/components/settings/profile.vue b/src/client/app/common/views/components/settings/profile.vue
index a22fd6df98..edfc5a9edf 100644
--- a/src/client/app/common/views/components/settings/profile.vue
+++ b/src/client/app/common/views/components/settings/profile.vue
@@ -51,6 +51,26 @@
<template #desc v-if="bannerUploading">{{ $t('uploading') }}<mk-ellipsis/></template>
</ui-input>
+ <div class="fields">
+ <header>{{ $t('profile-metadata') }}</header>
+ <ui-horizon-group>
+ <ui-input v-model="fieldName0">{{ $t('metadata-label') }}</ui-input>
+ <ui-input v-model="fieldValue0">{{ $t('metadata-content') }}</ui-input>
+ </ui-horizon-group>
+ <ui-horizon-group>
+ <ui-input v-model="fieldName1">{{ $t('metadata-label') }}</ui-input>
+ <ui-input v-model="fieldValue1">{{ $t('metadata-content') }}</ui-input>
+ </ui-horizon-group>
+ <ui-horizon-group>
+ <ui-input v-model="fieldName2">{{ $t('metadata-label') }}</ui-input>
+ <ui-input v-model="fieldValue2">{{ $t('metadata-content') }}</ui-input>
+ </ui-horizon-group>
+ <ui-horizon-group>
+ <ui-input v-model="fieldName3">{{ $t('metadata-label') }}</ui-input>
+ <ui-input v-model="fieldValue3">{{ $t('metadata-content') }}</ui-input>
+ </ui-horizon-group>
+ </div>
+
<ui-button @click="save(true)"><fa :icon="faSave"/> {{ $t('save') }}</ui-button>
</ui-form>
</section>
@@ -189,6 +209,17 @@ export default Vue.extend({
this.isLocked = this.$store.state.i.isLocked;
this.carefulBot = this.$store.state.i.carefulBot;
this.autoAcceptFollowed = this.$store.state.i.autoAcceptFollowed;
+
+ if (this.$store.state.i.fields) {
+ this.fieldName0 = this.$store.state.i.fields[0].name;
+ this.fieldValue0 = this.$store.state.i.fields[0].value;
+ this.fieldName1 = this.$store.state.i.fields[1].name;
+ this.fieldValue1 = this.$store.state.i.fields[1].value;
+ this.fieldName2 = this.$store.state.i.fields[2].name;
+ this.fieldValue2 = this.$store.state.i.fields[2].value;
+ this.fieldName3 = this.$store.state.i.fields[3].name;
+ this.fieldValue3 = this.$store.state.i.fields[3].value;
+ }
},
methods: {
@@ -237,6 +268,13 @@ export default Vue.extend({
},
save(notify) {
+ const fields = [
+ { name: this.fieldName0, value: this.fieldValue0 },
+ { name: this.fieldName1, value: this.fieldValue1 },
+ { name: this.fieldName2, value: this.fieldValue2 },
+ { name: this.fieldName3, value: this.fieldValue3 },
+ ];
+
this.saving = true;
this.$root.api('i/update', {
@@ -247,6 +285,7 @@ export default Vue.extend({
birthday: this.birthday || null,
avatarId: this.avatarId || undefined,
bannerId: this.bannerId || undefined,
+ fields,
isCat: !!this.isCat,
isBot: !!this.isBot,
isLocked: !!this.isLocked,
@@ -265,6 +304,29 @@ export default Vue.extend({
text: this.$t('saved')
});
}
+ }).catch(err => {
+ this.saving = false;
+ switch(err.id) {
+ case 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191':
+ this.$root.dialog({
+ type: 'error',
+ title: this.$t('unable-to-process'),
+ text: this.$t('avatar-not-an-image')
+ });
+ break;
+ case '75aedb19-2afd-4e6d-87fc-67941256fa60':
+ this.$root.dialog({
+ type: 'error',
+ title: this.$t('unable-to-process'),
+ text: this.$t('banner-not-an-image')
+ });
+ break;
+ default:
+ this.$root.dialog({
+ type: 'error',
+ text: this.$t('unable-to-process')
+ });
+ }
});
},
@@ -366,4 +428,11 @@ export default Vue.extend({
height 72px
margin auto
+.fields
+ > header
+ padding 8px 0px
+ font-weight bold
+ > div
+ padding-left 16px
+
</style>
diff --git a/src/client/app/common/views/components/settings/settings.vue b/src/client/app/common/views/components/settings/settings.vue
index 281524979e..401d9423ae 100644
--- a/src/client/app/common/views/components/settings/settings.vue
+++ b/src/client/app/common/views/components/settings/settings.vue
@@ -143,13 +143,17 @@
<ui-input v-model="webSearchEngine">{{ $t('@._settings.web-search-engine') }}
<template #desc>{{ $t('@._settings.web-search-engine-desc') }}</template>
</ui-input>
+ <ui-button @click="save('webSearchEngine', webSearchEngine)"><fa :icon="faSave"/> {{ $t('@._settings.save') }}</ui-button>
</section>
<section v-if="!$root.isMobile">
<header>{{ $t('@._settings.paste') }}</header>
<ui-input v-model="pastedFileName">{{ $t('@._settings.pasted-file-name') }}
- <template #desc>{{ $t('@._settings.pasted-file-name-desc') }}</template>
+ <template v-if="pastedFileName === this.$store.state.settings.pastedFileName" #desc>{{ $t('@._settings.pasted-file-name-desc') }}</template>
+ <template v-else #desc>{{ pastedFileNamePreview() }}</template>
</ui-input>
+ <ui-button @click="save('pastedFileName', pastedFileName)"><fa :icon="faSave"/> {{ $t('@._settings.save') }}</ui-button>
+
<ui-switch v-model="pasteDialog">{{ $t('@._settings.paste-dialog') }}
<template #desc>{{ $t('@._settings.paste-dialog-desc') }}</template>
</ui-switch>
@@ -289,6 +293,8 @@ import XNotification from './notification.vue';
import { url, version } from '../../../../config';
import checkForUpdate from '../../../scripts/check-for-update';
+import { formatTimeString } from '../../../../../../misc/format-time-string';
+import { faSave } from '@fortawesome/free-regular-svg-icons';
export default Vue.extend({
i18n: i18n(),
@@ -319,8 +325,11 @@ export default Vue.extend({
return {
meta: null,
version,
+ webSearchEngine: this.$store.state.settings.webSearchEngine,
+ pastedFileName : this.$store.state.settings.pastedFileName,
latestVersion: undefined,
- checkingForUpdate: false
+ checkingForUpdate: false,
+ faSave
};
},
computed: {
@@ -419,16 +428,6 @@ export default Vue.extend({
set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteVisibility', value }); }
},
- webSearchEngine: {
- get() { return this.$store.state.settings.webSearchEngine; },
- set(value) { this.$store.dispatch('settings/set', { key: 'webSearchEngine', value }); }
- },
-
- pastedFileName: {
- get() { return this.$store.state.settings.pastedFileName; },
- set(value) { this.$store.dispatch('settings/set', { key: 'pastedFileName', value }); }
- },
-
pasteDialog: {
get() { return this.$store.state.settings.pasteDialog; },
set(value) { this.$store.dispatch('settings/set', { key: 'pasteDialog', value }); }
@@ -565,6 +564,17 @@ export default Vue.extend({
}
});
},
+ save(key, value) {
+ this.$store.dispatch('settings/set', {
+ key,
+ value
+ }).then(() => {
+ this.$root.dialog({
+ type: 'success',
+ text: this.$t('@._settings.saved')
+ })
+ });
+ },
customizeHome() {
location.href = '/?customize';
},
@@ -600,7 +610,10 @@ export default Vue.extend({
const sound = new Audio(`${url}/assets/message.mp3`);
sound.volume = this.$store.state.device.soundVolume;
sound.play();
- }
+ },
+ pastedFileNamePreview() {
+ return `${formatTimeString(new Date(), this.pastedFileName).replace(/{{number}}/g, `1`)}.png`
+ },
}
});
</script>
diff --git a/src/client/app/common/views/components/signup.vue b/src/client/app/common/views/components/signup.vue
index 421d09a4dd..893f6575fb 100644
--- a/src/client/app/common/views/components/signup.vue
+++ b/src/client/app/common/views/components/signup.vue
@@ -43,7 +43,7 @@
</i18n>
</ui-switch>
<div v-if="meta.enableRecaptcha" class="g-recaptcha" :data-sitekey="meta.recaptchaSiteKey" style="margin: 16px 0;"></div>
- <ui-button type="submit" :disabled="!(meta.ToSUrl ? ToSAgreement : true) || passwordRetypeState == 'not-match'">{{ $t('create') }}</ui-button>
+ <ui-button type="submit" :disabled=" submitting || !(meta.ToSUrl ? ToSAgreement : true) || passwordRetypeState == 'not-match'">{{ $t('create') }}</ui-button>
</template>
</form>
</template>
@@ -70,6 +70,7 @@ export default Vue.extend({
passwordStrength: '',
passwordRetypeState: null,
meta: {},
+ submitting: false,
ToSAgreement: false
}
},
@@ -145,6 +146,9 @@ export default Vue.extend({
},
onSubmit() {
+ if (this.submitting) return;
+ this.submitting = true;
+
this.$root.api('signup', {
username: this.username,
password: this.password,
@@ -159,6 +163,8 @@ export default Vue.extend({
location.href = '/';
});
}).catch(() => {
+ this.submitting = false;
+
this.$root.dialog({
type: 'error',
text: this.$t('some-error')
diff --git a/src/client/app/common/views/components/url-preview.vue b/src/client/app/common/views/components/url-preview.vue
index 476c671e77..80aae5999d 100644
--- a/src/client/app/common/views/components/url-preview.vue
+++ b/src/client/app/common/views/components/url-preview.vue
@@ -66,6 +66,7 @@ export default Vue.extend({
(this.url.substr(local.length) === '/') ||
this.url.substr(local.length).startsWith('/@') ||
this.url.substr(local.length).startsWith('/notes/') ||
+ this.url.substr(local.length).startsWith('/tags/') ||
this.url.substr(local.length).startsWith('/pages/');
return {
local,
diff --git a/src/client/app/common/views/components/url.vue b/src/client/app/common/views/components/url.vue
index b1ca3f285c..3a304ad6e7 100644
--- a/src/client/app/common/views/components/url.vue
+++ b/src/client/app/common/views/components/url.vue
@@ -28,6 +28,7 @@ export default Vue.extend({
(this.url.substr(local.length) === '/') ||
this.url.substr(local.length).startsWith('/@') ||
this.url.substr(local.length).startsWith('/notes/') ||
+ this.url.substr(local.length).startsWith('/tags/') ||
this.url.substr(local.length).startsWith('/pages/'));
return {
local,
diff --git a/src/client/app/common/views/pages/page-editor/els/page-editor.el.radio-button.vue b/src/client/app/common/views/pages/page-editor/els/page-editor.el.radio-button.vue
new file mode 100644
index 0000000000..3401c46f47
--- /dev/null
+++ b/src/client/app/common/views/pages/page-editor/els/page-editor.el.radio-button.vue
@@ -0,0 +1,53 @@
+<template>
+<x-container @remove="() => $emit('remove')" :draggable="true">
+ <template #header><fa :icon="faBolt"/> {{ $t('blocks.radioButton') }}</template>
+
+ <section style="padding: 0 16px 16px 16px;">
+ <ui-input v-model="value.name"><template #prefix><fa :icon="faMagic"/></template><span>{{ $t('blocks._radioButton.name') }}</span></ui-input>
+ <ui-input v-model="value.title"><span>{{ $t('blocks._radioButton.title') }}</span></ui-input>
+ <ui-textarea v-model="values"><span>{{ $t('blocks._radioButton.values') }}</span></ui-textarea>
+ <ui-input v-model="value.default"><span>{{ $t('blocks._radioButton.default') }}</span></ui-input>
+ </section>
+</x-container>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+import { faBolt, faMagic } from '@fortawesome/free-solid-svg-icons';
+import i18n from '../../../../../i18n';
+import XContainer from '../page-editor.container.vue';
+
+export default Vue.extend({
+ i18n: i18n('pages'),
+
+ components: {
+ XContainer
+ },
+
+ props: {
+ value: {
+ required: true
+ },
+ },
+
+ data() {
+ return {
+ values: '',
+ faBolt, faMagic
+ };
+ },
+
+ watch: {
+ values() {
+ Vue.set(this.value, 'values', this.values.split('\n'));
+ }
+ },
+
+ created() {
+ if (this.value.name == null) Vue.set(this.value, 'name', '');
+ if (this.value.title == null) Vue.set(this.value, 'title', '');
+ if (this.value.values == null) Vue.set(this.value, 'values', []);
+ this.values = this.value.values.join('\n');
+ },
+});
+</script>
diff --git a/src/client/app/common/views/pages/page-editor/page-editor.blocks.vue b/src/client/app/common/views/pages/page-editor/page-editor.blocks.vue
index c5f3419e7b..4d7293231f 100644
--- a/src/client/app/common/views/pages/page-editor/page-editor.blocks.vue
+++ b/src/client/app/common/views/pages/page-editor/page-editor.blocks.vue
@@ -19,10 +19,11 @@ import XSwitch from './els/page-editor.el.switch.vue';
import XIf from './els/page-editor.el.if.vue';
import XPost from './els/page-editor.el.post.vue';
import XCounter from './els/page-editor.el.counter.vue';
+import XRadioButton from './els/page-editor.el.radio-button.vue';
export default Vue.extend({
components: {
- XDraggable, XSection, XText, XImage, XButton, XTextarea, XTextInput, XTextareaInput, XNumberInput, XSwitch, XIf, XPost, XCounter
+ XDraggable, XSection, XText, XImage, XButton, XTextarea, XTextInput, XTextareaInput, XNumberInput, XSwitch, XIf, XPost, XCounter, XRadioButton
},
props: {
diff --git a/src/client/app/common/views/pages/page-editor/page-editor.vue b/src/client/app/common/views/pages/page-editor/page-editor.vue
index ade7d86991..0162915c38 100644
--- a/src/client/app/common/views/pages/page-editor/page-editor.vue
+++ b/src/client/app/common/views/pages/page-editor/page-editor.vue
@@ -342,6 +342,7 @@ export default Vue.extend({
label: this.$t('input-blocks'),
items: [
{ value: 'button', text: this.$t('blocks.button') },
+ { value: 'radioButton', text: this.$t('blocks.radioButton') },
{ value: 'textInput', text: this.$t('blocks.textInput') },
{ value: 'textareaInput', text: this.$t('blocks.textareaInput') },
{ value: 'numberInput', text: this.$t('blocks.numberInput') },
diff --git a/src/client/app/desktop/api/update-avatar.ts b/src/client/app/desktop/api/update-avatar.ts
index a095491b69..6b88b51ef1 100644
--- a/src/client/app/desktop/api/update-avatar.ts
+++ b/src/client/app/desktop/api/update-avatar.ts
@@ -83,6 +83,21 @@ export default ($root: any) => {
});
return i;
+ }).catch(err => {
+ switch (err.id) {
+ case 'f419f9f8-2f4d-46b1-9fb4-49d3a2fd7191':
+ $root.dialog({
+ type: 'error',
+ title: locale['desktop']['unable-to-process'],
+ text: locale['desktop']['invalid-filetype']
+ });
+ break;
+ default:
+ $root.dialog({
+ type: 'error',
+ text: locale['desktop']['unable-to-process']
+ });
+ }
});
};
diff --git a/src/client/app/desktop/api/update-banner.ts b/src/client/app/desktop/api/update-banner.ts
index c23a325364..09632b1941 100644
--- a/src/client/app/desktop/api/update-banner.ts
+++ b/src/client/app/desktop/api/update-banner.ts
@@ -83,6 +83,21 @@ export default ($root: any) => {
});
return i;
+ }).catch(err => {
+ switch (err.id) {
+ case '75aedb19-2afd-4e6d-87fc-67941256fa60':
+ $root.dialog({
+ type: 'error',
+ title: locale['desktop']['unable-to-process'],
+ text: locale['desktop']['invalid-filetype']
+ });
+ break;
+ default:
+ $root.dialog({
+ type: 'error',
+ text: locale['desktop']['unable-to-process']
+ });
+ }
});
};
diff --git a/src/client/app/desktop/views/components/drive.vue b/src/client/app/desktop/views/components/drive.vue
index a78c0040c3..ff4ff18e6e 100644
--- a/src/client/app/desktop/views/components/drive.vue
+++ b/src/client/app/desktop/views/components/drive.vue
@@ -22,19 +22,19 @@
>
<div class="selection" ref="selection"></div>
<div class="contents" ref="contents">
- <div class="folders" ref="foldersContainer" v-if="folders.length > 0">
+ <div class="folders" ref="foldersContainer" v-if="folders.length > 0 || moreFolders">
<x-folder v-for="folder in folders" :key="folder.id" class="folder" :folder="folder"/>
<!-- SEE: https://stackoverflow.com/questions/18744164/flex-box-align-last-row-to-grid -->
<div class="padding" v-for="n in 16"></div>
<ui-button v-if="moreFolders">{{ $t('@.load-more') }}</ui-button>
</div>
- <div class="files" ref="filesContainer" v-if="files.length > 0">
+ <div class="files" ref="filesContainer" v-if="files.length > 0 || moreFiles">
<x-file v-for="file in files" :key="file.id" class="file" :file="file"/>
<!-- SEE: https://stackoverflow.com/questions/18744164/flex-box-align-last-row-to-grid -->
<div class="padding" v-for="n in 16"></div>
<ui-button v-if="moreFiles" @click="fetchMoreFiles">{{ $t('@.load-more') }}</ui-button>
</div>
- <div class="empty" v-if="files.length == 0 && folders.length == 0 && !fetching">
+ <div class="empty" v-if="files.length == 0 && !moreFiles && folders.length == 0 && !moreFolders && !fetching">
<p v-if="draghover">{{ $t('empty-draghover') }}</p>
<p v-if="!draghover && folder == null"><strong>{{ $t('empty-drive') }}</strong><br/>{{ $t('empty-drive-description') }}</p>
<p v-if="!draghover && folder != null">{{ $t('empty-folder') }}</p>
diff --git a/src/client/app/mobile/views/components/drive.vue b/src/client/app/mobile/views/components/drive.vue
index 2613cfff99..f24c8492e5 100644
--- a/src/client/app/mobile/views/components/drive.vue
+++ b/src/client/app/mobile/views/components/drive.vue
@@ -25,17 +25,17 @@
<template v-if="folder.filesCount > 0">{{ folder.filesCount }} {{ $t('file-count') }}</template>
</p>
</div>
- <div class="folders" v-if="folders.length > 0">
+ <div class="folders" v-if="folders.length > 0 || moreFolders">
<x-folder class="folder" v-for="folder in folders" :key="folder.id" :folder="folder"/>
<p v-if="moreFolders">{{ $t('@.load-more') }}</p>
</div>
- <div class="files" v-if="files.length > 0">
+ <div class="files" v-if="files.length > 0 || moreFiles">
<x-file class="file" v-for="file in files" :key="file.id" :file="file"/>
<button class="more" v-if="moreFiles" @click="fetchMoreFiles">
{{ fetchingMoreFiles ? this.$t('@.loading') : this.$t('@.load-more') }}
</button>
</div>
- <div class="empty" v-if="files.length == 0 && folders.length == 0 && !fetching">
+ <div class="empty" v-if="files.length == 0 && !moreFiles && folders.length == 0 && !moreFolders && !fetching">
<p v-if="folder == null">{{ $t('nothing-in-drive') }}</p>
<p v-if="folder != null">{{ $t('folder-is-empty') }}</p>
</div>