Merge branch 'develop' into vue3
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { toUnicode } from 'punycode';
|
||||
import { host as localHost } from '../config';
|
||||
import { wellKnownServices } from '../../well-known-services';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -37,12 +38,11 @@ export default defineComponent({
|
||||
},
|
||||
computed: {
|
||||
url(): string {
|
||||
switch (this.host) {
|
||||
case 'twitter.com':
|
||||
case 'github.com':
|
||||
return `https://${this.host}/${this.username}`;
|
||||
default:
|
||||
return `/${this.canonical}`;
|
||||
const wellKnown = wellKnownServices.find(x => x[0] === this.host);
|
||||
if (wellKnown) {
|
||||
return wellKnown[1](this.username);
|
||||
} else {
|
||||
return `/${this.canonical}`;
|
||||
}
|
||||
},
|
||||
canonical(): string {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
</transition>
|
||||
|
||||
<transition name="nav">
|
||||
<nav class="nav" v-show="showing">
|
||||
<nav class="nav" :class="{ iconOnly, hidden }" v-show="showing">
|
||||
<div>
|
||||
<button class="item _button account" @click="openAccountMenu" v-if="$store.getters.isSignedIn">
|
||||
<mk-avatar :user="$store.state.i" class="avatar"/><mk-acct class="text" :user="$store.state.i"/>
|
||||
@@ -62,6 +62,8 @@ export default defineComponent({
|
||||
menuDef: this.$store.getters.nav({
|
||||
search: this.search
|
||||
}),
|
||||
iconOnly: false,
|
||||
hidden: false,
|
||||
faGripVertical, faChevronLeft, faComments, faHashtag, faBroadcastTower, faFireAlt, faEllipsisH, faPencilAlt, faBars, faTimes, faBell, faSearch, faUserCog, faCog, faUser, faHome, faStar, faCircle, faAt, faEnvelope, faListUl, faPlus, faUserClock, faLaugh, faUsers, faTachometerAlt, faExchangeAlt, faGlobe, faChartBar, faCloud, faServer, faProjectDiagram
|
||||
};
|
||||
},
|
||||
@@ -85,9 +87,35 @@ export default defineComponent({
|
||||
$route(to, from) {
|
||||
this.showing = false;
|
||||
},
|
||||
|
||||
'$store.state.device.sidebarDisplay'() {
|
||||
this.calcViewState();
|
||||
},
|
||||
|
||||
iconOnly() {
|
||||
this.$nextTick(() => {
|
||||
this.$emit('change-view-mode');
|
||||
});
|
||||
},
|
||||
|
||||
hidden() {
|
||||
this.$nextTick(() => {
|
||||
this.$emit('change-view-mode');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
window.addEventListener('resize', this.calcViewState);
|
||||
this.calcViewState();
|
||||
},
|
||||
|
||||
methods: {
|
||||
calcViewState() {
|
||||
this.iconOnly = (window.innerWidth <= 1279) || (this.$store.state.device.sidebarDisplay === 'icon');
|
||||
this.hidden = (window.innerWidth <= 650) || (this.$store.state.device.sidebarDisplay === 'hide');
|
||||
},
|
||||
|
||||
show() {
|
||||
this.showing = true;
|
||||
},
|
||||
@@ -314,10 +342,8 @@ export default defineComponent({
|
||||
|
||||
.mvcprjjd {
|
||||
$ui-font-size: 1em; // TODO: どこかに集約したい
|
||||
$nav-width: 250px; // TODO: どこかに集約したい
|
||||
$nav-icon-only-width: 80px; // TODO: どこかに集約したい
|
||||
$nav-icon-only-threshold: 1279px; // TODO: どこかに集約したい
|
||||
$nav-hide-threshold: 650px; // TODO: どこかに集約したい
|
||||
$nav-width: 250px;
|
||||
$nav-icon-only-width: 80px;
|
||||
|
||||
> .nav-back {
|
||||
z-index: 1001;
|
||||
@@ -331,19 +357,66 @@ export default defineComponent({
|
||||
width: $nav-width;
|
||||
box-sizing: border-box;
|
||||
|
||||
@media (max-width: $nav-icon-only-threshold) {
|
||||
&.iconOnly {
|
||||
flex: 0 0 $nav-icon-only-width;
|
||||
width: $nav-icon-only-width;
|
||||
|
||||
&:not(.hidden) {
|
||||
> div {
|
||||
width: $nav-icon-only-width;
|
||||
|
||||
> .divider {
|
||||
margin: 8px auto;
|
||||
width: calc(100% - 32px);
|
||||
}
|
||||
|
||||
> .item {
|
||||
padding-left: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: $ui-font-size * 1.1;
|
||||
line-height: 3.7rem;
|
||||
|
||||
> [data-icon],
|
||||
> .avatar {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
> i {
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
> .text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: $nav-hide-threshold) {
|
||||
&.hidden {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1001;
|
||||
|
||||
> div {
|
||||
> .index,
|
||||
> .notifications {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: $nav-hide-threshold + 1px) {
|
||||
&:not(.hidden) {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
@@ -365,25 +438,6 @@ export default defineComponent({
|
||||
border-top: solid 1px var(--divider);
|
||||
}
|
||||
|
||||
@media (max-width: $nav-icon-only-threshold) and (min-width: $nav-hide-threshold + 1px) {
|
||||
width: $nav-icon-only-width;
|
||||
|
||||
> .divider {
|
||||
margin: 8px auto;
|
||||
width: calc(100% - 32px);
|
||||
}
|
||||
|
||||
> .item {
|
||||
&:first-child {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .item {
|
||||
position: relative;
|
||||
display: block;
|
||||
@@ -452,34 +506,6 @@ export default defineComponent({
|
||||
margin-top: 16px;
|
||||
border-top: solid 1px var(--divider);
|
||||
}
|
||||
|
||||
@media (max-width: $nav-icon-only-threshold) and (min-width: $nav-hide-threshold + 1px) {
|
||||
padding-left: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: $ui-font-size * 1.2;
|
||||
line-height: 3.7rem;
|
||||
|
||||
> [data-icon],
|
||||
> .avatar {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
> i {
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
> .text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: $nav-hide-threshold) {
|
||||
> .index,
|
||||
> .notifications {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@
|
||||
<x-window ref="window" :width="400" :height="450" :no-padding="true" @closed="() => { $emit('closed'); destroyDom(); }" :with-ok-button="true" :ok-button-disabled="false" @ok="ok()" :can-close="false">
|
||||
<template #header>{{ title || $t('generateAccessToken') }}</template>
|
||||
<div class="ugkkpisj">
|
||||
<div>
|
||||
<mk-info warn v-if="information">{{ information }}</mk-info>
|
||||
<div v-if="information">
|
||||
<mk-info warn>{{ information }}</mk-info>
|
||||
</div>
|
||||
<div>
|
||||
<mk-input v-model="name">{{ $t('name') }}</mk-input>
|
||||
|
@@ -19,14 +19,14 @@ import MkButton from './button.vue';
|
||||
import paging from '../../scripts/paging';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [
|
||||
paging({}),
|
||||
],
|
||||
|
||||
components: {
|
||||
MkButton
|
||||
},
|
||||
|
||||
mixins: [
|
||||
paging({}),
|
||||
],
|
||||
|
||||
props: {
|
||||
pagination: {
|
||||
required: true
|
||||
|
@@ -42,6 +42,7 @@ export default defineComponent({
|
||||
},
|
||||
methods: {
|
||||
toggle() {
|
||||
if (this.disabled) return;
|
||||
this.$emit('change', this.value);
|
||||
}
|
||||
}
|
||||
@@ -61,7 +62,10 @@ export default defineComponent({
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
|
||||
&, * {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.checked {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="mk-app" v-hotkey.global="keymap">
|
||||
<header class="header">
|
||||
<header class="header" ref="header">
|
||||
<div class="title" ref="title">
|
||||
<transition :name="$store.state.device.animation ? 'header' : ''" mode="out-in" appear>
|
||||
<button class="_button back" v-if="canBack" @click="back()"><fa :icon="faChevronLeft"/></button>
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<x-sidebar ref="nav"/>
|
||||
<x-sidebar ref="nav" @change-view-mode="calcHeaderWidth"/>
|
||||
|
||||
<div class="contents" ref="contents" :class="{ wallpaper }">
|
||||
<main ref="main">
|
||||
@@ -79,7 +79,7 @@
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<div class="buttons" :class="{ navHidden }">
|
||||
<button class="button nav _button" @click="showNav" ref="navButton"><fa :icon="faBars"/><i v-if="navIndicated"><fa :icon="faCircle"/></i></button>
|
||||
<button v-if="$route.name === 'index'" class="button home _button" @click="top()"><fa :icon="faHome"/></button>
|
||||
<button v-else class="button home _button" @click="$router.push('/')"><fa :icon="faHome"/></button>
|
||||
@@ -87,7 +87,7 @@
|
||||
<button v-if="$store.getters.isSignedIn" class="button post _buttonPrimary" @click="post()"><fa :icon="faPencilAlt"/></button>
|
||||
</div>
|
||||
|
||||
<button v-if="$store.getters.isSignedIn" class="post _buttonPrimary" @click="post()"><fa :icon="faPencilAlt"/></button>
|
||||
<button v-if="$store.getters.isSignedIn" class="post _buttonPrimary" :class="{ navHidden }" @click="post()"><fa :icon="faPencilAlt"/></button>
|
||||
|
||||
<stream-indicator v-if="$store.getters.isSignedIn"/>
|
||||
</div>
|
||||
@@ -126,6 +126,7 @@ export default defineComponent({
|
||||
isDesktop: window.innerWidth >= DESKTOP_THRESHOLD,
|
||||
canBack: false,
|
||||
menuDef: this.$store.getters.nav({}),
|
||||
navHidden: false,
|
||||
wallpaper: localStorage.getItem('wallpaper') != null,
|
||||
faGripVertical, faChevronLeft, faComments, faHashtag, faBroadcastTower, faFireAlt, faEllipsisH, faPencilAlt, faBars, faTimes, faBell, faSearch, faUserCog, faCog, faUser, faHome, faStar, faCircle, faAt, faEnvelope, faListUl, faPlus, faUserClock, faLaugh, faUsers, faTachometerAlt, faExchangeAlt, faGlobe, faChartBar, faCloud, faServer, faProjectDiagram
|
||||
};
|
||||
@@ -227,22 +228,15 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
const adjustTitlePosition = () => {
|
||||
const left = this.$refs.main.getBoundingClientRect().left - this.$refs.nav.$el.offsetWidth;
|
||||
if (left >= 0) {
|
||||
this.$refs.title.style.left = left + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
adjustTitlePosition();
|
||||
this.adjustTitlePosition();
|
||||
|
||||
const ro = new ResizeObserver((entries, observer) => {
|
||||
adjustTitlePosition();
|
||||
this.adjustTitlePosition();
|
||||
});
|
||||
|
||||
ro.observe(this.$refs.contents);
|
||||
|
||||
window.addEventListener('resize', adjustTitlePosition, { passive: true });
|
||||
window.addEventListener('resize', this.adjustTitlePosition, { passive: true });
|
||||
|
||||
if (!this.isDesktop) {
|
||||
window.addEventListener('resize', () => {
|
||||
@@ -252,9 +246,27 @@ export default defineComponent({
|
||||
|
||||
// widget follow
|
||||
this.attachSticky();
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.calcHeaderWidth();
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
adjustTitlePosition() {
|
||||
const left = this.$refs.main.getBoundingClientRect().left - this.$refs.nav.$el.offsetWidth;
|
||||
if (left >= 0) {
|
||||
this.$refs.title.style.left = left + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
calcHeaderWidth() {
|
||||
const navWidth = this.$refs.nav.$el.offsetWidth;
|
||||
this.navHidden = navWidth === 0;
|
||||
this.$refs.header.style.width = `calc(100% - ${navWidth}px)`;
|
||||
this.adjustTitlePosition();
|
||||
},
|
||||
|
||||
showNav() {
|
||||
this.$refs.nav.show();
|
||||
},
|
||||
@@ -375,12 +387,8 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.mk-app {
|
||||
$header-height: 60px;
|
||||
$nav-width: 250px; // TODO: どこかに集約したい
|
||||
$nav-icon-only-width: 80px; // TODO: どこかに集約したい
|
||||
$main-width: 670px;
|
||||
$ui-font-size: 1em; // TODO: どこかに集約したい
|
||||
$nav-icon-only-threshold: 1279px; // TODO: どこかに集約したい
|
||||
$nav-hide-threshold: 650px; // TODO: どこかに集約したい
|
||||
$header-sub-hide-threshold: 1090px;
|
||||
$left-widgets-hide-threshold: 1600px;
|
||||
$right-widgets-hide-threshold: 1090px;
|
||||
@@ -401,21 +409,13 @@ export default defineComponent({
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: $header-height;
|
||||
width: calc(100% - #{$nav-width});
|
||||
width: 100%;
|
||||
//background-color: var(--panel);
|
||||
-webkit-backdrop-filter: blur(32px);
|
||||
backdrop-filter: blur(32px);
|
||||
background-color: var(--header);
|
||||
border-bottom: solid 1px var(--divider);
|
||||
|
||||
@media (max-width: $nav-icon-only-threshold) {
|
||||
width: calc(100% - #{$nav-icon-only-width});
|
||||
}
|
||||
|
||||
@media (max-width: $nav-hide-threshold) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
> .title {
|
||||
position: relative;
|
||||
line-height: $header-height;
|
||||
@@ -685,7 +685,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
> .post {
|
||||
display: none;
|
||||
display: block;
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
bottom: 32px;
|
||||
@@ -696,8 +696,8 @@ export default defineComponent({
|
||||
box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
|
||||
font-size: 22px;
|
||||
|
||||
@media (min-width: ($nav-hide-threshold + 1px)) {
|
||||
display: block;
|
||||
&.navHidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (min-width: ($header-sub-hide-threshold + 1px)) {
|
||||
@@ -719,7 +719,7 @@ export default defineComponent({
|
||||
padding: 0 16px 16px 16px;
|
||||
}
|
||||
|
||||
@media (min-width: ($nav-hide-threshold + 1px)) {
|
||||
&:not(.navHidden) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
<img v-if="announcement.imageUrl" :src="announcement.imageUrl"/>
|
||||
</div>
|
||||
<div class="_footer" v-if="$store.getters.isSignedIn && !announcement.isRead">
|
||||
<mk-button @click="read(announcement)" primary><fa :icon="faCheck"/> {{ $t('gotIt') }}</mk-button>
|
||||
<mk-button @click="read(items, announcement, i)" primary><fa :icon="faCheck"/> {{ $t('gotIt') }}</mk-button>
|
||||
</div>
|
||||
</section>
|
||||
</mk-pagination>
|
||||
@@ -47,8 +47,12 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
methods: {
|
||||
read(announcement) {
|
||||
announcement.isRead = true;
|
||||
// TODO: これは実質的に親コンポーネントから子コンポーネントのプロパティを変更してるのでなんとかしたい
|
||||
read(items, announcement, i) {
|
||||
Vue.set(items, i, {
|
||||
...announcement,
|
||||
isRead: true,
|
||||
});
|
||||
this.$root.api('i/read-announcement', { announcementId: announcement.id });
|
||||
},
|
||||
}
|
||||
|
@@ -151,7 +151,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
onKeypress(e) {
|
||||
if ((e.which == 10 || e.which == 13) && e.ctrlKey && this.canSend) {
|
||||
if ((e.which == 10 || e.which == 13) && (e.ctrlKey || e.metaKey) && this.canSend) {
|
||||
this.send();
|
||||
}
|
||||
},
|
||||
|
@@ -55,16 +55,16 @@ export default defineComponent({
|
||||
},
|
||||
computed: {
|
||||
isMe(): boolean {
|
||||
return this.message.userId == this.$store.state.i.id;
|
||||
return this.message.userId === this.$store.state.i.id;
|
||||
},
|
||||
urls(): string[] {
|
||||
if (this.message.text) {
|
||||
const ast = parse(this.message.text);
|
||||
return unique(ast
|
||||
.filter(t => ((t.node.type == 'url' || t.node.type == 'link') && t.node.props.url && !t.node.props.silent))
|
||||
.filter(t => ((t.node.type === 'url' || t.node.type === 'link') && t.node.props.url && !t.node.props.silent))
|
||||
.map(t => t.node.props.url));
|
||||
} else {
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -221,14 +221,20 @@ export default defineComponent({
|
||||
for (const id of x) {
|
||||
if (this.messages.some(x => x.id == id)) {
|
||||
const exist = this.messages.map(x => x.id).indexOf(id);
|
||||
this.messages[exist].isRead = true;
|
||||
this.messages[exist] = {
|
||||
...this.messages[exist],
|
||||
isRead: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
} else if (this.group) {
|
||||
for (const id of x.ids) {
|
||||
if (this.messages.some(x => x.id == id)) {
|
||||
const exist = this.messages.map(x => x.id).indexOf(id);
|
||||
this.messages[exist].reads.push(x.userId);
|
||||
this.messages[exist] = {
|
||||
...this.messages[exist],
|
||||
reads: [...this.messages[exist].reads, x.userId]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,12 @@
|
||||
<template #desc><button class="_textButton" @click="addItem">{{ $t('addItem') }}</button></template>
|
||||
</mk-textarea>
|
||||
</div>
|
||||
<div class="_content">
|
||||
<div>{{ $t('display') }}</div>
|
||||
<mk-radio v-model="sidebarDisplay" value="full">{{ $t('_sidebar.full') }}</mk-radio>
|
||||
<mk-radio v-model="sidebarDisplay" value="icon">{{ $t('_sidebar.icon') }}</mk-radio>
|
||||
<!-- <mk-radio v-model="sidebarDisplay" value="hide" disabled>{{ $t('_sidebar.hide') }}</mk-radio>--> <!-- TODO: サイドバーを完全に隠せるようにすると、別途ハンバーガーボタンのようなものをUIに表示する必要があり面倒 -->
|
||||
</div>
|
||||
<div class="_footer">
|
||||
<mk-button inline @click="save()" primary><fa :icon="faSave"/> {{ $t('save') }}</mk-button>
|
||||
<mk-button inline @click="reset()"><fa :icon="faRedo"/> {{ $t('default') }}</mk-button>
|
||||
@@ -19,12 +25,14 @@ import { defineComponent } from 'vue';
|
||||
import { faListUl, faSave, faRedo } from '@fortawesome/free-solid-svg-icons';
|
||||
import MkButton from '../../components/ui/button.vue';
|
||||
import MkTextarea from '../../components/ui/textarea.vue';
|
||||
import MkRadio from '../../components/ui/radio.vue';
|
||||
import { defaultDeviceUserSettings } from '../../store';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MkButton,
|
||||
MkTextarea,
|
||||
MkRadio,
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -38,7 +46,12 @@ export default defineComponent({
|
||||
computed: {
|
||||
splited(): string[] {
|
||||
return this.items.trim().split('\n').filter(x => x.trim() !== '');
|
||||
}
|
||||
},
|
||||
|
||||
sidebarDisplay: {
|
||||
get() { return this.$store.state.device.sidebarDisplay; },
|
||||
set(value) { this.$store.commit('device/set', { key: 'sidebarDisplay', value }); }
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
|
@@ -55,8 +55,8 @@
|
||||
<mk-textarea v-model="installThemeCode">
|
||||
<span>{{ $t('_theme.code') }}</span>
|
||||
</mk-textarea>
|
||||
<mk-button @click="() => install(this.installThemeCode)" :disabled="installThemeCode == null" primary inline><fa :icon="faCheck"/> {{ $t('install') }}</mk-button>
|
||||
<mk-button @click="() => preview(this.installThemeCode)" :disabled="installThemeCode == null" inline><fa :icon="faEye"/> {{ $t('preview') }}</mk-button>
|
||||
<mk-button @click="() => install(installThemeCode)" :disabled="installThemeCode == null" primary inline><fa :icon="faCheck"/> {{ $t('install') }}</mk-button>
|
||||
<mk-button @click="() => preview(installThemeCode)" :disabled="installThemeCode == null" inline><fa :icon="faEye"/> {{ $t('preview') }}</mk-button>
|
||||
</details>
|
||||
</div>
|
||||
<div class="_content">
|
||||
@@ -68,6 +68,7 @@
|
||||
<template v-if="selectedTheme">
|
||||
<mk-textarea readonly tall :value="selectedThemeCode">
|
||||
<span>{{ $t('_theme.code') }}</span>
|
||||
<template #desc><button @click="copyThemeCode()" class="_textButton">{{ $t('copy') }}</button></template>
|
||||
</mk-textarea>
|
||||
<mk-button @click="uninstall()" v-if="!builtinThemes.some(t => t.id == selectedTheme.id)"><fa :icon="faTrashAlt"/> {{ $t('uninstall') }}</mk-button>
|
||||
</template>
|
||||
@@ -80,7 +81,6 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { faPalette, faDownload, faFolderOpen, faCheck, faTrashAlt, faEye } from '@fortawesome/free-solid-svg-icons';
|
||||
import * as JSON5 from 'json5';
|
||||
import MkInput from '../../components/ui/input.vue';
|
||||
import MkButton from '../../components/ui/button.vue';
|
||||
import MkSelect from '../../components/ui/select.vue';
|
||||
import MkSwitch from '../../components/ui/switch.vue';
|
||||
@@ -88,10 +88,10 @@ import MkTextarea from '../../components/ui/textarea.vue';
|
||||
import { Theme, builtinThemes, applyTheme, validateTheme } from '../../scripts/theme';
|
||||
import { selectFile } from '../../scripts/select-file';
|
||||
import { isDeviceDarkmode } from '../../scripts/is-device-darkmode';
|
||||
import copyToClipboard from '../../scripts/copy-to-clipboard';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MkInput,
|
||||
MkButton,
|
||||
MkSelect,
|
||||
MkSwitch,
|
||||
@@ -192,6 +192,14 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
|
||||
copyThemeCode() {
|
||||
copyToClipboard(this.selectedThemeCode);
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
iconOnly: true, autoClose: true
|
||||
});
|
||||
},
|
||||
|
||||
parseThemeCode(code) {
|
||||
let theme;
|
||||
|
||||
@@ -247,7 +255,7 @@ export default defineComponent({
|
||||
key: 'themes', value: themes
|
||||
});
|
||||
this.$root.dialog({
|
||||
type: 'info',
|
||||
type: 'success',
|
||||
iconOnly: true, autoClose: true
|
||||
});
|
||||
},
|
||||
|
@@ -77,6 +77,7 @@ export const defaultDeviceSettings = {
|
||||
enableInfiniteScroll: true,
|
||||
fixedWidgetsPosition: false,
|
||||
useBlurEffectForModal: true,
|
||||
sidebarDisplay: 'full', // full, icon, hide
|
||||
roomGraphicsQuality: 'medium',
|
||||
roomUseOrthographicCamera: true,
|
||||
deckColumnAlign: 'left',
|
||||
|
@@ -3,6 +3,7 @@ import config from '../config';
|
||||
import { intersperse } from '../prelude/array';
|
||||
import { MfmForest, MfmTree } from './prelude';
|
||||
import { IMentionedRemoteUsers } from '../models/entities/note';
|
||||
import { wellKnownServices } from '../well-known-services';
|
||||
|
||||
export function toHtml(tokens: MfmForest | null, mentionedRemoteUsers: IMentionedRemoteUsers = []) {
|
||||
if (tokens == null) {
|
||||
@@ -126,18 +127,13 @@ export function toHtml(tokens: MfmForest | null, mentionedRemoteUsers: IMentione
|
||||
mention(token) {
|
||||
const a = doc.createElement('a');
|
||||
const { username, host, acct } = token.node.props;
|
||||
switch (host) {
|
||||
case 'github.com':
|
||||
a.href = `https://github.com/${username}`;
|
||||
break;
|
||||
case 'twitter.com':
|
||||
a.href = `https://twitter.com/${username}`;
|
||||
break;
|
||||
default:
|
||||
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host);
|
||||
a.href = remoteUserInfo ? (remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri) : `${config.url}/${acct}`;
|
||||
a.className = 'u-url mention';
|
||||
break;
|
||||
const wellKnown = wellKnownServices.find(x => x[0] === host);
|
||||
if (wellKnown) {
|
||||
a.href = wellKnown[1](username);
|
||||
} else {
|
||||
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host);
|
||||
a.href = remoteUserInfo ? (remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri) : `${config.url}/${acct}`;
|
||||
a.className = 'u-url mention';
|
||||
}
|
||||
a.textContent = acct;
|
||||
return a;
|
||||
|
@@ -56,11 +56,13 @@ export default define(meta, async (ps, user) => {
|
||||
sha256.update(accessToken + app.secret);
|
||||
const hash = sha256.digest('hex');
|
||||
|
||||
const now = new Date();
|
||||
|
||||
// Insert access token doc
|
||||
await AccessTokens.save({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
lastUsedAt: new Date(),
|
||||
createdAt: now,
|
||||
lastUsedAt: now,
|
||||
appId: session.appId,
|
||||
userId: user.id,
|
||||
token: accessToken,
|
||||
|
@@ -38,11 +38,13 @@ export default define(meta, async (ps, user) => {
|
||||
// Generate access token
|
||||
const accessToken = secureRndstr(32, true);
|
||||
|
||||
const now = new Date();
|
||||
|
||||
// Insert access token doc
|
||||
await AccessTokens.save({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
lastUsedAt: new Date(),
|
||||
createdAt: now,
|
||||
lastUsedAt: now,
|
||||
session: ps.session,
|
||||
userId: user.id,
|
||||
token: accessToken,
|
||||
|
4
src/well-known-services.ts
Normal file
4
src/well-known-services.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export const wellKnownServices = [
|
||||
['twitter.com', username => `https://twitter.com/${username}`],
|
||||
['github.com', username => `https://github.com/${username}`],
|
||||
] as [string, (username: string) => string][];
|
Reference in New Issue
Block a user