Merge branch 'develop'
This commit is contained in:
19
src/@types/deepcopy.d.ts
vendored
19
src/@types/deepcopy.d.ts
vendored
@ -1,19 +0,0 @@
|
||||
declare module 'deepcopy' {
|
||||
type DeepcopyCustomizerValueType = 'Object';
|
||||
|
||||
type DeepcopyCustomizer<T> = (
|
||||
value: T,
|
||||
valueType: DeepcopyCustomizerValueType) => T;
|
||||
|
||||
interface IDeepcopyOptions<T> {
|
||||
customizer: DeepcopyCustomizer<T>;
|
||||
}
|
||||
|
||||
function deepcopy<T>(
|
||||
value: T,
|
||||
options?: IDeepcopyOptions<T> | DeepcopyCustomizer<T>): T;
|
||||
|
||||
namespace deepcopy {} // Hack
|
||||
|
||||
export = deepcopy;
|
||||
}
|
7
src/@types/escape-regexp.d.ts
vendored
7
src/@types/escape-regexp.d.ts
vendored
@ -1,7 +0,0 @@
|
||||
declare module 'escape-regexp' {
|
||||
function escapeRegExp(str: string): string;
|
||||
|
||||
namespace escapeRegExp {} // Hack
|
||||
|
||||
export = escapeRegExp;
|
||||
}
|
65
src/@types/webfinger.js.d.ts
vendored
65
src/@types/webfinger.js.d.ts
vendored
@ -1,65 +0,0 @@
|
||||
declare module 'webfinger.js' {
|
||||
interface IWebFingerConstructorConfig {
|
||||
tls_only?: boolean;
|
||||
webfist_fallback?: boolean;
|
||||
uri_fallback?: boolean;
|
||||
request_timeout?: number;
|
||||
}
|
||||
|
||||
type JRDProperties = { [type: string]: string };
|
||||
|
||||
interface IJRDLink {
|
||||
rel: string;
|
||||
type?: string;
|
||||
href?: string;
|
||||
template?: string;
|
||||
titles?: { [lang: string]: string };
|
||||
properties?: JRDProperties;
|
||||
}
|
||||
|
||||
interface IJRD {
|
||||
subject?: string;
|
||||
expires?: Date;
|
||||
aliases?: string[];
|
||||
properties?: JRDProperties;
|
||||
links?: IJRDLink[];
|
||||
}
|
||||
|
||||
interface IIDXLinks {
|
||||
'avatar': IJRDLink[];
|
||||
'remotestorage': IJRDLink[];
|
||||
'blog': IJRDLink[];
|
||||
'vcard': IJRDLink[];
|
||||
'updates': IJRDLink[];
|
||||
'share': IJRDLink[];
|
||||
'profile': IJRDLink[];
|
||||
'webfist': IJRDLink[];
|
||||
'camlistore': IJRDLink[];
|
||||
[type: string]: IJRDLink[];
|
||||
}
|
||||
|
||||
interface IIDXProperties {
|
||||
'name': string;
|
||||
[type: string]: string;
|
||||
}
|
||||
|
||||
interface IIDX {
|
||||
links: IIDXLinks;
|
||||
properties: IIDXProperties;
|
||||
}
|
||||
|
||||
interface ILookupCallbackResult {
|
||||
object: IJRD;
|
||||
json: string;
|
||||
idx: IIDX;
|
||||
}
|
||||
|
||||
type LookupCallback = (err: Error | string, result?: ILookupCallbackResult) => void;
|
||||
|
||||
export class WebFinger {
|
||||
constructor(config?: IWebFingerConstructorConfig);
|
||||
|
||||
public lookup(address: string, cb: LookupCallback): NodeJS.Timeout;
|
||||
public lookupLink(address: string, rel: string, cb: IJRDLink): void;
|
||||
}
|
||||
}
|
@ -15,5 +15,8 @@ program
|
||||
.parse(process.argv);
|
||||
|
||||
if (process.env.MK_ONLY_QUEUE) program.onlyQueue = true;
|
||||
if (process.env.NODE_ENV === 'test') program.disableClustering = true;
|
||||
if (process.env.NODE_ENV === 'test') program.quiet = true;
|
||||
if (process.env.NODE_ENV === 'test') program.noDaemons = true;
|
||||
|
||||
export { program };
|
||||
|
77
src/boot/index.ts
Normal file
77
src/boot/index.ts
Normal file
@ -0,0 +1,77 @@
|
||||
import * as cluster from 'cluster';
|
||||
import chalk from 'chalk';
|
||||
import Xev from 'xev';
|
||||
|
||||
import Logger from '../services/logger';
|
||||
import { program } from '../argv';
|
||||
|
||||
// for typeorm
|
||||
import 'reflect-metadata';
|
||||
import { masterMain } from './master';
|
||||
import { workerMain } from './worker';
|
||||
|
||||
const logger = new Logger('core', 'cyan');
|
||||
const clusterLogger = logger.createSubLogger('cluster', 'orange', false);
|
||||
const ev = new Xev();
|
||||
|
||||
/**
|
||||
* Init process
|
||||
*/
|
||||
export default async function() {
|
||||
process.title = `Misskey (${cluster.isMaster ? 'master' : 'worker'})`;
|
||||
|
||||
if (cluster.isMaster || program.disableClustering) {
|
||||
await masterMain();
|
||||
|
||||
if (cluster.isMaster) {
|
||||
ev.mount();
|
||||
}
|
||||
}
|
||||
|
||||
if (cluster.isWorker || program.disableClustering) {
|
||||
await workerMain();
|
||||
}
|
||||
|
||||
// ユニットテスト時にMisskeyが子プロセスで起動された時のため
|
||||
// それ以外のときは process.send は使えないので弾く
|
||||
if (process.send) {
|
||||
process.send('ok');
|
||||
}
|
||||
}
|
||||
|
||||
//#region Events
|
||||
|
||||
// Listen new workers
|
||||
cluster.on('fork', worker => {
|
||||
clusterLogger.debug(`Process forked: [${worker.id}]`);
|
||||
});
|
||||
|
||||
// Listen online workers
|
||||
cluster.on('online', worker => {
|
||||
clusterLogger.debug(`Process is now online: [${worker.id}]`);
|
||||
});
|
||||
|
||||
// Listen for dying workers
|
||||
cluster.on('exit', worker => {
|
||||
// Replace the dead worker,
|
||||
// we're not sentimental
|
||||
clusterLogger.error(chalk.red(`[${worker.id}] died :(`));
|
||||
cluster.fork();
|
||||
});
|
||||
|
||||
// Display detail of unhandled promise rejection
|
||||
if (!program.quiet) {
|
||||
process.on('unhandledRejection', console.dir);
|
||||
}
|
||||
|
||||
// Display detail of uncaught exception
|
||||
process.on('uncaughtException', err => {
|
||||
logger.error(err);
|
||||
});
|
||||
|
||||
// Dying away...
|
||||
process.on('exit', code => {
|
||||
logger.info(`The process is going to exit with code ${code}`);
|
||||
});
|
||||
|
||||
//#endregion
|
176
src/boot/master.ts
Normal file
176
src/boot/master.ts
Normal file
@ -0,0 +1,176 @@
|
||||
import * as os from 'os';
|
||||
import * as cluster from 'cluster';
|
||||
import chalk from 'chalk';
|
||||
import * as portscanner from 'portscanner';
|
||||
import * as isRoot from 'is-root';
|
||||
|
||||
import Logger from '../services/logger';
|
||||
import loadConfig from '../config/load';
|
||||
import { Config } from '../config/types';
|
||||
import { lessThan } from '../prelude/array';
|
||||
import * as pkg from '../../package.json';
|
||||
import { program } from '../argv';
|
||||
import { showMachineInfo } from '../misc/show-machine-info';
|
||||
import { initDb } from '../db/postgre';
|
||||
|
||||
const logger = new Logger('core', 'cyan');
|
||||
const bootLogger = logger.createSubLogger('boot', 'magenta', false);
|
||||
|
||||
function greet() {
|
||||
if (!program.quiet) {
|
||||
//#region Misskey logo
|
||||
const v = `v${pkg.version}`;
|
||||
console.log(' _____ _ _ ');
|
||||
console.log(' | |_|___ ___| |_ ___ _ _ ');
|
||||
console.log(' | | | | |_ -|_ -| \'_| -_| | |');
|
||||
console.log(' |_|_|_|_|___|___|_,_|___|_ |');
|
||||
console.log(' ' + chalk.gray(v) + (' |___|\n'.substr(v.length)));
|
||||
//#endregion
|
||||
|
||||
console.log(' Misskey is maintained by @syuilo, @AyaMorisawa, @mei23, and @acid-chicken.');
|
||||
console.log(chalk.keyword('orange')(' If you like Misskey, please donate to support development. https://www.patreon.com/syuilo'));
|
||||
|
||||
console.log('');
|
||||
console.log(chalk`< ${os.hostname()} {gray (PID: ${process.pid.toString()})} >`);
|
||||
}
|
||||
|
||||
bootLogger.info('Welcome to Misskey!');
|
||||
bootLogger.info(`Misskey v${pkg.version}`, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init master process
|
||||
*/
|
||||
export async function masterMain() {
|
||||
greet();
|
||||
|
||||
let config!: Config;
|
||||
|
||||
try {
|
||||
// initialize app
|
||||
config = await init();
|
||||
|
||||
if (config.port == null) {
|
||||
bootLogger.error('The port is not configured. Please configure port.', null, true);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (process.platform === 'linux' && isWellKnownPort(config.port) && !isRoot()) {
|
||||
bootLogger.error('You need root privileges to listen on well-known port on Linux', null, true);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!await isPortAvailable(config.port)) {
|
||||
bootLogger.error(`Port ${config.port} is already in use`, null, true);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (e) {
|
||||
bootLogger.error('Fatal error occurred during initialization', null, true);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
bootLogger.succ('Misskey initialized');
|
||||
|
||||
if (!program.disableClustering) {
|
||||
await spawnWorkers(config.clusterLimit);
|
||||
}
|
||||
|
||||
if (!program.noDaemons) {
|
||||
require('../daemons/server-stats').default();
|
||||
require('../daemons/notes-stats').default();
|
||||
require('../daemons/queue-stats').default();
|
||||
}
|
||||
|
||||
bootLogger.succ(`Now listening on port ${config.port} on ${config.url}`, null, true);
|
||||
}
|
||||
|
||||
const runningNodejsVersion = process.version.slice(1).split('.').map(x => parseInt(x, 10));
|
||||
const requiredNodejsVersion = [11, 7, 0];
|
||||
const satisfyNodejsVersion = !lessThan(runningNodejsVersion, requiredNodejsVersion);
|
||||
|
||||
function isWellKnownPort(port: number): boolean {
|
||||
return port < 1024;
|
||||
}
|
||||
|
||||
async function isPortAvailable(port: number): Promise<boolean> {
|
||||
return await portscanner.checkPortStatus(port, '127.0.0.1') === 'closed';
|
||||
}
|
||||
|
||||
function showEnvironment(): void {
|
||||
const env = process.env.NODE_ENV;
|
||||
const logger = bootLogger.createSubLogger('env');
|
||||
logger.info(typeof env == 'undefined' ? 'NODE_ENV is not set' : `NODE_ENV: ${env}`);
|
||||
|
||||
if (env !== 'production') {
|
||||
logger.warn('The environment is not in production mode.');
|
||||
logger.warn('DO NOT USE FOR PRODUCTION PURPOSE!', null, true);
|
||||
}
|
||||
|
||||
logger.info(`You ${isRoot() ? '' : 'do not '}have root privileges`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init app
|
||||
*/
|
||||
async function init(): Promise<Config> {
|
||||
showEnvironment();
|
||||
|
||||
const nodejsLogger = bootLogger.createSubLogger('nodejs');
|
||||
|
||||
nodejsLogger.info(`Version ${runningNodejsVersion.join('.')}`);
|
||||
|
||||
if (!satisfyNodejsVersion) {
|
||||
nodejsLogger.error(`Node.js version is less than ${requiredNodejsVersion.join('.')}. Please upgrade it.`, null, true);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await showMachineInfo(bootLogger);
|
||||
|
||||
const configLogger = bootLogger.createSubLogger('config');
|
||||
let config;
|
||||
|
||||
try {
|
||||
config = loadConfig();
|
||||
} catch (exception) {
|
||||
if (typeof exception === 'string') {
|
||||
configLogger.error(exception);
|
||||
process.exit(1);
|
||||
}
|
||||
if (exception.code === 'ENOENT') {
|
||||
configLogger.error('Configuration file not found', null, true);
|
||||
process.exit(1);
|
||||
}
|
||||
throw exception;
|
||||
}
|
||||
|
||||
configLogger.succ('Loaded');
|
||||
|
||||
// Try to connect to DB
|
||||
try {
|
||||
bootLogger.info('Connecting database...');
|
||||
await initDb();
|
||||
} catch (e) {
|
||||
bootLogger.error('Cannot connect to database', null, true);
|
||||
bootLogger.error(e);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
async function spawnWorkers(limit: number = Infinity) {
|
||||
const workers = Math.min(limit, os.cpus().length);
|
||||
bootLogger.info(`Starting ${workers} worker${workers === 1 ? '' : 's'}...`);
|
||||
await Promise.all([...Array(workers)].map(spawnWorker));
|
||||
bootLogger.succ('All workers started');
|
||||
}
|
||||
|
||||
function spawnWorker(): Promise<void> {
|
||||
return new Promise(res => {
|
||||
const worker = cluster.fork();
|
||||
worker.on('message', message => {
|
||||
if (message !== 'ready') return;
|
||||
res();
|
||||
});
|
||||
});
|
||||
}
|
20
src/boot/worker.ts
Normal file
20
src/boot/worker.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import * as cluster from 'cluster';
|
||||
import { initDb } from '../db/postgre';
|
||||
|
||||
/**
|
||||
* Init worker process
|
||||
*/
|
||||
export async function workerMain() {
|
||||
await initDb();
|
||||
|
||||
// start server
|
||||
await require('../server').default();
|
||||
|
||||
// start job queue
|
||||
require('../queue').default();
|
||||
|
||||
if (cluster.isWorker) {
|
||||
// Send a 'ready' message to parent process
|
||||
process.send!('ready');
|
||||
}
|
||||
}
|
@ -38,7 +38,7 @@
|
||||
<div class="kidvdlkg" v-for="file in files">
|
||||
<div @click="file._open = !file._open">
|
||||
<div>
|
||||
<div class="thumbnail" :style="thumbnail(file)"></div>
|
||||
<x-file-thumbnail class="thumbnail" :file="file" fit="contain" @click="showFileMenu(file)"/>
|
||||
</div>
|
||||
<div>
|
||||
<header>
|
||||
@ -48,7 +48,7 @@
|
||||
<div>
|
||||
<div>
|
||||
<span style="margin-right:16px;">{{ file.type }}</span>
|
||||
<span>{{ file.datasize | bytes }}</span>
|
||||
<span>{{ file.size | bytes }}</span>
|
||||
</div>
|
||||
<div><mk-time :time="file.createdAt" mode="detail"/></div>
|
||||
</div>
|
||||
@ -75,10 +75,15 @@ import Vue from 'vue';
|
||||
import i18n from '../../i18n';
|
||||
import { faCloud, faTerminal, faSearch } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faTrashAlt, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons';
|
||||
import XFileThumbnail from '../../common/views/components/drive-file-thumbnail.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('admin/views/drive.vue'),
|
||||
|
||||
components: {
|
||||
XFileThumbnail
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
file: null,
|
||||
@ -151,13 +156,6 @@ export default Vue.extend({
|
||||
});
|
||||
},
|
||||
|
||||
thumbnail(file: any): any {
|
||||
return {
|
||||
'background-color': file.properties.avgColor && file.properties.avgColor.length == 3 ? `rgb(${file.properties.avgColor.join(',')})` : 'transparent',
|
||||
'background-image': `url(${file.thumbnailUrl})`
|
||||
};
|
||||
},
|
||||
|
||||
async del(file: any) {
|
||||
const process = async () => {
|
||||
await this.$root.api('drive/files/delete', { fileId: file.id });
|
||||
@ -179,9 +177,9 @@ export default Vue.extend({
|
||||
this.$root.api('drive/files/update', {
|
||||
fileId: file.id,
|
||||
isSensitive: !file.isSensitive
|
||||
}).then(() => {
|
||||
file.isSensitive = !file.isSensitive;
|
||||
});
|
||||
|
||||
file.isSensitive = !file.isSensitive;
|
||||
},
|
||||
|
||||
async show() {
|
||||
|
@ -3,7 +3,7 @@
|
||||
<ui-card>
|
||||
<template #title>{{ $t('hided-tags') }}</template>
|
||||
<section>
|
||||
<textarea class="jdnqwkzlnxcfftthoybjxrebyolvoucw" v-model="hidedTags"></textarea>
|
||||
<textarea class="jdnqwkzlnxcfftthoybjxrebyolvoucw" v-model="hiddenTags"></textarea>
|
||||
<ui-button @click="save">{{ $t('save') }}</ui-button>
|
||||
</section>
|
||||
</ui-card>
|
||||
@ -18,18 +18,18 @@ export default Vue.extend({
|
||||
i18n: i18n('admin/views/hashtags.vue'),
|
||||
data() {
|
||||
return {
|
||||
hidedTags: '',
|
||||
hiddenTags: '',
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.hidedTags = meta.hidedTags.join('\n');
|
||||
this.hiddenTags = meta.hiddenTags.join('\n');
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
this.$root.api('admin/update-meta', {
|
||||
hidedTags: this.hidedTags.split('\n')
|
||||
hiddenTags: this.hiddenTags.split('\n')
|
||||
}).then(() => {
|
||||
//this.$root.os.apis.dialog({ text: `Saved` });
|
||||
}).catch(e => {
|
||||
|
@ -77,12 +77,6 @@
|
||||
<header>summaly Proxy</header>
|
||||
<ui-input v-model="summalyProxy">URL</ui-input>
|
||||
</section>
|
||||
<section>
|
||||
<header><fa :icon="faUserPlus"/> {{ $t('user-recommendation-config') }}</header>
|
||||
<ui-switch v-model="enableExternalUserRecommendation">{{ $t('enable-external-user-recommendation') }}</ui-switch>
|
||||
<ui-input v-model="externalUserRecommendationEngine" :disabled="!enableExternalUserRecommendation">{{ $t('external-user-recommendation-engine') }}<template #desc>{{ $t('external-user-recommendation-engine-desc') }}</template></ui-input>
|
||||
<ui-input v-model="externalUserRecommendationTimeout" type="number" :disabled="!enableExternalUserRecommendation">{{ $t('external-user-recommendation-timeout') }}<template #suffix>ms</template><template #desc>{{ $t('external-user-recommendation-timeout-desc') }}</template></ui-input>
|
||||
</section>
|
||||
<section>
|
||||
<ui-button @click="updateMeta">{{ $t('save') }}</ui-button>
|
||||
</section>
|
||||
@ -184,9 +178,6 @@ export default Vue.extend({
|
||||
discordClientSecret: null,
|
||||
proxyAccount: null,
|
||||
inviteCode: null,
|
||||
enableExternalUserRecommendation: false,
|
||||
externalUserRecommendationEngine: null,
|
||||
externalUserRecommendationTimeout: null,
|
||||
summalyProxy: null,
|
||||
enableEmail: false,
|
||||
email: null,
|
||||
@ -205,8 +196,8 @@ export default Vue.extend({
|
||||
|
||||
created() {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.maintainerName = meta.maintainer.name;
|
||||
this.maintainerEmail = meta.maintainer.email;
|
||||
this.maintainerName = meta.maintainerName;
|
||||
this.maintainerEmail = meta.maintainerEmail;
|
||||
this.disableRegistration = meta.disableRegistration;
|
||||
this.disableLocalTimeline = meta.disableLocalTimeline;
|
||||
this.disableGlobalTimeline = meta.disableGlobalTimeline;
|
||||
@ -236,9 +227,6 @@ export default Vue.extend({
|
||||
this.enableDiscordIntegration = meta.enableDiscordIntegration;
|
||||
this.discordClientId = meta.discordClientId;
|
||||
this.discordClientSecret = meta.discordClientSecret;
|
||||
this.enableExternalUserRecommendation = meta.enableExternalUserRecommendation;
|
||||
this.externalUserRecommendationEngine = meta.externalUserRecommendationEngine;
|
||||
this.externalUserRecommendationTimeout = meta.externalUserRecommendationTimeout;
|
||||
this.summalyProxy = meta.summalyProxy;
|
||||
this.enableEmail = meta.enableEmail;
|
||||
this.email = meta.email;
|
||||
@ -299,9 +287,6 @@ export default Vue.extend({
|
||||
enableDiscordIntegration: this.enableDiscordIntegration,
|
||||
discordClientId: this.discordClientId,
|
||||
discordClientSecret: this.discordClientSecret,
|
||||
enableExternalUserRecommendation: this.enableExternalUserRecommendation,
|
||||
externalUserRecommendationEngine: this.externalUserRecommendationEngine,
|
||||
externalUserRecommendationTimeout: parseInt(this.externalUserRecommendationTimeout, 10),
|
||||
summalyProxy: this.summalyProxy,
|
||||
enableEmail: this.enableEmail,
|
||||
email: this.email,
|
||||
|
@ -19,7 +19,7 @@
|
||||
</ui-horizon-group>
|
||||
|
||||
<div class="nqjzuvev">
|
||||
<code v-for="log in logs" :key="log._id" :class="log.level">
|
||||
<code v-for="log in logs" :key="log.id" :class="log.level">
|
||||
<details>
|
||||
<summary><mk-time :time="log.createdAt"/> [{{ log.domain.join('.') }}] {{ log.message }}</summary>
|
||||
<vue-json-pretty v-if="log.data" :data="log.data"></vue-json-pretty>
|
||||
|
@ -165,7 +165,7 @@ export default Vue.extend({
|
||||
|
||||
/** 処理対象ユーザーの情報を更新する */
|
||||
async refreshUser() {
|
||||
this.$root.api('admin/show-user', { userId: this.user._id }).then(info => {
|
||||
this.$root.api('admin/show-user', { userId: this.user.id }).then(info => {
|
||||
this.user = info;
|
||||
});
|
||||
},
|
||||
@ -173,7 +173,7 @@ export default Vue.extend({
|
||||
async resetPassword() {
|
||||
if (!await this.getConfirmed(this.$t('reset-password-confirm'))) return;
|
||||
|
||||
this.$root.api('admin/reset-password', { userId: this.user._id }).then(res => {
|
||||
this.$root.api('admin/reset-password', { userId: this.user.id }).then(res => {
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
text: this.$t('password-updated', { password: res.password })
|
||||
@ -187,7 +187,7 @@ export default Vue.extend({
|
||||
this.verifying = true;
|
||||
|
||||
const process = async () => {
|
||||
await this.$root.api('admin/verify-user', { userId: this.user._id });
|
||||
await this.$root.api('admin/verify-user', { userId: this.user.id });
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
text: this.$t('verified')
|
||||
@ -212,7 +212,7 @@ export default Vue.extend({
|
||||
this.unverifying = true;
|
||||
|
||||
const process = async () => {
|
||||
await this.$root.api('admin/unverify-user', { userId: this.user._id });
|
||||
await this.$root.api('admin/unverify-user', { userId: this.user.id });
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
text: this.$t('unverified')
|
||||
@ -233,7 +233,7 @@ export default Vue.extend({
|
||||
|
||||
async silenceUser() {
|
||||
const process = async () => {
|
||||
await this.$root.api('admin/silence-user', { userId: this.user._id });
|
||||
await this.$root.api('admin/silence-user', { userId: this.user.id });
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
splash: true
|
||||
@ -252,7 +252,7 @@ export default Vue.extend({
|
||||
|
||||
async unsilenceUser() {
|
||||
const process = async () => {
|
||||
await this.$root.api('admin/unsilence-user', { userId: this.user._id });
|
||||
await this.$root.api('admin/unsilence-user', { userId: this.user.id });
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
splash: true
|
||||
@ -275,7 +275,7 @@ export default Vue.extend({
|
||||
this.suspending = true;
|
||||
|
||||
const process = async () => {
|
||||
await this.$root.api('admin/suspend-user', { userId: this.user._id });
|
||||
await this.$root.api('admin/suspend-user', { userId: this.user.id });
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
text: this.$t('suspended')
|
||||
@ -300,7 +300,7 @@ export default Vue.extend({
|
||||
this.unsuspending = true;
|
||||
|
||||
const process = async () => {
|
||||
await this.$root.api('admin/unsuspend-user', { userId: this.user._id });
|
||||
await this.$root.api('admin/unsuspend-user', { userId: this.user.id });
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
text: this.$t('unsuspended')
|
||||
@ -320,7 +320,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
async updateRemoteUser() {
|
||||
this.$root.api('admin/update-remote-user', { userId: this.user._id }).then(res => {
|
||||
this.$root.api('admin/update-remote-user', { userId: this.user.id }).then(res => {
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
text: this.$t('remote-user-updated')
|
||||
|
@ -14,15 +14,7 @@
|
||||
<h2>{{ $t('permission-ask') }}</h2>
|
||||
<ul>
|
||||
<template v-for="p in app.permission">
|
||||
<li v-if="p == 'account-read'">{{ $t('account-read') }}</li>
|
||||
<li v-if="p == 'account-write'">{{ $t('account-write') }}</li>
|
||||
<li v-if="p == 'note-write'">{{ $t('note-write') }}</li>
|
||||
<li v-if="p == 'like-write'">{{ $t('like-write') }}</li>
|
||||
<li v-if="p == 'following-write'">{{ $t('following-write') }}</li>
|
||||
<li v-if="p == 'drive-read'">{{ $t('drive-read') }}</li>
|
||||
<li v-if="p == 'drive-write'">{{ $t('drive-write') }}</li>
|
||||
<li v-if="p == 'notification-read'">{{ $t('notification-read') }}</li>
|
||||
<li v-if="p == 'notification-write'">{{ $t('notification-write') }}</li>
|
||||
<li :key="p">{{ $t(`@.permissions.${p}`) }}</li>
|
||||
</template>
|
||||
</ul>
|
||||
</section>
|
||||
|
@ -45,15 +45,9 @@ export default function <T extends object>(data: {
|
||||
this.$watch('props', () => {
|
||||
this.mergeProps();
|
||||
});
|
||||
|
||||
this.bakeProps();
|
||||
},
|
||||
|
||||
methods: {
|
||||
bakeProps() {
|
||||
this.bakedOldProps = JSON.stringify(this.props);
|
||||
},
|
||||
|
||||
mergeProps() {
|
||||
if (data.props) {
|
||||
const defaultProps = data.props();
|
||||
@ -65,17 +59,10 @@ export default function <T extends object>(data: {
|
||||
},
|
||||
|
||||
save() {
|
||||
if (this.bakedOldProps == JSON.stringify(this.props)) return;
|
||||
|
||||
this.bakeProps();
|
||||
|
||||
if (this.platform == 'deck') {
|
||||
this.$store.commit('device/updateDeckColumn', this.column);
|
||||
} else {
|
||||
this.$root.api('i/update_widget', {
|
||||
id: this.id,
|
||||
data: this.props
|
||||
});
|
||||
this.$store.commit('device/updateWidget', this.widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ export default (opts: Opts = {}) => ({
|
||||
},
|
||||
|
||||
reactionsCount(): number {
|
||||
return this.appearNote.reactionCounts
|
||||
? sum(Object.values(this.appearNote.reactionCounts))
|
||||
return this.appearNote.reactions
|
||||
? sum(Object.values(this.appearNote.reactions))
|
||||
: 0;
|
||||
},
|
||||
|
||||
|
@ -87,16 +87,16 @@ export default prop => ({
|
||||
case 'reacted': {
|
||||
const reaction = body.reaction;
|
||||
|
||||
if (this.$_ns_target.reactionCounts == null) {
|
||||
Vue.set(this.$_ns_target, 'reactionCounts', {});
|
||||
if (this.$_ns_target.reactions == null) {
|
||||
Vue.set(this.$_ns_target, 'reactions', {});
|
||||
}
|
||||
|
||||
if (this.$_ns_target.reactionCounts[reaction] == null) {
|
||||
Vue.set(this.$_ns_target.reactionCounts, reaction, 0);
|
||||
if (this.$_ns_target.reactions[reaction] == null) {
|
||||
Vue.set(this.$_ns_target.reactions, reaction, 0);
|
||||
}
|
||||
|
||||
// Increment the count
|
||||
this.$_ns_target.reactionCounts[reaction]++;
|
||||
this.$_ns_target.reactions[reaction]++;
|
||||
|
||||
if (body.userId == this.$store.state.i.id) {
|
||||
Vue.set(this.$_ns_target, 'myReaction', reaction);
|
||||
@ -107,16 +107,16 @@ export default prop => ({
|
||||
case 'unreacted': {
|
||||
const reaction = body.reaction;
|
||||
|
||||
if (this.$_ns_target.reactionCounts == null) {
|
||||
if (this.$_ns_target.reactions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.$_ns_target.reactionCounts[reaction] == null) {
|
||||
if (this.$_ns_target.reactions[reaction] == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Decrement the count
|
||||
if (this.$_ns_target.reactionCounts[reaction] > 0) this.$_ns_target.reactionCounts[reaction]--;
|
||||
if (this.$_ns_target.reactions[reaction] > 0) this.$_ns_target.reactions[reaction]--;
|
||||
|
||||
if (body.userId == this.$store.state.i.id) {
|
||||
Vue.set(this.$_ns_target, 'myReaction', null);
|
||||
@ -125,9 +125,11 @@ export default prop => ({
|
||||
}
|
||||
|
||||
case 'pollVoted': {
|
||||
if (body.userId == this.$store.state.i.id) return;
|
||||
const choice = body.choice;
|
||||
this.$_ns_target.poll.choices.find(c => c.id === choice).votes++;
|
||||
this.$_ns_target.poll.choices[choice].votes++;
|
||||
if (body.userId == this.$store.state.i.id) {
|
||||
Vue.set(this.$_ns_target.poll.choices[choice], 'isVoted', true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,7 @@ export default Vue.extend({
|
||||
},
|
||||
icon(): any {
|
||||
return {
|
||||
backgroundColor: this.lightmode
|
||||
? `rgb(${this.user.avatarColor.slice(0, 3).join(',')})`
|
||||
: this.user.avatarColor && this.user.avatarColor.length == 3
|
||||
? `rgb(${this.user.avatarColor.join(',')})`
|
||||
: null,
|
||||
backgroundColor: this.user.avatarColor,
|
||||
backgroundImage: this.lightmode ? null : `url(${this.url})`,
|
||||
borderRadius: this.$store.state.settings.circleIcons ? '100%' : null
|
||||
};
|
||||
@ -67,7 +63,7 @@ export default Vue.extend({
|
||||
},
|
||||
mounted() {
|
||||
if (this.user.avatarColor) {
|
||||
this.$el.style.color = `rgb(${this.user.avatarColor.slice(0, 3).join(',')})`;
|
||||
this.$el.style.color = this.user.avatarColor;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -105,15 +105,11 @@ export default Vue.extend({
|
||||
},
|
||||
isThumbnailAvailable(): boolean {
|
||||
return this.file.thumbnailUrl
|
||||
? this.file.thumbnailUrl.endsWith('?thumbnail')
|
||||
? (this.is === 'image' || this.is === 'video')
|
||||
: true
|
||||
? (this.is === 'image' || this.is === 'video')
|
||||
: false;
|
||||
},
|
||||
background(): string {
|
||||
return this.file.properties.avgColor && this.file.properties.avgColor.length == 3
|
||||
? `rgb(${this.file.properties.avgColor.join(',')})`
|
||||
: 'transparent';
|
||||
return this.file.properties.avgColor || 'transparent';
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -122,10 +118,10 @@ export default Vue.extend({
|
||||
},
|
||||
methods: {
|
||||
onThumbnailLoaded() {
|
||||
if (this.file.properties.avgColor && this.file.properties.avgColor.length == 3) {
|
||||
if (this.file.properties.avgColor) {
|
||||
anime({
|
||||
targets: this.$refs.thumbnail,
|
||||
backgroundColor: `rgba(${this.file.properties.avgColor.join(',')}, 0)`,
|
||||
backgroundColor: this.file.properties.avgColor.replace('255)', '0)'),
|
||||
duration: 100,
|
||||
easing: 'linear'
|
||||
});
|
||||
|
@ -24,11 +24,11 @@
|
||||
|
||||
<div class="board">
|
||||
<div class="labels-x" v-if="this.$store.state.settings.games.reversi.showBoardLabels">
|
||||
<span v-for="i in game.settings.map[0].length">{{ String.fromCharCode(64 + i) }}</span>
|
||||
<span v-for="i in game.map[0].length">{{ String.fromCharCode(64 + i) }}</span>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="labels-y" v-if="this.$store.state.settings.games.reversi.showBoardLabels">
|
||||
<div v-for="i in game.settings.map.length">{{ i }}</div>
|
||||
<div v-for="i in game.map.length">{{ i }}</div>
|
||||
</div>
|
||||
<div class="cells" :style="cellsStyle">
|
||||
<div v-for="(stone, i) in o.board"
|
||||
@ -46,11 +46,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="labels-y" v-if="this.$store.state.settings.games.reversi.showBoardLabels">
|
||||
<div v-for="i in game.settings.map.length">{{ i }}</div>
|
||||
<div v-for="i in game.map.length">{{ i }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="labels-x" v-if="this.$store.state.settings.games.reversi.showBoardLabels">
|
||||
<span v-for="i in game.settings.map[0].length">{{ String.fromCharCode(64 + i) }}</span>
|
||||
<span v-for="i in game.map[0].length">{{ String.fromCharCode(64 + i) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -71,9 +71,9 @@
|
||||
</div>
|
||||
|
||||
<div class="info">
|
||||
<p v-if="game.settings.isLlotheo">{{ $t('is-llotheo') }}</p>
|
||||
<p v-if="game.settings.loopedBoard">{{ $t('looped-map') }}</p>
|
||||
<p v-if="game.settings.canPutEverywhere">{{ $t('can-put-everywhere') }}</p>
|
||||
<p v-if="game.isLlotheo">{{ $t('is-llotheo') }}</p>
|
||||
<p v-if="game.loopedBoard">{{ $t('looped-map') }}</p>
|
||||
<p v-if="game.canPutEverywhere">{{ $t('can-put-everywhere') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -160,8 +160,8 @@ export default Vue.extend({
|
||||
|
||||
cellsStyle(): any {
|
||||
return {
|
||||
'grid-template-rows': `repeat(${this.game.settings.map.length}, 1fr)`,
|
||||
'grid-template-columns': `repeat(${this.game.settings.map[0].length}, 1fr)`
|
||||
'grid-template-rows': `repeat(${this.game.map.length}, 1fr)`,
|
||||
'grid-template-columns': `repeat(${this.game.map[0].length}, 1fr)`
|
||||
};
|
||||
}
|
||||
},
|
||||
@ -169,10 +169,10 @@ export default Vue.extend({
|
||||
watch: {
|
||||
logPos(v) {
|
||||
if (!this.game.isEnded) return;
|
||||
this.o = new Reversi(this.game.settings.map, {
|
||||
isLlotheo: this.game.settings.isLlotheo,
|
||||
canPutEverywhere: this.game.settings.canPutEverywhere,
|
||||
loopedBoard: this.game.settings.loopedBoard
|
||||
this.o = new Reversi(this.game.map, {
|
||||
isLlotheo: this.game.isLlotheo,
|
||||
canPutEverywhere: this.game.canPutEverywhere,
|
||||
loopedBoard: this.game.loopedBoard
|
||||
});
|
||||
for (const log of this.logs.slice(0, v)) {
|
||||
this.o.put(log.color, log.pos);
|
||||
@ -184,10 +184,10 @@ export default Vue.extend({
|
||||
created() {
|
||||
this.game = this.initGame;
|
||||
|
||||
this.o = new Reversi(this.game.settings.map, {
|
||||
isLlotheo: this.game.settings.isLlotheo,
|
||||
canPutEverywhere: this.game.settings.canPutEverywhere,
|
||||
loopedBoard: this.game.settings.loopedBoard
|
||||
this.o = new Reversi(this.game.map, {
|
||||
isLlotheo: this.game.isLlotheo,
|
||||
canPutEverywhere: this.game.canPutEverywhere,
|
||||
loopedBoard: this.game.loopedBoard
|
||||
});
|
||||
|
||||
for (const log of this.game.logs) {
|
||||
@ -286,10 +286,10 @@ export default Vue.extend({
|
||||
onRescue(game) {
|
||||
this.game = game;
|
||||
|
||||
this.o = new Reversi(this.game.settings.map, {
|
||||
isLlotheo: this.game.settings.isLlotheo,
|
||||
canPutEverywhere: this.game.settings.canPutEverywhere,
|
||||
loopedBoard: this.game.settings.loopedBoard
|
||||
this.o = new Reversi(this.game.map, {
|
||||
isLlotheo: this.game.isLlotheo,
|
||||
canPutEverywhere: this.game.canPutEverywhere,
|
||||
loopedBoard: this.game.loopedBoard
|
||||
});
|
||||
|
||||
for (const log of this.game.logs) {
|
||||
|
@ -17,9 +17,9 @@
|
||||
</header>
|
||||
|
||||
<div>
|
||||
<div class="random" v-if="game.settings.map == null"><fa icon="dice"/></div>
|
||||
<div class="board" v-else :style="{ 'grid-template-rows': `repeat(${ game.settings.map.length }, 1fr)`, 'grid-template-columns': `repeat(${ game.settings.map[0].length }, 1fr)` }">
|
||||
<div v-for="(x, i) in game.settings.map.join('')"
|
||||
<div class="random" v-if="game.map == null"><fa icon="dice"/></div>
|
||||
<div class="board" v-else :style="{ 'grid-template-rows': `repeat(${ game.map.length }, 1fr)`, 'grid-template-columns': `repeat(${ game.map[0].length }, 1fr)` }">
|
||||
<div v-for="(x, i) in game.map.join('')"
|
||||
:data-none="x == ' '"
|
||||
@click="onPixelClick(i, x)">
|
||||
<fa v-if="x == 'b'" :icon="fasCircle"/>
|
||||
@ -35,9 +35,9 @@
|
||||
</header>
|
||||
|
||||
<div>
|
||||
<form-radio v-model="game.settings.bw" value="random" @change="updateSettings">{{ $t('random') }}</form-radio>
|
||||
<form-radio v-model="game.settings.bw" :value="1" @change="updateSettings">{{ this.$t('black-is').split('{}')[0] }}<b><mk-user-name :user="game.user1"/></b>{{ this.$t('black-is').split('{}')[1] }}</form-radio>
|
||||
<form-radio v-model="game.settings.bw" :value="2" @change="updateSettings">{{ this.$t('black-is').split('{}')[0] }}<b><mk-user-name :user="game.user2"/></b>{{ this.$t('black-is').split('{}')[1] }}</form-radio>
|
||||
<form-radio v-model="game.bw" value="random" @change="updateSettings('bw')">{{ $t('random') }}</form-radio>
|
||||
<form-radio v-model="game.bw" :value="1" @change="updateSettings('bw')">{{ this.$t('black-is').split('{}')[0] }}<b><mk-user-name :user="game.user1"/></b>{{ this.$t('black-is').split('{}')[1] }}</form-radio>
|
||||
<form-radio v-model="game.bw" :value="2" @change="updateSettings('bw')">{{ this.$t('black-is').split('{}')[0] }}<b><mk-user-name :user="game.user2"/></b>{{ this.$t('black-is').split('{}')[1] }}</form-radio>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -47,9 +47,9 @@
|
||||
</header>
|
||||
|
||||
<div>
|
||||
<ui-switch v-model="game.settings.isLlotheo" @change="updateSettings">{{ $t('is-llotheo') }}</ui-switch>
|
||||
<ui-switch v-model="game.settings.loopedBoard" @change="updateSettings">{{ $t('looped-map') }}</ui-switch>
|
||||
<ui-switch v-model="game.settings.canPutEverywhere" @change="updateSettings">{{ $t('can-put-everywhere') }}</ui-switch>
|
||||
<ui-switch v-model="game.isLlotheo" @change="updateSettings('isLlotheo')">{{ $t('is-llotheo') }}</ui-switch>
|
||||
<ui-switch v-model="game.loopedBoard" @change="updateSettings('loopedBoard')">{{ $t('looped-map') }}</ui-switch>
|
||||
<ui-switch v-model="game.canPutEverywhere" @change="updateSettings('canPutEverywhere')">{{ $t('can-put-everywhere') }}</ui-switch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -159,8 +159,8 @@ export default Vue.extend({
|
||||
this.connection.on('initForm', this.onInitForm);
|
||||
this.connection.on('message', this.onMessage);
|
||||
|
||||
if (this.game.user1Id != this.$store.state.i.id && this.game.settings.form1) this.form = this.game.settings.form1;
|
||||
if (this.game.user2Id != this.$store.state.i.id && this.game.settings.form2) this.form = this.game.settings.form2;
|
||||
if (this.game.user1Id != this.$store.state.i.id && this.game.form1) this.form = this.game.form1;
|
||||
if (this.game.user2Id != this.$store.state.i.id && this.game.form2) this.form = this.game.form2;
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
@ -189,18 +189,19 @@ export default Vue.extend({
|
||||
this.$forceUpdate();
|
||||
},
|
||||
|
||||
updateSettings() {
|
||||
updateSettings(key: string) {
|
||||
this.connection.send('updateSettings', {
|
||||
settings: this.game.settings
|
||||
key: key,
|
||||
value: this.game[key]
|
||||
});
|
||||
},
|
||||
|
||||
onUpdateSettings(settings) {
|
||||
this.game.settings = settings;
|
||||
if (this.game.settings.map == null) {
|
||||
onUpdateSettings({ key, value }) {
|
||||
this.game[key] = value;
|
||||
if (this.game.map == null) {
|
||||
this.mapName = null;
|
||||
} else {
|
||||
const found = Object.values(maps).find(x => x.data.join('') == this.game.settings.map.join(''));
|
||||
const found = Object.values(maps).find(x => x.data.join('') == this.game.map.join(''));
|
||||
this.mapName = found ? found.name : '-Custom-';
|
||||
}
|
||||
},
|
||||
@ -224,27 +225,27 @@ export default Vue.extend({
|
||||
|
||||
onMapChange() {
|
||||
if (this.mapName == null) {
|
||||
this.game.settings.map = null;
|
||||
this.game.map = null;
|
||||
} else {
|
||||
this.game.settings.map = Object.values(maps).find(x => x.name == this.mapName).data;
|
||||
this.game.map = Object.values(maps).find(x => x.name == this.mapName).data;
|
||||
}
|
||||
this.$forceUpdate();
|
||||
this.updateSettings();
|
||||
},
|
||||
|
||||
onPixelClick(pos, pixel) {
|
||||
const x = pos % this.game.settings.map[0].length;
|
||||
const y = Math.floor(pos / this.game.settings.map[0].length);
|
||||
const x = pos % this.game.map[0].length;
|
||||
const y = Math.floor(pos / this.game.map[0].length);
|
||||
const newPixel =
|
||||
pixel == ' ' ? '-' :
|
||||
pixel == '-' ? 'b' :
|
||||
pixel == 'b' ? 'w' :
|
||||
' ';
|
||||
const line = this.game.settings.map[y].split('');
|
||||
const line = this.game.map[y].split('');
|
||||
line[x] = newPixel;
|
||||
this.$set(this.game.settings.map, y, line.join(''));
|
||||
this.$set(this.game.map, y, line.join(''));
|
||||
this.$forceUpdate();
|
||||
this.updateSettings();
|
||||
this.updateSettings('map');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -106,7 +106,7 @@ export default Vue.extend({
|
||||
async nav(game, actualNav = true) {
|
||||
if (this.selfNav) {
|
||||
// 受け取ったゲーム情報が省略されたものなら完全な情報を取得する
|
||||
if (game != null && (game.settings == null || game.settings.map == null)) {
|
||||
if (game != null && game.map == null) {
|
||||
game = await this.$root.api('games/reversi/games/show', {
|
||||
gameId: game.id
|
||||
});
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="nhasjydimbopojusarffqjyktglcuxjy" v-if="meta">
|
||||
<div class="banner" :style="{ backgroundImage: meta.bannerUrl ? `url(${meta.bannerUrl})` : null }"></div>
|
||||
|
||||
<h1>{{ meta.name }}</h1>
|
||||
<h1>{{ meta.name || 'Misskey' }}</h1>
|
||||
<p v-html="meta.description || this.$t('@.about')"></p>
|
||||
<router-link to="/">{{ $t('start') }}</router-link>
|
||||
</div>
|
||||
|
@ -52,7 +52,7 @@ export default Vue.extend({
|
||||
}
|
||||
|
||||
return {
|
||||
'background-color': this.image.properties.avgColor && this.image.properties.avgColor.length == 3 ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent',
|
||||
'background-color': this.image.properties.avgColor || 'transparent',
|
||||
'background-image': url
|
||||
};
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export default Vue.extend({
|
||||
},
|
||||
computed: {
|
||||
canonical(): string {
|
||||
return `@${this.username}@${toUnicode(this.host)}`;
|
||||
return this.host === localHost ? `@${this.username}` : `@${this.username}@${toUnicode(this.host)}`;
|
||||
},
|
||||
isMe(): boolean {
|
||||
return this.$store.getters.isSignedIn && this.canonical.toLowerCase() === `@${this.$store.state.i.username}@${toUnicode(localHost)}`.toLowerCase();
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="file" v-if="message.file">
|
||||
<a :href="message.file.url" target="_blank" :title="message.file.name">
|
||||
<img v-if="message.file.type.split('/')[0] == 'image'" :src="message.file.url" :alt="message.file.name"
|
||||
:style="{ backgroundColor: message.file.properties.avgColor && message.file.properties.avgColor.length == 3 ? `rgb(${message.file.properties.avgColor.join(',')})` : 'transparent' }"/>
|
||||
:style="{ backgroundColor: message.file.properties.avgColor || 'transparent' }"/>
|
||||
<p v-else>{{ message.file.name }}</p>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="mk-poll" :data-done="closed || isVoted">
|
||||
<ul>
|
||||
<li v-for="choice in poll.choices" :key="choice.id" @click="vote(choice.id)" :class="{ voted: choice.voted }" :title="!closed && !isVoted ? $t('vote-to').replace('{}', choice.text) : ''">
|
||||
<li v-for="(choice, i) in poll.choices" :key="i" @click="vote(i)" :class="{ voted: choice.voted }" :title="!closed && !isVoted ? $t('vote-to').replace('{}', choice.text) : ''">
|
||||
<div class="backdrop" :style="{ 'width': `${showResult ? (choice.votes / total * 100) : 0}%` }"></div>
|
||||
<span>
|
||||
<template v-if="choice.isVoted"><fa icon="check"/></template>
|
||||
@ -82,12 +82,6 @@ export default Vue.extend({
|
||||
noteId: this.note.id,
|
||||
choice: id
|
||||
}).then(() => {
|
||||
for (const c of this.poll.choices) {
|
||||
if (c.id == id) {
|
||||
c.votes++;
|
||||
Vue.set(c, 'isVoted', true);
|
||||
}
|
||||
}
|
||||
if (!this.showResult) this.showResult = !this.poll.multiple;
|
||||
});
|
||||
}
|
||||
|
139
src/client/app/common/views/components/post-form-attaches.vue
Normal file
139
src/client/app/common/views/components/post-form-attaches.vue
Normal file
@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div class="skeikyzd" v-show="files.length != 0">
|
||||
<x-draggable class="files" :list="files" :options="{ animation: 150 }">
|
||||
<div v-for="file in files" :key="file.id" @click="showFileMenu(file, $event)" @contextmenu.prevent="showFileMenu(file, $event)">
|
||||
<x-file-thumbnail :data-id="file.id" class="thumbnail" :file="file" fit="cover"/>
|
||||
<img class="remove" @click.stop="detachMedia(file.id)" src="/assets/desktop/remove.png" :title="$t('attach-cancel')" alt=""/>
|
||||
<div class="sensitive" v-if="file.isSensitive">
|
||||
<fa class="icon" :icon="faExclamationTriangle"/>
|
||||
</div>
|
||||
</div>
|
||||
</x-draggable>
|
||||
<p class="remain">{{ 4 - files.length }}/4</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import i18n from '../../../i18n';
|
||||
import * as XDraggable from 'vuedraggable';
|
||||
import XMenu from '../../../common/views/components/menu.vue';
|
||||
import { faTimesCircle, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons';
|
||||
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
||||
import XFileThumbnail from './drive-file-thumbnail.vue'
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('common/views/components/post-form-attaches.vue'),
|
||||
|
||||
components: {
|
||||
XDraggable,
|
||||
XFileThumbnail
|
||||
},
|
||||
|
||||
props: {
|
||||
files: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
detachMediaFn: {
|
||||
type: Object,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
faExclamationTriangle
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
detachMedia(id) {
|
||||
if (this.detachMediaFn) this.detachMediaFn(id)
|
||||
else if (this.$parent.detachMedia) this.$parent.detachMedia(id)
|
||||
},
|
||||
toggleSensitive(file) {
|
||||
this.$root.api('drive/files/update', {
|
||||
fileId: file.id,
|
||||
isSensitive: !file.isSensitive
|
||||
}).then(() => {
|
||||
file.isSensitive = !file.isSensitive;
|
||||
});
|
||||
},
|
||||
showFileMenu(file, ev: MouseEvent) {
|
||||
this.$root.new(XMenu, {
|
||||
items: [{
|
||||
type: 'item',
|
||||
text: file.isSensitive ? this.$t('unmark-as-sensitive') : this.$t('mark-as-sensitive'),
|
||||
icon: file.isSensitive ? faEyeSlash : faEye,
|
||||
action: () => { this.toggleSensitive(file) }
|
||||
}, {
|
||||
type: 'item',
|
||||
text: this.$t('attach-cancel'),
|
||||
icon: faTimesCircle,
|
||||
action: () => { this.detachMedia(file.id) }
|
||||
}],
|
||||
source: ev.currentTarget || ev.target
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.skeikyzd
|
||||
padding 4px
|
||||
|
||||
> .files
|
||||
display flex
|
||||
flex-wrap wrap
|
||||
|
||||
> div
|
||||
width 64px
|
||||
height 64px
|
||||
margin 4px
|
||||
cursor move
|
||||
|
||||
&:hover > .remove
|
||||
display block
|
||||
|
||||
> .thumbnail
|
||||
width 100%
|
||||
height 100%
|
||||
z-index 1
|
||||
color var(--text)
|
||||
|
||||
> .remove
|
||||
display none
|
||||
position absolute
|
||||
top -6px
|
||||
right -6px
|
||||
width 16px
|
||||
height 16px
|
||||
cursor pointer
|
||||
z-index 1000
|
||||
|
||||
> .sensitive
|
||||
display flex
|
||||
position absolute
|
||||
width 64px
|
||||
height 64px
|
||||
top 0
|
||||
left 0
|
||||
z-index 2
|
||||
background rgba(17, 17, 17, .7)
|
||||
color #fff
|
||||
|
||||
> .icon
|
||||
margin auto
|
||||
|
||||
> .remain
|
||||
display block
|
||||
position absolute
|
||||
top 8px
|
||||
right 8px
|
||||
margin 0
|
||||
padding 0
|
||||
color var(--primaryAlpha04)
|
||||
|
||||
</style>
|
@ -20,7 +20,7 @@ export default Vue.extend({
|
||||
},
|
||||
computed: {
|
||||
reactions(): any {
|
||||
return this.note.reactionCounts;
|
||||
return this.note.reactions;
|
||||
},
|
||||
isMe(): boolean {
|
||||
return this.$store.getters.isSignedIn && this.$store.state.i.id === this.note.userId;
|
||||
|
@ -2,7 +2,7 @@
|
||||
<ui-card>
|
||||
<template #title><fa :icon="['far', 'bell']"/> {{ $t('title') }}</template>
|
||||
<section>
|
||||
<ui-switch v-model="$store.state.i.settings.autoWatch" @change="onChangeAutoWatch">
|
||||
<ui-switch v-model="$store.state.i.autoWatch" @change="onChangeAutoWatch">
|
||||
{{ $t('auto-watch') }}<template #desc>{{ $t('auto-watch-desc') }}</template>
|
||||
</ui-switch>
|
||||
<section>
|
||||
|
@ -158,14 +158,14 @@ export default Vue.extend({
|
||||
|
||||
computed: {
|
||||
alwaysMarkNsfw: {
|
||||
get() { return this.$store.state.i.settings.alwaysMarkNsfw; },
|
||||
get() { return this.$store.state.i.alwaysMarkNsfw; },
|
||||
set(value) { this.$root.api('i/update', { alwaysMarkNsfw: value }); }
|
||||
},
|
||||
|
||||
bannerStyle(): any {
|
||||
if (this.$store.state.i.bannerUrl == null) return {};
|
||||
return {
|
||||
backgroundColor: this.$store.state.i.bannerColor && this.$store.state.i.bannerColor.length == 3 ? `rgb(${ this.$store.state.i.bannerColor.join(',') })` : null,
|
||||
backgroundColor: this.$store.state.i.bannerColor,
|
||||
backgroundImage: `url(${ this.$store.state.i.bannerUrl })`
|
||||
};
|
||||
},
|
||||
@ -178,10 +178,10 @@ export default Vue.extend({
|
||||
this.email = this.$store.state.i.email;
|
||||
this.name = this.$store.state.i.name;
|
||||
this.username = this.$store.state.i.username;
|
||||
this.location = this.$store.state.i.profile.location;
|
||||
this.location = this.$store.state.i.location;
|
||||
this.description = this.$store.state.i.description;
|
||||
this.lang = this.$store.state.i.lang;
|
||||
this.birthday = this.$store.state.i.profile.birthday;
|
||||
this.birthday = this.$store.state.i.birthday;
|
||||
this.avatarId = this.$store.state.i.avatarId;
|
||||
this.bannerId = this.$store.state.i.bannerId;
|
||||
this.isCat = this.$store.state.i.isCat;
|
||||
|
@ -130,20 +130,6 @@ import * as tinycolor from 'tinycolor2';
|
||||
import * as JSON5 from 'json5';
|
||||
import { faMoon, faSun } from '@fortawesome/free-regular-svg-icons';
|
||||
|
||||
// 後方互換性のため
|
||||
function convertOldThemedefinition(t) {
|
||||
const t2 = {
|
||||
id: t.meta.id,
|
||||
name: t.meta.name,
|
||||
author: t.meta.author,
|
||||
base: t.meta.base,
|
||||
vars: t.meta.vars,
|
||||
props: t
|
||||
};
|
||||
delete t2.props.meta;
|
||||
return t2;
|
||||
}
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('common/views/components/theme.vue'),
|
||||
components: {
|
||||
@ -231,20 +217,6 @@ export default Vue.extend({
|
||||
}
|
||||
},
|
||||
|
||||
beforeCreate() {
|
||||
// migrate old theme definitions
|
||||
// 後方互換性のため
|
||||
this.$store.commit('device/set', {
|
||||
key: 'themes', value: this.$store.state.device.themes.map(t => {
|
||||
if (t.id == null) {
|
||||
return convertOldThemedefinition(t);
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
install(code) {
|
||||
let theme;
|
||||
@ -259,11 +231,6 @@ export default Vue.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
// 後方互換性のため
|
||||
if (theme.id == null && theme.meta != null) {
|
||||
theme = convertOldThemedefinition(theme);
|
||||
}
|
||||
|
||||
if (theme.id == null) {
|
||||
this.$root.dialog({
|
||||
type: 'error',
|
||||
|
@ -4,7 +4,7 @@
|
||||
<ui-input v-if="meta.disableRegistration" v-model="invitationCode" type="text" :autocomplete="Math.random()" spellcheck="false" required styl="fill">
|
||||
<span>{{ $t('invitation-code') }}</span>
|
||||
<template #prefix><fa icon="id-card-alt"/></template>
|
||||
<template #desc v-html="this.$t('invitation-info').replace('{}', 'mailto:' + meta.maintainer.email)"></template>
|
||||
<template #desc v-html="this.$t('invitation-info').replace('{}', 'mailto:' + meta.maintainerEmail)"></template>
|
||||
</ui-input>
|
||||
<ui-input v-model="username" type="text" pattern="^[a-zA-Z0-9_]{1,20}$" :autocomplete="Math.random()" spellcheck="false" required @input="onChangeUsername" styl="fill">
|
||||
<span>{{ $t('username') }}</span>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="cudqjmnl">
|
||||
<ui-card>
|
||||
<template #title><fa :icon="faList"/> {{ list.title }}</template>
|
||||
<template #title><fa :icon="faList"/> {{ list.name }}</template>
|
||||
|
||||
<section>
|
||||
<ui-button @click="rename"><fa :icon="faICursor"/> {{ $t('rename') }}</ui-button>
|
||||
@ -75,7 +75,7 @@ export default Vue.extend({
|
||||
this.$root.dialog({
|
||||
title: this.$t('rename'),
|
||||
input: {
|
||||
default: this.list.title
|
||||
default: this.list.name
|
||||
}
|
||||
}).then(({ canceled, result: title }) => {
|
||||
if (canceled) return;
|
||||
@ -89,7 +89,7 @@ export default Vue.extend({
|
||||
del() {
|
||||
this.$root.dialog({
|
||||
type: 'warning',
|
||||
text: this.$t('delete-are-you-sure').replace('$1', this.list.title),
|
||||
text: this.$t('delete-are-you-sure').replace('$1', this.list.name),
|
||||
showCancelButton: true
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
|
@ -51,7 +51,7 @@ export default Vue.extend({
|
||||
fetchingMoreUsers: false,
|
||||
us: [],
|
||||
inited: false,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -73,7 +73,7 @@ export default Vue.extend({
|
||||
title: t,
|
||||
select: {
|
||||
items: lists.map(list => ({
|
||||
value: list.id, text: list.title
|
||||
value: list.id, text: list.name
|
||||
}))
|
||||
},
|
||||
showCancelButton: true
|
||||
|
@ -28,12 +28,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -37,12 +37,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -28,7 +28,7 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
connection: null,
|
||||
makePromise: cursor => this.$root.api('notes/search_by_tag', {
|
||||
makePromise: cursor => this.$root.api('notes/search-by-tag', {
|
||||
limit: fetchLimit + 1,
|
||||
untilId: cursor ? cursor : undefined,
|
||||
withFiles: this.mediaOnly,
|
||||
@ -41,12 +41,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -41,12 +41,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -27,12 +27,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -26,8 +26,8 @@
|
||||
</template>
|
||||
</component>
|
||||
|
||||
<footer v-if="cursor != null">
|
||||
<button @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
|
||||
<footer v-if="more">
|
||||
<button @click="fetchMore()" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
|
||||
<template v-if="!moreFetching">{{ $t('@.load-more') }}</template>
|
||||
<template v-if="moreFetching"><fa icon="spinner" pulse fixed-width/></template>
|
||||
</button>
|
||||
@ -61,7 +61,7 @@ export default Vue.extend({
|
||||
fetching: true,
|
||||
moreFetching: false,
|
||||
inited: false,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -119,7 +119,7 @@ export default Vue.extend({
|
||||
this.notes = x;
|
||||
} else {
|
||||
this.notes = x.notes;
|
||||
this.cursor = x.cursor;
|
||||
this.more = x.more;
|
||||
}
|
||||
this.inited = true;
|
||||
this.fetching = false;
|
||||
@ -129,12 +129,12 @@ export default Vue.extend({
|
||||
});
|
||||
},
|
||||
|
||||
more() {
|
||||
if (this.cursor == null || this.moreFetching) return;
|
||||
fetchMore() {
|
||||
if (!this.more || this.moreFetching) return;
|
||||
this.moreFetching = true;
|
||||
this.makePromise(this.cursor).then(x => {
|
||||
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
|
||||
this.notes = this.notes.concat(x.notes);
|
||||
this.cursor = x.cursor;
|
||||
this.more = x.more;
|
||||
this.moreFetching = false;
|
||||
}, e => {
|
||||
this.moreFetching = false;
|
||||
@ -157,7 +157,7 @@ export default Vue.extend({
|
||||
// オーバーフローしたら古い投稿は捨てる
|
||||
if (this.notes.length >= displayLimit) {
|
||||
this.notes = this.notes.slice(0, displayLimit);
|
||||
this.cursor = this.notes[this.notes.length - 1].id
|
||||
this.more = true;
|
||||
}
|
||||
} else {
|
||||
this.queue.push(note);
|
||||
@ -181,7 +181,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
onBottom() {
|
||||
this.more();
|
||||
this.fetchMore();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -62,7 +62,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="notification poll_vote" v-if="notification.type == 'poll_vote'">
|
||||
<div class="notification pollVote" v-if="notification.type == 'pollVote'">
|
||||
<mk-avatar class="avatar" :user="notification.user"/>
|
||||
<div>
|
||||
<header>
|
||||
|
@ -39,7 +39,7 @@ export default Vue.extend({
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -82,7 +82,7 @@ export default Vue.extend({
|
||||
case 'local': return this.$t('@deck.local');
|
||||
case 'hybrid': return this.$t('@deck.hybrid');
|
||||
case 'global': return this.$t('@deck.global');
|
||||
case 'list': return this.column.list.title;
|
||||
case 'list': return this.column.list.name;
|
||||
case 'hashtag': return this.$store.state.settings.tagTimelines.find(x => x.id == this.column.tagTlId).title;
|
||||
}
|
||||
}
|
||||
|
@ -85,12 +85,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -95,12 +95,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: new Date(notes[notes.length - 1].createdAt).getTime()
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="is-remote" v-if="user.host != null">
|
||||
<details>
|
||||
<summary><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}</summary>
|
||||
<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a>
|
||||
<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a>
|
||||
</details>
|
||||
</div>
|
||||
<header :style="bannerStyle">
|
||||
@ -88,7 +88,7 @@ export default Vue.extend({
|
||||
if (this.user == null) return {};
|
||||
if (this.user.bannerUrl == null) return {};
|
||||
return {
|
||||
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
|
||||
backgroundColor: this.user.bannerColor,
|
||||
backgroundImage: `url(${ this.user.bannerUrl })`
|
||||
};
|
||||
},
|
||||
|
@ -106,16 +106,6 @@ export default Vue.extend({
|
||||
value: deck
|
||||
});
|
||||
}
|
||||
|
||||
// 互換性のため
|
||||
if (this.$store.state.device.deck != null && this.$store.state.device.deck.layout == null) {
|
||||
this.$store.commit('device/set', {
|
||||
key: 'deck',
|
||||
value: Object.assign({}, this.$store.state.device.deck, {
|
||||
layout: this.$store.state.device.deck.columns.map(c => [c.id])
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@ -199,7 +189,7 @@ export default Vue.extend({
|
||||
title: this.$t('@deck.select-list'),
|
||||
select: {
|
||||
items: lists.map(list => ({
|
||||
value: list.id, text: list.title
|
||||
value: list.id, text: list.name
|
||||
}))
|
||||
},
|
||||
showCancelButton: true
|
||||
|
@ -3,7 +3,7 @@
|
||||
<ui-container :show-header="false" v-if="meta && stats">
|
||||
<div class="kpdsmpnk" :style="{ backgroundImage: meta.bannerUrl ? `url(${meta.bannerUrl})` : null }">
|
||||
<div>
|
||||
<router-link to="/explore" class="title">{{ $t('explore', { host: meta.name }) }}</router-link>
|
||||
<router-link to="/explore" class="title">{{ $t('explore', { host: meta.name || 'Misskey' }) }}</router-link>
|
||||
<span>{{ $t('users-info', { users: num(stats.originalUsersCount) }) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -13,8 +13,8 @@
|
||||
<template #header><fa :icon="faHashtag" fixed-width/>{{ $t('popular-tags') }}</template>
|
||||
|
||||
<div class="vxjfqztj">
|
||||
<router-link v-for="tag in tagsLocal" :to="`/explore/tags/${tag.tag}`" :key="'local:' + tag.tag" class="local">{{ tag.tag }}</router-link>
|
||||
<router-link v-for="tag in tagsRemote" :to="`/explore/tags/${tag.tag}`" :key="'remote:' + tag.tag">{{ tag.tag }}</router-link>
|
||||
<router-link v-for="tag in tagsLocal" :to="`/explore/tags/${tag.name}`" :key="'local:' + tag.name" class="local">{{ tag.name }}</router-link>
|
||||
<router-link v-for="tag in tagsRemote" :to="`/explore/tags/${tag.name}`" :key="'remote:' + tag.name">{{ tag.name }}</router-link>
|
||||
</div>
|
||||
</ui-container>
|
||||
|
||||
|
@ -57,7 +57,7 @@ export default Vue.extend({
|
||||
bannerStyle(): any {
|
||||
if (this.user.bannerUrl == null) return {};
|
||||
return {
|
||||
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
|
||||
backgroundColor: this.user.bannerColor,
|
||||
backgroundImage: `url(${ this.user.bannerUrl })`
|
||||
};
|
||||
}
|
||||
|
@ -9,20 +9,30 @@ import Vue from 'vue';
|
||||
import parseAcct from '../../../../../misc/acct/parse';
|
||||
import i18n from '../../../i18n';
|
||||
|
||||
const fetchLimit = 30;
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n(''),
|
||||
i18n: i18n(),
|
||||
|
||||
data() {
|
||||
return {
|
||||
makePromise: cursor => this.$root.api('users/followers', {
|
||||
...parseAcct(this.$route.params.user),
|
||||
limit: 30,
|
||||
cursor: cursor ? cursor : undefined
|
||||
}).then(x => {
|
||||
return {
|
||||
users: x.users,
|
||||
cursor: x.next
|
||||
};
|
||||
limit: fetchLimit + 1,
|
||||
untilId: cursor ? cursor : undefined,
|
||||
}).then(followings => {
|
||||
if (followings.length == fetchLimit + 1) {
|
||||
followings.pop();
|
||||
return {
|
||||
users: followings.map(following => following.follower),
|
||||
cursor: followings[followings.length - 1].id
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
users: followings.map(following => following.follower),
|
||||
more: false
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
},
|
||||
|
@ -7,19 +7,32 @@
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import parseAcct from '../../../../../misc/acct/parse';
|
||||
import i18n from '../../../i18n';
|
||||
|
||||
const fetchLimit = 30;
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n(),
|
||||
|
||||
data() {
|
||||
return {
|
||||
makePromise: cursor => this.$root.api('users/following', {
|
||||
...parseAcct(this.$route.params.user),
|
||||
limit: 30,
|
||||
cursor: cursor ? cursor : undefined
|
||||
}).then(x => {
|
||||
return {
|
||||
users: x.users,
|
||||
cursor: x.next
|
||||
};
|
||||
limit: fetchLimit + 1,
|
||||
untilId: cursor ? cursor : undefined,
|
||||
}).then(followings => {
|
||||
if (followings.length == fetchLimit + 1) {
|
||||
followings.pop();
|
||||
return {
|
||||
users: followings.map(following => following.followee),
|
||||
cursor: followings[followings.length - 1].id
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
users: followings.map(following => following.followee),
|
||||
more: false
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
},
|
||||
|
@ -42,7 +42,7 @@ export default Vue.extend({
|
||||
},
|
||||
mounted() {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.name = meta.name;
|
||||
this.name = meta.name || 'Misskey';
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -21,14 +21,7 @@
|
||||
<fa :icon="['far', 'laugh']"/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="files" v-show="files.length != 0">
|
||||
<x-draggable :list="files" :options="{ animation: 150 }">
|
||||
<div v-for="file in files" :key="file.id">
|
||||
<div class="img" :style="{ backgroundImage: `url(${file.thumbnailUrl})` }" :title="file.name"></div>
|
||||
<img class="remove" @click="detachMedia(file.id)" src="/assets/desktop/remove.png" :title="$t('attach-cancel')" alt=""/>
|
||||
</div>
|
||||
</x-draggable>
|
||||
</div>
|
||||
<x-post-form-attaches class="files" :files="files" :detachMediaFn="detachMedia"/>
|
||||
<input ref="file" type="file" multiple="multiple" tabindex="-1" @change="onChangeFile"/>
|
||||
<mk-uploader ref="uploader" @uploaded="attachMedia"/>
|
||||
<footer>
|
||||
@ -45,7 +38,7 @@
|
||||
import define from '../../../common/define-widget';
|
||||
import i18n from '../../../i18n';
|
||||
import insertTextAtCursor from 'insert-text-at-cursor';
|
||||
import * as XDraggable from 'vuedraggable';
|
||||
import XPostFormAttaches from '../components/post-form-attaches.vue';
|
||||
|
||||
export default define({
|
||||
name: 'post-form',
|
||||
@ -56,7 +49,7 @@ export default define({
|
||||
i18n: i18n('desktop/views/widgets/post-form.vue'),
|
||||
|
||||
components: {
|
||||
XDraggable
|
||||
XPostFormAttaches
|
||||
},
|
||||
|
||||
data() {
|
||||
@ -249,38 +242,6 @@ export default define({
|
||||
& + .emoji
|
||||
opacity 0.7
|
||||
|
||||
> .files
|
||||
> div
|
||||
padding 4px
|
||||
|
||||
&:after
|
||||
content ""
|
||||
display block
|
||||
clear both
|
||||
|
||||
> div
|
||||
float left
|
||||
border solid 4px transparent
|
||||
cursor move
|
||||
|
||||
&:hover > .remove
|
||||
display block
|
||||
|
||||
> .img
|
||||
width 64px
|
||||
height 64px
|
||||
background-size cover
|
||||
background-position center center
|
||||
|
||||
> .remove
|
||||
display none
|
||||
position absolute
|
||||
top -6px
|
||||
right -6px
|
||||
width 16px
|
||||
height 16px
|
||||
cursor pointer
|
||||
|
||||
> input[type=file]
|
||||
display none
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="info">
|
||||
<p>Maintainer: <b><a :href="'mailto:' + meta.maintainer.email" target="_blank">{{ meta.maintainer.name }}</a></b></p>
|
||||
<p>Maintainer: <b><a :href="'mailto:' + meta.maintainerEmail" target="_blank">{{ meta.maintainerName }}</a></b></p>
|
||||
<p>Machine: {{ meta.machine }}</p>
|
||||
<p>Node: {{ meta.node }}</p>
|
||||
<p>Version: {{ meta.version }} </p>
|
||||
|
@ -60,7 +60,7 @@ export default Vue.extend({
|
||||
return this.browser.selectedFiles.some(f => f.id == this.file.id);
|
||||
},
|
||||
title(): string {
|
||||
return `${this.file.name}\n${this.file.type} ${Vue.filter('bytes')(this.file.datasize)}`;
|
||||
return `${this.file.name}\n${this.file.type} ${Vue.filter('bytes')(this.file.size)}`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -139,10 +139,10 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
onThumbnailLoaded() {
|
||||
if (this.file.properties.avgColor && this.file.properties.avgColor.length == 3) {
|
||||
if (this.file.properties.avgColor) {
|
||||
anime({
|
||||
targets: this.$refs.thumbnail,
|
||||
backgroundColor: `rgba(${this.file.properties.avgColor.join(',')}, 0)`,
|
||||
backgroundColor: this.file.properties.avgColor.replace('255)', '0)'),
|
||||
duration: 100,
|
||||
easing: 'linear'
|
||||
});
|
||||
|
@ -769,7 +769,6 @@ export default Vue.extend({
|
||||
> .mk-uploader
|
||||
height 100px
|
||||
padding 16px
|
||||
background #fff
|
||||
|
||||
> input
|
||||
display none
|
||||
|
@ -54,11 +54,11 @@
|
||||
</button>
|
||||
<button v-if="!isMyNote && appearNote.myReaction == null" class="reactionButton button" @click="react()" ref="reactButton" :title="$t('add-reaction')">
|
||||
<fa icon="plus"/>
|
||||
<p class="count" v-if="Object.values(appearNote.reactionCounts).some(x => x)">{{ Object.values(appearNote.reactionCounts).reduce((a, c) => a + c, 0) }}</p>
|
||||
<p class="count" v-if="Object.values(appearNote.reactions).some(x => x)">{{ Object.values(appearNote.reactions).reduce((a, c) => a + c, 0) }}</p>
|
||||
</button>
|
||||
<button v-if="!isMyNote && appearNote.myReaction != null" class="reactionButton reacted button" @click="undoReact(appearNote)" ref="reactButton" :title="$t('undo-reaction')">
|
||||
<fa icon="minus"/>
|
||||
<p class="count" v-if="Object.values(appearNote.reactionCounts).some(x => x)">{{ Object.values(appearNote.reactionCounts).reduce((a, c) => a + c, 0) }}</p>
|
||||
<p class="count" v-if="Object.values(appearNote.reactions).some(x => x)">{{ Object.values(appearNote.reactions).reduce((a, c) => a + c, 0) }}</p>
|
||||
</button>
|
||||
<button @click="menu()" ref="menuButton" class="button">
|
||||
<fa icon="ellipsis-h"/>
|
||||
|
@ -25,8 +25,8 @@
|
||||
</template>
|
||||
</component>
|
||||
|
||||
<footer v-if="cursor != null">
|
||||
<button @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
|
||||
<footer v-if="more">
|
||||
<button @click="fetchMore()" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
|
||||
<template v-if="!moreFetching">{{ $t('@.load-more') }}</template>
|
||||
<template v-if="moreFetching"><fa icon="spinner" pulse fixed-width/></template>
|
||||
</button>
|
||||
@ -58,7 +58,7 @@ export default Vue.extend({
|
||||
fetching: true,
|
||||
moreFetching: false,
|
||||
inited: false,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -112,7 +112,7 @@ export default Vue.extend({
|
||||
this.notes = x;
|
||||
} else {
|
||||
this.notes = x.notes;
|
||||
this.cursor = x.cursor;
|
||||
this.more = x.more;
|
||||
}
|
||||
this.inited = true;
|
||||
this.fetching = false;
|
||||
@ -122,12 +122,12 @@ export default Vue.extend({
|
||||
});
|
||||
},
|
||||
|
||||
more() {
|
||||
if (this.cursor == null || this.moreFetching) return;
|
||||
fetchMore() {
|
||||
if (!this.more || this.moreFetching) return;
|
||||
this.moreFetching = true;
|
||||
this.makePromise(this.cursor).then(x => {
|
||||
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
|
||||
this.notes = this.notes.concat(x.notes);
|
||||
this.cursor = x.cursor;
|
||||
this.more = x.more;
|
||||
this.moreFetching = false;
|
||||
}, e => {
|
||||
this.moreFetching = false;
|
||||
@ -157,7 +157,7 @@ export default Vue.extend({
|
||||
// オーバーフローしたら古い投稿は捨てる
|
||||
if (this.notes.length >= displayLimit) {
|
||||
this.notes = this.notes.slice(0, displayLimit);
|
||||
this.cursor = this.notes[this.notes.length - 1].id
|
||||
this.more = true;
|
||||
}
|
||||
} else {
|
||||
this.queue.push(note);
|
||||
@ -183,7 +183,7 @@ export default Vue.extend({
|
||||
|
||||
if (this.$store.state.settings.fetchOnScroll !== false) {
|
||||
const current = window.scrollY + window.innerHeight;
|
||||
if (current > document.body.offsetHeight - 8) this.more();
|
||||
if (current > document.body.offsetHeight - 8) this.fetchMore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="notification.type == 'poll_vote'">
|
||||
<template v-if="notification.type == 'pollVote'">
|
||||
<mk-avatar class="avatar" :user="notification.user"/>
|
||||
<div class="text">
|
||||
<p><fa icon="chart-pie"/><a :href="notification.user | userPage" v-user-preview="notification.user.id">
|
||||
|
@ -27,15 +27,7 @@
|
||||
<button class="emoji" @click="emoji" ref="emoji">
|
||||
<fa :icon="['far', 'laugh']"/>
|
||||
</button>
|
||||
<div class="files" :class="{ with: poll }" v-show="files.length != 0">
|
||||
<x-draggable :list="files" :options="{ animation: 150 }">
|
||||
<div v-for="file in files" :key="file.id">
|
||||
<div class="img" :style="{ backgroundImage: `url(${file.thumbnailUrl})` }" :title="file.name"></div>
|
||||
<img class="remove" @click="detachMedia(file.id)" src="/assets/desktop/remove.png" :title="$t('attach-cancel')" alt=""/>
|
||||
</div>
|
||||
</x-draggable>
|
||||
<p class="remain">{{ 4 - files.length }}/4</p>
|
||||
</div>
|
||||
<x-post-form-attaches class="files" :class="{ with: poll }" :files="files"/>
|
||||
<mk-poll-editor v-if="poll" ref="poll" @destroyed="poll = false" @updated="onPollUpdate()"/>
|
||||
</div>
|
||||
</div>
|
||||
@ -65,7 +57,6 @@
|
||||
import Vue from 'vue';
|
||||
import i18n from '../../../i18n';
|
||||
import insertTextAtCursor from 'insert-text-at-cursor';
|
||||
import * as XDraggable from 'vuedraggable';
|
||||
import getFace from '../../../common/scripts/get-face';
|
||||
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
||||
import { parse } from '../../../../../mfm/parse';
|
||||
@ -74,13 +65,14 @@ import { erase, unique } from '../../../../../prelude/array';
|
||||
import { length } from 'stringz';
|
||||
import { toASCII } from 'punycode';
|
||||
import extractMentions from '../../../../../misc/extract-mentions';
|
||||
import XPostFormAttaches from '../../../common/views/components/post-form-attaches.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('desktop/views/components/post-form.vue'),
|
||||
|
||||
components: {
|
||||
XDraggable,
|
||||
MkVisibilityChooser
|
||||
MkVisibilityChooser,
|
||||
XPostFormAttaches
|
||||
},
|
||||
|
||||
props: {
|
||||
@ -513,7 +505,7 @@ export default Vue.extend({
|
||||
|
||||
kao() {
|
||||
this.text += getFace();
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -618,46 +610,6 @@ export default Vue.extend({
|
||||
border-bottom solid 1px var(--primaryAlpha01) !important
|
||||
border-radius 0
|
||||
|
||||
> .remain
|
||||
display block
|
||||
position absolute
|
||||
top 8px
|
||||
right 8px
|
||||
margin 0
|
||||
padding 0
|
||||
color var(--primaryAlpha04)
|
||||
|
||||
> div
|
||||
padding 4px
|
||||
|
||||
&:after
|
||||
content ""
|
||||
display block
|
||||
clear both
|
||||
|
||||
> div
|
||||
float left
|
||||
border solid 4px transparent
|
||||
cursor move
|
||||
|
||||
&:hover > .remove
|
||||
display block
|
||||
|
||||
> .img
|
||||
width 64px
|
||||
height 64px
|
||||
background-size cover
|
||||
background-position center center
|
||||
|
||||
> .remove
|
||||
display none
|
||||
position absolute
|
||||
top -6px
|
||||
right -6px
|
||||
width 16px
|
||||
height 16px
|
||||
cursor pointer
|
||||
|
||||
> .mk-poll-editor
|
||||
background var(--desktopPostFormTextareaBg)
|
||||
border solid 1px var(--primaryAlpha01)
|
||||
|
@ -30,12 +30,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<mk-window ref="window" width="450px" height="500px" @closed="destroyDom">
|
||||
<template #header><fa icon="list"/> {{ list.title }}</template>
|
||||
<template #header><fa icon="list"/> {{ list.name }}</template>
|
||||
|
||||
<x-editor :list="list"/>
|
||||
</mk-window>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<div class="xkxvokkjlptzyewouewmceqcxhpgzprp">
|
||||
<button class="ui" @click="add">{{ $t('create-list') }}</button>
|
||||
<a v-for="list in lists" :key="list.id" @click="choice(list)">{{ list.title }}</a>
|
||||
<a v-for="list in lists" :key="list.id" @click="choice(list)">{{ list.name }}</a>
|
||||
</div>
|
||||
</mk-window>
|
||||
</template>
|
||||
|
@ -6,7 +6,7 @@
|
||||
</template>
|
||||
</sequential-entrance>
|
||||
<div class="more" v-if="existMore">
|
||||
<ui-button inline @click="more">{{ $t('@.load-more') }}</ui-button>
|
||||
<ui-button inline @click="fetchMore()">{{ $t('@.load-more') }}</ui-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -48,7 +48,7 @@ export default Vue.extend({
|
||||
Progress.done();
|
||||
});
|
||||
},
|
||||
more() {
|
||||
fetchMore() {
|
||||
this.moreFetching = true;
|
||||
this.$root.api('i/favorites', {
|
||||
limit: 11,
|
||||
|
@ -101,7 +101,7 @@ export default Vue.extend({
|
||||
computed: {
|
||||
home(): any[] {
|
||||
if (this.$store.getters.isSignedIn) {
|
||||
return this.$store.state.settings.home || [];
|
||||
return this.$store.state.device.home || [];
|
||||
} else {
|
||||
return [{
|
||||
name: 'instance',
|
||||
@ -182,12 +182,8 @@ export default Vue.extend({
|
||||
}
|
||||
//#endregion
|
||||
|
||||
if (this.$store.state.settings.home == null) {
|
||||
this.$root.api('i/update_home', {
|
||||
home: _defaultDesktopHomeWidgets
|
||||
}).then(() => {
|
||||
this.$store.commit('settings/setHome', _defaultDesktopHomeWidgets);
|
||||
});
|
||||
if (this.$store.state.device.home == null) {
|
||||
this.$store.commit('device/setHome', _defaultDesktopHomeWidgets);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -226,7 +222,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
addWidget() {
|
||||
this.$store.dispatch('settings/addHomeWidget', {
|
||||
this.$store.commit('device/addHomeWidget', {
|
||||
name: this.widgetAdderSelected,
|
||||
id: uuid(),
|
||||
place: 'left',
|
||||
@ -237,12 +233,9 @@ export default Vue.extend({
|
||||
saveHome() {
|
||||
const left = this.widgets.left;
|
||||
const right = this.widgets.right;
|
||||
this.$store.commit('settings/setHome', left.concat(right));
|
||||
this.$store.commit('device/setHome', left.concat(right));
|
||||
for (const w of left) w.place = 'left';
|
||||
for (const w of right) w.place = 'right';
|
||||
this.$root.api('i/update_home', {
|
||||
home: this.home
|
||||
});
|
||||
},
|
||||
|
||||
done() {
|
||||
|
@ -35,7 +35,7 @@ export default Vue.extend({
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -21,7 +21,7 @@ export default Vue.extend({
|
||||
i18n: i18n('desktop/views/pages/tag.vue'),
|
||||
data() {
|
||||
return {
|
||||
makePromise: cursor => this.$root.api('notes/search_by_tag', {
|
||||
makePromise: cursor => this.$root.api('notes/search-by-tag', {
|
||||
limit: limit + 1,
|
||||
offset: cursor ? cursor : undefined,
|
||||
tag: this.$route.params.tag
|
||||
@ -35,7 +35,7 @@ export default Vue.extend({
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -58,7 +58,7 @@ export default Vue.extend({
|
||||
};
|
||||
|
||||
if (this.src == 'tag') {
|
||||
this.endpoint = 'notes/search_by_tag';
|
||||
this.endpoint = 'notes/search-by-tag';
|
||||
this.query = {
|
||||
query: this.tagTl.query
|
||||
};
|
||||
@ -113,12 +113,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -9,7 +9,7 @@
|
||||
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline"><fa icon="share-alt"/> {{ $t('hybrid') }}</span>
|
||||
<span :data-active="src == 'global'" @click="src = 'global'" v-if="enableGlobalTimeline"><fa icon="globe"/> {{ $t('global') }}</span>
|
||||
<span :data-active="src == 'tag'" @click="src = 'tag'" v-if="tagTl"><fa icon="hashtag"/> {{ tagTl.title }}</span>
|
||||
<span :data-active="src == 'list'" @click="src = 'list'" v-if="list"><fa icon="list"/> {{ list.title }}</span>
|
||||
<span :data-active="src == 'list'" @click="src = 'list'" v-if="list"><fa icon="list"/> {{ list.name }}</span>
|
||||
<div class="buttons">
|
||||
<button :data-active="src == 'mentions'" @click="src = 'mentions'" :title="$t('mentions')"><fa icon="at"/><i class="indicator" v-if="$store.state.i.hasUnreadMentions"><fa icon="circle"/></i></button>
|
||||
<button :data-active="src == 'messages'" @click="src = 'messages'" :title="$t('messages')"><fa :icon="['far', 'envelope']"/><i class="indicator" v-if="$store.state.i.hasUnreadSpecifiedNotes"><fa icon="circle"/></i></button>
|
||||
@ -143,7 +143,7 @@ export default Vue.extend({
|
||||
|
||||
menu = menu.concat(lists.map(list => ({
|
||||
icon: 'list',
|
||||
text: list.title,
|
||||
text: list.name,
|
||||
action: () => {
|
||||
this.list = list;
|
||||
this.src = 'list';
|
||||
|
@ -4,7 +4,7 @@
|
||||
<fa icon="exclamation-triangle"/> {{ $t('@.user-suspended') }}
|
||||
</div>
|
||||
<div class="is-remote" v-if="user.host != null" :class="{ shadow: $store.state.device.useShadow, round: $store.state.device.roundedCorners }">
|
||||
<fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a>
|
||||
<fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a>
|
||||
</div>
|
||||
<div class="main">
|
||||
<x-header class="header" :user="user"/>
|
||||
|
@ -36,8 +36,8 @@
|
||||
</dl>
|
||||
</div>
|
||||
<div class="info">
|
||||
<span class="location" v-if="user.host === null && user.profile.location"><fa icon="map-marker"/> {{ user.profile.location }}</span>
|
||||
<span class="birthday" v-if="user.host === null && user.profile.birthday"><fa icon="birthday-cake"/> {{ user.profile.birthday.replace('-', $t('year')).replace('-', $t('month')) + $t('day') }} ({{ $t('years-old', { age }) }})</span>
|
||||
<span class="location" v-if="user.host === null && user.location"><fa icon="map-marker"/> {{ user.location }}</span>
|
||||
<span class="birthday" v-if="user.host === null && user.birthday"><fa icon="birthday-cake"/> {{ user.birthday.replace('-', $t('year')).replace('-', $t('month')) + $t('day') }} ({{ $t('years-old', { age }) }})</span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<router-link :to="user | userPage()" class="notes-count"><b>{{ user.notesCount | number }}</b>{{ $t('posts') }}</router-link>
|
||||
@ -65,13 +65,13 @@ export default Vue.extend({
|
||||
style(): any {
|
||||
if (this.user.bannerUrl == null) return {};
|
||||
return {
|
||||
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
|
||||
backgroundColor: this.user.bannerColor,
|
||||
backgroundImage: `url(${ this.user.bannerUrl })`
|
||||
};
|
||||
},
|
||||
|
||||
age(): number {
|
||||
return age(this.user.profile.birthday);
|
||||
return age(this.user.birthday);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -42,12 +42,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: new Date(notes[notes.length - 1].createdAt).getTime()
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -13,8 +13,8 @@
|
||||
<div class="body">
|
||||
<div class="main block">
|
||||
<div>
|
||||
<h1 v-if="name != 'Misskey'">{{ name }}</h1>
|
||||
<h1 v-else><img svg-inline src="../../../../assets/title.svg" :alt="name"></h1>
|
||||
<h1 v-if="name != null">{{ name }}</h1>
|
||||
<h1 v-else><img svg-inline src="../../../../assets/title.svg" alt="Misskey"></h1>
|
||||
|
||||
<div class="info">
|
||||
<span><b>{{ host }}</b> - <span v-html="$t('powered-by-misskey')"></span></span>
|
||||
@ -87,7 +87,7 @@
|
||||
<div>
|
||||
<div v-if="meta" class="body">
|
||||
<p>Version: <b>{{ meta.version }}</b></p>
|
||||
<p>Maintainer: <b><a :href="'mailto:' + meta.maintainer.email" target="_blank">{{ meta.maintainer.name }}</a></b></p>
|
||||
<p>Maintainer: <b><a :href="'mailto:' + meta.maintainerEmail" target="_blank">{{ meta.maintainerName }}</a></b></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -162,7 +162,7 @@ export default Vue.extend({
|
||||
banner: null,
|
||||
copyright,
|
||||
host: toUnicode(host),
|
||||
name: 'Misskey',
|
||||
name: null,
|
||||
description: '',
|
||||
announcements: [],
|
||||
photos: []
|
||||
|
@ -15,15 +15,21 @@
|
||||
<b-form-group :description="$t('description')">
|
||||
<b-alert show variant="warning"><fa icon="exclamation-triangle"/> {{ $t('authority-warning') }}</b-alert>
|
||||
<b-form-checkbox-group v-model="permission" stacked>
|
||||
<b-form-checkbox value="account-read">{{ $t('account-read') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="account-write">{{ $t('account-write') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="note-write">{{ $t('note-write') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="reaction-write">{{ $t('reaction-write') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="following-write">{{ $t('following-write') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="drive-read">{{ $t('drive-read') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="drive-write">{{ $t('drive-write') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="notification-read">{{ $t('notification-read') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="notification-write">{{ $t('notification-write') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="read:account">{{ $t('read:account') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="write:account">{{ $t('write:account') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="write:notes">{{ $t('write:notes') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="read:reactions">{{ $t('read:reactions') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="write:reactions">{{ $t('write:reactions') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="read:following">{{ $t('read:following') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="write:following">{{ $t('write:following') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="read:mutes">{{ $t('read:mutes') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="write:mutes">{{ $t('write:mutes') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="read:blocks">{{ $t('read:blocks') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="write:blocks">{{ $t('write:blocks') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="read:drive">{{ $t('read:drive') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="write:drive">{{ $t('write:drive') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="read:notifications">{{ $t('read:notifications') }}</b-form-checkbox>
|
||||
<b-form-checkbox value="write:notifications">{{ $t('write:notifications') }}</b-form-checkbox>
|
||||
</b-form-checkbox-group>
|
||||
</b-form-group>
|
||||
</b-card>
|
||||
|
@ -28,7 +28,7 @@ export default class MiOS extends EventEmitter {
|
||||
};
|
||||
|
||||
public get instanceName() {
|
||||
return this.meta ? this.meta.data.name : 'Misskey';
|
||||
return this.meta ? (this.meta.data.name || 'Misskey') : 'Misskey';
|
||||
}
|
||||
|
||||
private isMetaFetching = false;
|
||||
@ -278,21 +278,6 @@ export default class MiOS extends EventEmitter {
|
||||
});
|
||||
});
|
||||
|
||||
main.on('homeUpdated', x => {
|
||||
this.store.commit('settings/setHome', x);
|
||||
});
|
||||
|
||||
main.on('mobileHomeUpdated', x => {
|
||||
this.store.commit('settings/setMobileHome', x);
|
||||
});
|
||||
|
||||
main.on('widgetUpdated', x => {
|
||||
this.store.commit('settings/updateWidget', {
|
||||
id: x.id,
|
||||
data: x.data
|
||||
});
|
||||
});
|
||||
|
||||
// トークンが再生成されたとき
|
||||
// このままではMisskeyが利用できないので強制的にサインアウトさせる
|
||||
main.on('myTokenRegenerated', () => {
|
||||
|
@ -22,7 +22,7 @@
|
||||
<div>
|
||||
<span class="type"><mk-file-type-icon :type="file.type"/> {{ file.type }}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="data-size">{{ file.datasize | bytes }}</span>
|
||||
<span class="data-size">{{ file.size | bytes }}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="created-at" @click="showCreatedAt"><fa :icon="['far', 'clock']"/><mk-time :time="file.createdAt"/></span>
|
||||
<template v-if="file.isSensitive">
|
||||
@ -85,8 +85,8 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
style(): any {
|
||||
return this.file.properties.avgColor && this.file.properties.avgColor.length == 3 ? {
|
||||
'background-color': `rgb(${ this.file.properties.avgColor.join(',') })`
|
||||
return this.file.properties.avgColor ? {
|
||||
'background-color': this.file.properties.avgColor
|
||||
} : {};
|
||||
},
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
<footer>
|
||||
<span class="type"><mk-file-type-icon :type="file.type"/>{{ file.type }}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="data-size">{{ file.datasize | bytes }}</span>
|
||||
<span class="data-size">{{ file.size | bytes }}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="created-at"><fa :icon="['far', 'clock']"/><mk-time :time="file.createdAt"/></span>
|
||||
<template v-if="file.isSensitive">
|
||||
|
@ -21,8 +21,8 @@
|
||||
</template>
|
||||
</component>
|
||||
|
||||
<footer v-if="cursor != null">
|
||||
<button @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
|
||||
<footer v-if="more">
|
||||
<button @click="fetchMore()" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
|
||||
<template v-if="!moreFetching">{{ $t('@.load-more') }}</template>
|
||||
<template v-if="moreFetching"><fa icon="spinner" pulse fixed-width/></template>
|
||||
</button>
|
||||
@ -53,7 +53,7 @@ export default Vue.extend({
|
||||
fetching: true,
|
||||
moreFetching: false,
|
||||
inited: false,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
},
|
||||
|
||||
@ -113,7 +113,7 @@ export default Vue.extend({
|
||||
this.notes = x;
|
||||
} else {
|
||||
this.notes = x.notes;
|
||||
this.cursor = x.cursor;
|
||||
this.more = x.more;
|
||||
}
|
||||
this.inited = true;
|
||||
this.fetching = false;
|
||||
@ -123,12 +123,12 @@ export default Vue.extend({
|
||||
});
|
||||
},
|
||||
|
||||
more() {
|
||||
if (this.cursor == null || this.moreFetching) return;
|
||||
fetchMore() {
|
||||
if (!this.more || this.moreFetching) return;
|
||||
this.moreFetching = true;
|
||||
this.makePromise(this.cursor).then(x => {
|
||||
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
|
||||
this.notes = this.notes.concat(x.notes);
|
||||
this.cursor = x.cursor;
|
||||
this.more = x.more;
|
||||
this.moreFetching = false;
|
||||
}, e => {
|
||||
this.moreFetching = false;
|
||||
@ -151,7 +151,7 @@ export default Vue.extend({
|
||||
// オーバーフローしたら古い投稿は捨てる
|
||||
if (this.notes.length >= displayLimit) {
|
||||
this.notes = this.notes.slice(0, displayLimit);
|
||||
this.cursor = this.notes[this.notes.length - 1].id
|
||||
this.more = true;
|
||||
}
|
||||
} else {
|
||||
this.queue.push(note);
|
||||
@ -182,7 +182,7 @@ export default Vue.extend({
|
||||
if (this.$el.offsetHeight == 0) return;
|
||||
|
||||
const current = window.scrollY + window.innerHeight;
|
||||
if (current > document.body.offsetHeight - 8) this.more();
|
||||
if (current > document.body.offsetHeight - 8) this.fetchMore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="notification.type == 'poll_vote'">
|
||||
<template v-if="notification.type == 'pollVote'">
|
||||
<mk-avatar class="avatar" :user="notification.user"/>
|
||||
<div class="text">
|
||||
<p><fa icon="chart-pie"/><mk-user-name :user="notification.user"/></p>
|
||||
|
@ -54,7 +54,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="notification poll_vote" v-if="notification.type == 'poll_vote'">
|
||||
<div class="notification pollVote" v-if="notification.type == 'pollVote'">
|
||||
<mk-avatar class="avatar" :user="notification.user"/>
|
||||
<div>
|
||||
<header>
|
||||
|
@ -21,13 +21,7 @@
|
||||
</div>
|
||||
<input v-show="useCw" ref="cw" v-model="cw" :placeholder="$t('annotations')" v-autocomplete="{ model: 'cw' }">
|
||||
<textarea v-model="text" ref="text" :disabled="posting" :placeholder="placeholder" v-autocomplete="{ model: 'text' }"></textarea>
|
||||
<div class="attaches" v-show="files.length != 0">
|
||||
<x-draggable class="files" :list="files" :options="{ animation: 150 }">
|
||||
<div class="file" v-for="file in files" :key="file.id">
|
||||
<div class="img" :style="`background-image: url(${file.thumbnailUrl})`" @click="detachMedia(file)"></div>
|
||||
</div>
|
||||
</x-draggable>
|
||||
</div>
|
||||
<x-post-form-attaches class="attaches" :files="files"/>
|
||||
<mk-poll-editor v-if="poll" ref="poll" @destroyed="poll = false" @updated="onPollUpdate()"/>
|
||||
<mk-uploader ref="uploader" @uploaded="attachMedia" @change="onChangeUploadings"/>
|
||||
<footer>
|
||||
@ -57,7 +51,6 @@
|
||||
import Vue from 'vue';
|
||||
import i18n from '../../../i18n';
|
||||
import insertTextAtCursor from 'insert-text-at-cursor';
|
||||
import * as XDraggable from 'vuedraggable';
|
||||
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
||||
import getFace from '../../../common/scripts/get-face';
|
||||
import { parse } from '../../../../../mfm/parse';
|
||||
@ -66,11 +59,12 @@ import { erase, unique } from '../../../../../prelude/array';
|
||||
import { length } from 'stringz';
|
||||
import { toASCII } from 'punycode';
|
||||
import extractMentions from '../../../../../misc/extract-mentions';
|
||||
import XPostFormAttaches from '../../../common/views/components/post-form-attaches.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('mobile/views/components/post-form.vue'),
|
||||
components: {
|
||||
XDraggable
|
||||
XPostFormAttaches
|
||||
},
|
||||
|
||||
props: {
|
||||
@ -264,8 +258,8 @@ export default Vue.extend({
|
||||
this.$emit('change-attached-files', this.files);
|
||||
},
|
||||
|
||||
detachMedia(file) {
|
||||
this.files = this.files.filter(x => x.id != file.id);
|
||||
detachMedia(id) {
|
||||
this.files = this.files.filter(x => x.id != id);
|
||||
this.$emit('change-attached-files', this.files);
|
||||
},
|
||||
|
||||
@ -481,32 +475,6 @@ export default Vue.extend({
|
||||
min-width 100%
|
||||
min-height 80px
|
||||
|
||||
> .attaches
|
||||
|
||||
> .files
|
||||
display block
|
||||
margin 0
|
||||
padding 4px
|
||||
list-style none
|
||||
|
||||
&:after
|
||||
content ""
|
||||
display block
|
||||
clear both
|
||||
|
||||
> .file
|
||||
display block
|
||||
float left
|
||||
margin 0
|
||||
padding 0
|
||||
border solid 4px transparent
|
||||
|
||||
> .img
|
||||
width 64px
|
||||
height 64px
|
||||
background-size cover
|
||||
background-position center center
|
||||
|
||||
> .mk-uploader
|
||||
margin 8px 0 0 0
|
||||
padding 8px
|
||||
|
@ -27,12 +27,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -27,12 +27,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: new Date(notes[notes.length - 1].createdAt).getTime()
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -8,7 +8,7 @@
|
||||
<mk-note-detail class="post" :note="favorite.note" :key="favorite.note.id"/>
|
||||
</template>
|
||||
</sequential-entrance>
|
||||
<ui-button v-if="existMore" @click="more">{{ $t('@.load-more') }}</ui-button>
|
||||
<ui-button v-if="existMore" @click="fetchMore()">{{ $t('@.load-more') }}</ui-button>
|
||||
</main>
|
||||
</mk-ui>
|
||||
</template>
|
||||
@ -53,7 +53,7 @@ export default Vue.extend({
|
||||
Progress.done();
|
||||
});
|
||||
},
|
||||
more() {
|
||||
fetchMore() {
|
||||
this.moreFetching = true;
|
||||
this.$root.api('i/favorites', {
|
||||
limit: 11,
|
||||
|
@ -59,7 +59,7 @@ export default Vue.extend({
|
||||
};
|
||||
|
||||
if (this.src == 'tag') {
|
||||
this.endpoint = 'notes/search_by_tag';
|
||||
this.endpoint = 'notes/search-by-tag';
|
||||
this.query = {
|
||||
query: this.tagTl.query
|
||||
};
|
||||
@ -114,12 +114,12 @@ export default Vue.extend({
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: notes[notes.length - 1].id
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -9,7 +9,7 @@
|
||||
<span v-if="src == 'global'"><fa icon="globe"/>{{ $t('global') }}</span>
|
||||
<span v-if="src == 'mentions'"><fa icon="at"/>{{ $t('mentions') }}</span>
|
||||
<span v-if="src == 'messages'"><fa :icon="['far', 'envelope']"/>{{ $t('messages') }}</span>
|
||||
<span v-if="src == 'list'"><fa icon="list"/>{{ list.title }}</span>
|
||||
<span v-if="src == 'list'"><fa icon="list"/>{{ list.name }}</span>
|
||||
<span v-if="src == 'tag'"><fa icon="hashtag"/>{{ tagTl.title }}</span>
|
||||
</span>
|
||||
<span style="margin-left:8px">
|
||||
|
@ -21,19 +21,19 @@ export default Vue.extend({
|
||||
return {
|
||||
makePromise: cursor => this.$root.api('notes/search', {
|
||||
limit: limit + 1,
|
||||
offset: cursor ? cursor : undefined,
|
||||
untilId: cursor ? cursor : undefined,
|
||||
query: this.q
|
||||
}).then(notes => {
|
||||
if (notes.length == limit + 1) {
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: cursor ? cursor + limit : limit
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -19,21 +19,21 @@ export default Vue.extend({
|
||||
i18n: i18n('mobile/views/pages/tag.vue'),
|
||||
data() {
|
||||
return {
|
||||
makePromise: cursor => this.$root.api('notes/search_by_tag', {
|
||||
makePromise: cursor => this.$root.api('notes/search-by-tag', {
|
||||
limit: limit + 1,
|
||||
offset: cursor ? cursor : undefined,
|
||||
untilId: cursor ? cursor : undefined,
|
||||
tag: this.$route.params.tag
|
||||
}).then(notes => {
|
||||
if (notes.length == limit + 1) {
|
||||
notes.pop();
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: cursor ? cursor + limit : limit
|
||||
more: true
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
notes: notes,
|
||||
cursor: null
|
||||
more: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<mk-ui>
|
||||
<template #header v-if="!fetching"><fa icon="list"/>{{ list.title }}</template>
|
||||
<template #header v-if="!fetching"><fa icon="list"/>{{ list.name }}</template>
|
||||
|
||||
<main v-if="!fetching">
|
||||
<x-editor :list="list"/>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<main>
|
||||
<ul>
|
||||
<li v-for="list in lists" :key="list.id"><router-link :to="`/i/lists/${list.id}`">{{ list.title }}</router-link></li>
|
||||
<li v-for="list in lists" :key="list.id"><router-link :to="`/i/lists/${list.id}`">{{ list.name }}</router-link></li>
|
||||
</ul>
|
||||
</main>
|
||||
</mk-ui>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="stream" v-if="!fetching && images.length > 0">
|
||||
<a v-for="(image, i) in images" :key="i"
|
||||
class="img"
|
||||
:style="`background-image: url(${thumbnail(image.media)})`"
|
||||
:style="`background-image: url(${thumbnail(image.file)})`"
|
||||
:href="image.note | notePage"
|
||||
></a>
|
||||
</div>
|
||||
@ -40,11 +40,11 @@ export default Vue.extend({
|
||||
untilDate: new Date().getTime() + 1000 * 86400 * 365
|
||||
}).then(notes => {
|
||||
for (const note of notes) {
|
||||
for (const media of note.media) {
|
||||
for (const file of note.files) {
|
||||
if (this.images.length < 9) {
|
||||
this.images.push({
|
||||
note,
|
||||
media
|
||||
file
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
</template>
|
||||
<div class="wwtwuxyh" v-if="!fetching">
|
||||
<div class="is-suspended" v-if="user.isSuspended"><p><fa icon="exclamation-triangle"/> {{ $t('@.user-suspended') }}</p></div>
|
||||
<div class="is-remote" v-if="user.host != null"><p><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a></p></div>
|
||||
<div class="is-remote" v-if="user.host != null"><p><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a></p></div>
|
||||
<header>
|
||||
<div class="banner" :style="style"></div>
|
||||
<div class="body">
|
||||
@ -36,11 +36,11 @@
|
||||
</dl>
|
||||
</div>
|
||||
<div class="info">
|
||||
<p class="location" v-if="user.host === null && user.profile.location">
|
||||
<fa icon="map-marker"/>{{ user.profile.location }}
|
||||
<p class="location" v-if="user.host === null && user.location">
|
||||
<fa icon="map-marker"/>{{ user.location }}
|
||||
</p>
|
||||
<p class="birthday" v-if="user.host === null && user.profile.birthday">
|
||||
<fa icon="birthday-cake"/>{{ user.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ $t('years-old', { age }) }})
|
||||
<p class="birthday" v-if="user.host === null && user.birthday">
|
||||
<fa icon="birthday-cake"/>{{ user.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ $t('years-old', { age }) }})
|
||||
</p>
|
||||
</div>
|
||||
<div class="status">
|
||||
@ -104,7 +104,7 @@ export default Vue.extend({
|
||||
},
|
||||
computed: {
|
||||
age(): number {
|
||||
return age(this.user.profile.birthday);
|
||||
return age(this.user.birthday);
|
||||
},
|
||||
avator(): string {
|
||||
return this.$store.state.device.disableShowingAnimatedImages
|
||||
@ -114,7 +114,7 @@ export default Vue.extend({
|
||||
style(): any {
|
||||
if (this.user.bannerUrl == null) return {};
|
||||
return {
|
||||
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
|
||||
backgroundColor: this.user.bannerColor,
|
||||
backgroundImage: `url(${ this.user.bannerUrl })`
|
||||
};
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
<div class="banner" :style="{ backgroundImage: banner ? `url(${banner})` : null }"></div>
|
||||
|
||||
<div>
|
||||
<img svg-inline src="../../../../assets/title.svg" :alt="name">
|
||||
<img svg-inline src="../../../../assets/title.svg" alt="Misskey">
|
||||
<p class="host">{{ host }}</p>
|
||||
<div class="about">
|
||||
<h2>{{ name }}</h2>
|
||||
<h2>{{ name || 'Misskey' }}</h2>
|
||||
<p v-html="description || this.$t('@.about')"></p>
|
||||
<router-link class="signup" to="/signup">{{ $t('@.signup') }}</router-link>
|
||||
</div>
|
||||
@ -62,7 +62,7 @@
|
||||
</article>
|
||||
<div class="info" v-if="meta">
|
||||
<p>Version: <b>{{ meta.version }}</b></p>
|
||||
<p>Maintainer: <b><a :href="'mailto:' + meta.maintainer.email" target="_blank">{{ meta.maintainer.name }}</a></b></p>
|
||||
<p>Maintainer: <b><a :href="'mailto:' + meta.maintainerEmail" target="_blank">{{ meta.maintainerName }}</a></b></p>
|
||||
</div>
|
||||
<footer>
|
||||
<small>{{ copyright }}</small>
|
||||
@ -87,7 +87,7 @@ export default Vue.extend({
|
||||
stats: null,
|
||||
banner: null,
|
||||
host: toUnicode(host),
|
||||
name: 'Misskey',
|
||||
name: null,
|
||||
description: '',
|
||||
photos: [],
|
||||
announcements: []
|
||||
|
@ -119,7 +119,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
addWidget() {
|
||||
this.$store.dispatch('settings/addMobileHomeWidget', {
|
||||
this.$store.commit('settings/addMobileHomeWidget', {
|
||||
name: this.widgetAdderSelected,
|
||||
id: uuid(),
|
||||
data: {}
|
||||
@ -127,14 +127,11 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
removeWidget(widget) {
|
||||
this.$store.dispatch('settings/removeMobileHomeWidget', widget);
|
||||
this.$store.commit('settings/removeMobileHomeWidget', widget);
|
||||
},
|
||||
|
||||
saveHome() {
|
||||
this.$store.commit('settings/setMobileHome', this.widgets);
|
||||
this.$root.api('i/update_mobile_home', {
|
||||
home: this.widgets
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -7,8 +7,6 @@ import { erase } from '../../prelude/array';
|
||||
import getNoteSummary from '../../misc/get-note-summary';
|
||||
|
||||
const defaultSettings = {
|
||||
home: null,
|
||||
mobileHome: [],
|
||||
keepCw: false,
|
||||
tagTimelines: [],
|
||||
fetchOnScroll: true,
|
||||
@ -41,6 +39,8 @@ const defaultSettings = {
|
||||
};
|
||||
|
||||
const defaultDeviceSettings = {
|
||||
home: null,
|
||||
mobileHome: [],
|
||||
deck: null,
|
||||
deckMode: false,
|
||||
deckColumnAlign: 'center',
|
||||
@ -120,7 +120,7 @@ export default (os: MiOS) => new Vuex.Store({
|
||||
actions: {
|
||||
login(ctx, i) {
|
||||
ctx.commit('updateI', i);
|
||||
ctx.dispatch('settings/merge', i.clientSettings);
|
||||
ctx.dispatch('settings/merge', i.clientData);
|
||||
},
|
||||
|
||||
logout(ctx) {
|
||||
@ -134,8 +134,8 @@ export default (os: MiOS) => new Vuex.Store({
|
||||
ctx.commit('updateIKeyValue', { key, value });
|
||||
}
|
||||
|
||||
if (me.clientSettings) {
|
||||
ctx.dispatch('settings/merge', me.clientSettings);
|
||||
if (me.clientData) {
|
||||
ctx.dispatch('settings/merge', me.clientData);
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -162,6 +162,48 @@ export default (os: MiOS) => new Vuex.Store({
|
||||
state.visibility = visibility;
|
||||
},
|
||||
|
||||
setHome(state, data) {
|
||||
state.home = data;
|
||||
},
|
||||
|
||||
addHomeWidget(state, widget) {
|
||||
state.home.unshift(widget);
|
||||
},
|
||||
|
||||
setMobileHome(state, data) {
|
||||
state.mobileHome = data;
|
||||
},
|
||||
|
||||
updateWidget(state, x) {
|
||||
let w;
|
||||
|
||||
//#region Desktop home
|
||||
if (state.home) {
|
||||
w = state.home.find(w => w.id == x.id);
|
||||
if (w) {
|
||||
w.data = x.data;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Mobile home
|
||||
if (state.mobileHome) {
|
||||
w = state.mobileHome.find(w => w.id == x.id);
|
||||
if (w) {
|
||||
w.data = x.data;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
},
|
||||
|
||||
addMobileHomeWidget(state, widget) {
|
||||
state.mobileHome.unshift(widget);
|
||||
},
|
||||
|
||||
removeMobileHomeWidget(state, widget) {
|
||||
state.mobileHome = state.mobileHome.filter(w => w.id != widget.id);
|
||||
},
|
||||
|
||||
addDeckColumn(state, column) {
|
||||
if (column.name == undefined) column.name = null;
|
||||
state.deck.columns.push(column);
|
||||
@ -301,48 +343,6 @@ export default (os: MiOS) => new Vuex.Store({
|
||||
set(state, x: { key: string; value: any }) {
|
||||
nestedProperty.set(state, x.key, x.value);
|
||||
},
|
||||
|
||||
setHome(state, data) {
|
||||
state.home = data;
|
||||
},
|
||||
|
||||
addHomeWidget(state, widget) {
|
||||
state.home.unshift(widget);
|
||||
},
|
||||
|
||||
setMobileHome(state, data) {
|
||||
state.mobileHome = data;
|
||||
},
|
||||
|
||||
updateWidget(state, x) {
|
||||
let w;
|
||||
|
||||
//#region Desktop home
|
||||
if (state.home) {
|
||||
w = state.home.find(w => w.id == x.id);
|
||||
if (w) {
|
||||
w.data = x.data;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Mobile home
|
||||
if (state.mobileHome) {
|
||||
w = state.mobileHome.find(w => w.id == x.id);
|
||||
if (w) {
|
||||
w.data = x.data;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
},
|
||||
|
||||
addMobileHomeWidget(state, widget) {
|
||||
state.mobileHome.unshift(widget);
|
||||
},
|
||||
|
||||
removeMobileHomeWidget(state, widget) {
|
||||
state.mobileHome = state.mobileHome.filter(w => w.id != widget.id);
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
@ -363,30 +363,6 @@ export default (os: MiOS) => new Vuex.Store({
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
addHomeWidget(ctx, widget) {
|
||||
ctx.commit('addHomeWidget', widget);
|
||||
|
||||
os.api('i/update_home', {
|
||||
home: ctx.state.home
|
||||
});
|
||||
},
|
||||
|
||||
addMobileHomeWidget(ctx, widget) {
|
||||
ctx.commit('addMobileHomeWidget', widget);
|
||||
|
||||
os.api('i/update_mobile_home', {
|
||||
home: ctx.state.mobileHome
|
||||
});
|
||||
},
|
||||
|
||||
removeMobileHomeWidget(ctx, widget) {
|
||||
ctx.commit('removeMobileHomeWidget', widget);
|
||||
|
||||
os.api('i/update_mobile_home', {
|
||||
home: ctx.state.mobileHome.filter(w => w.id != widget.id)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
kind: 'light',
|
||||
|
||||
vars: {
|
||||
primary: '#fb4e4e',
|
||||
primary: '#f18570',
|
||||
secondary: '#fff',
|
||||
text: '#666',
|
||||
},
|
||||
|
@ -25,11 +25,11 @@ export default function load() {
|
||||
|
||||
const mixin = {} as Mixin;
|
||||
|
||||
const url = validateUrl(config.url);
|
||||
const url = tryCreateUrl(config.url);
|
||||
|
||||
config.url = normalizeUrl(config.url);
|
||||
config.url = url.origin;
|
||||
|
||||
config.port = config.port || parseInt(process.env.PORT, 10);
|
||||
config.port = config.port || parseInt(process.env.PORT || '', 10);
|
||||
|
||||
mixin.host = url.host;
|
||||
mixin.hostname = url.hostname;
|
||||
@ -53,14 +53,3 @@ function tryCreateUrl(url: string) {
|
||||
throw `url="${url}" is not a valid URL.`;
|
||||
}
|
||||
}
|
||||
|
||||
function validateUrl(url: string) {
|
||||
const result = tryCreateUrl(url);
|
||||
if (result.pathname.replace('/', '').length) throw `url="${url}" is not a valid URL, has a pathname.`;
|
||||
if (!url.includes(result.host)) throw `url="${url}" is not a valid URL, has an invalid hostname.`;
|
||||
return result;
|
||||
}
|
||||
|
||||
function normalizeUrl(url: string) {
|
||||
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export type Source = {
|
||||
port: number;
|
||||
https?: { [x: string]: string };
|
||||
disableHsts?: boolean;
|
||||
mongodb: {
|
||||
db: {
|
||||
host: string;
|
||||
port: number;
|
||||
db: string;
|
||||
@ -42,6 +42,8 @@ export type Source = {
|
||||
accesslog?: string;
|
||||
|
||||
clusterLimit?: number;
|
||||
|
||||
id: string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,26 +1,28 @@
|
||||
import Note from '../models/note';
|
||||
import { MoreThanOrEqual, getRepository } from 'typeorm';
|
||||
import { Note } from '../models/entities/note';
|
||||
import { initDb } from '../db/postgre';
|
||||
|
||||
const interval = 5000;
|
||||
|
||||
async function tick() {
|
||||
const [all, local] = await Promise.all([Note.count({
|
||||
createdAt: {
|
||||
$gte: new Date(Date.now() - interval)
|
||||
}
|
||||
}), Note.count({
|
||||
createdAt: {
|
||||
$gte: new Date(Date.now() - interval)
|
||||
},
|
||||
'_user.host': null
|
||||
})]);
|
||||
initDb().then(() => {
|
||||
const Notes = getRepository(Note);
|
||||
|
||||
const stats = {
|
||||
all, local
|
||||
};
|
||||
async function tick() {
|
||||
const [all, local] = await Promise.all([Notes.count({
|
||||
createdAt: MoreThanOrEqual(new Date(Date.now() - interval))
|
||||
}), Notes.count({
|
||||
createdAt: MoreThanOrEqual(new Date(Date.now() - interval)),
|
||||
userHost: null
|
||||
})]);
|
||||
|
||||
process.send(stats);
|
||||
}
|
||||
const stats = {
|
||||
all, local
|
||||
};
|
||||
|
||||
tick();
|
||||
process.send!(stats);
|
||||
}
|
||||
|
||||
setInterval(tick, interval);
|
||||
tick();
|
||||
|
||||
setInterval(tick, interval);
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user