Implement remote account resolution
This commit is contained in:
parent
bee892d446
commit
68ce6d5748
73 changed files with 735 additions and 334 deletions
|
@ -134,6 +134,7 @@
|
||||||
"is-root": "2.0.0",
|
"is-root": "2.0.0",
|
||||||
"is-url": "1.2.3",
|
"is-url": "1.2.3",
|
||||||
"js-yaml": "3.11.0",
|
"js-yaml": "3.11.0",
|
||||||
|
"jsdom": "^11.6.2",
|
||||||
"license-checker": "18.0.0",
|
"license-checker": "18.0.0",
|
||||||
"loader-utils": "1.1.0",
|
"loader-utils": "1.1.0",
|
||||||
"mecab-async": "0.1.2",
|
"mecab-async": "0.1.2",
|
||||||
|
@ -156,6 +157,7 @@
|
||||||
"prominence": "0.2.0",
|
"prominence": "0.2.0",
|
||||||
"proxy-addr": "2.0.3",
|
"proxy-addr": "2.0.3",
|
||||||
"pug": "2.0.3",
|
"pug": "2.0.3",
|
||||||
|
"punycode": "^2.1.0",
|
||||||
"qrcode": "1.2.0",
|
"qrcode": "1.2.0",
|
||||||
"ratelimiter": "3.0.3",
|
"ratelimiter": "3.0.3",
|
||||||
"recaptcha-promise": "0.1.3",
|
"recaptcha-promise": "0.1.3",
|
||||||
|
@ -198,6 +200,7 @@
|
||||||
"vue-template-compiler": "2.5.16",
|
"vue-template-compiler": "2.5.16",
|
||||||
"vuedraggable": "2.16.0",
|
"vuedraggable": "2.16.0",
|
||||||
"web-push": "3.3.0",
|
"web-push": "3.3.0",
|
||||||
|
"webfinger.js": "^2.6.6",
|
||||||
"webpack": "4.2.0",
|
"webpack": "4.2.0",
|
||||||
"webpack-cli": "2.0.13",
|
"webpack-cli": "2.0.13",
|
||||||
"webpack-replace-loader": "1.3.0",
|
"webpack-replace-loader": "1.3.0",
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import * as EventEmitter from 'events';
|
import * as EventEmitter from 'events';
|
||||||
import * as bcrypt from 'bcryptjs';
|
import * as bcrypt from 'bcryptjs';
|
||||||
|
|
||||||
import User, { IUser, init as initUser } from '../models/user';
|
import User, { ILocalAccount, IUser, init as initUser } from '../models/user';
|
||||||
|
|
||||||
import getPostSummary from '../../common/get-post-summary';
|
import getPostSummary from '../../common/get-post-summary';
|
||||||
import getUserSummary from '../../common/get-user-summary';
|
import getUserSummary from '../../common/user/get-summary';
|
||||||
|
import parseAcct from '../../common/user/parse-acct';
|
||||||
import getNotificationSummary from '../../common/get-notification-summary';
|
import getNotificationSummary from '../../common/get-notification-summary';
|
||||||
|
|
||||||
const hmm = [
|
const hmm = [
|
||||||
|
@ -163,9 +164,7 @@ export default class BotCore extends EventEmitter {
|
||||||
|
|
||||||
public async showUserCommand(q: string): Promise<string> {
|
public async showUserCommand(q: string): Promise<string> {
|
||||||
try {
|
try {
|
||||||
const user = await require('../endpoints/users/show')({
|
const user = await require('../endpoints/users/show')(parseAcct(q.substr(1)), this.user);
|
||||||
username: q.substr(1)
|
|
||||||
}, this.user);
|
|
||||||
|
|
||||||
const text = getUserSummary(user);
|
const text = getUserSummary(user);
|
||||||
|
|
||||||
|
@ -209,7 +208,8 @@ class SigninContext extends Context {
|
||||||
if (this.temporaryUser == null) {
|
if (this.temporaryUser == null) {
|
||||||
// Fetch user
|
// Fetch user
|
||||||
const user: IUser = await User.findOne({
|
const user: IUser = await User.findOne({
|
||||||
username_lower: query.toLowerCase()
|
username_lower: query.toLowerCase(),
|
||||||
|
host: null
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
data: false
|
data: false
|
||||||
|
@ -225,7 +225,7 @@ class SigninContext extends Context {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Compare password
|
// Compare password
|
||||||
const same = await bcrypt.compare(query, this.temporaryUser.account.password);
|
const same = await bcrypt.compare(query, (this.temporaryUser.account as ILocalAccount).password);
|
||||||
|
|
||||||
if (same) {
|
if (same) {
|
||||||
this.bot.signin(this.temporaryUser);
|
this.bot.signin(this.temporaryUser);
|
||||||
|
|
|
@ -7,6 +7,8 @@ import config from '../../../conf';
|
||||||
import BotCore from '../core';
|
import BotCore from '../core';
|
||||||
import _redis from '../../../db/redis';
|
import _redis from '../../../db/redis';
|
||||||
import prominence = require('prominence');
|
import prominence = require('prominence');
|
||||||
|
import getAcct from '../../../common/user/get-acct';
|
||||||
|
import parseAcct from '../../../common/user/parse-acct';
|
||||||
import getPostSummary from '../../../common/get-post-summary';
|
import getPostSummary from '../../../common/get-post-summary';
|
||||||
|
|
||||||
const redis = prominence(_redis);
|
const redis = prominence(_redis);
|
||||||
|
@ -98,10 +100,9 @@ class LineBot extends BotCore {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async showUserCommand(q: string) {
|
public async showUserCommand(q: string) {
|
||||||
const user = await require('../../endpoints/users/show')({
|
const user = await require('../../endpoints/users/show')(parseAcct(q.substr(1)), this.user);
|
||||||
username: q.substr(1)
|
|
||||||
}, this.user);
|
|
||||||
|
|
||||||
|
const acct = getAcct(user);
|
||||||
const actions = [];
|
const actions = [];
|
||||||
|
|
||||||
actions.push({
|
actions.push({
|
||||||
|
@ -121,7 +122,7 @@ class LineBot extends BotCore {
|
||||||
actions.push({
|
actions.push({
|
||||||
type: 'uri',
|
type: 'uri',
|
||||||
label: 'Webで見る',
|
label: 'Webで見る',
|
||||||
uri: `${config.url}/@${user.username}`
|
uri: `${config.url}/@${acct}`
|
||||||
});
|
});
|
||||||
|
|
||||||
this.reply([{
|
this.reply([{
|
||||||
|
@ -130,7 +131,7 @@ class LineBot extends BotCore {
|
||||||
template: {
|
template: {
|
||||||
type: 'buttons',
|
type: 'buttons',
|
||||||
thumbnailImageUrl: `${user.avatar_url}?thumbnail&size=1024`,
|
thumbnailImageUrl: `${user.avatar_url}?thumbnail&size=1024`,
|
||||||
title: `${user.name} (@${user.username})`,
|
title: `${user.name} (@${acct})`,
|
||||||
text: user.description || '(no description)',
|
text: user.description || '(no description)',
|
||||||
actions: actions
|
actions: actions
|
||||||
}
|
}
|
||||||
|
@ -171,6 +172,7 @@ module.exports = async (app: express.Application) => {
|
||||||
|
|
||||||
if (session == null) {
|
if (session == null) {
|
||||||
const user = await User.findOne({
|
const user = await User.findOne({
|
||||||
|
host: null,
|
||||||
'account.line': {
|
'account.line': {
|
||||||
user_id: sourceId
|
user_id: sourceId
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,17 +10,18 @@ import * as debug from 'debug';
|
||||||
import fileType = require('file-type');
|
import fileType = require('file-type');
|
||||||
import prominence = require('prominence');
|
import prominence = require('prominence');
|
||||||
|
|
||||||
import DriveFile, { getGridFSBucket } from '../models/drive-file';
|
import DriveFile, { getGridFSBucket } from '../../models/drive-file';
|
||||||
import DriveFolder from '../models/drive-folder';
|
import DriveFolder from '../../models/drive-folder';
|
||||||
import { pack } from '../models/drive-file';
|
import { pack } from '../../models/drive-file';
|
||||||
import event, { publishDriveStream } from '../event';
|
import event, { publishDriveStream } from '../../event';
|
||||||
import config from '../../conf';
|
import getAcct from '../../../common/user/get-acct';
|
||||||
|
import config from '../../../conf';
|
||||||
|
|
||||||
const gm = _gm.subClass({
|
const gm = _gm.subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
|
|
||||||
const log = debug('misskey:register-drive-file');
|
const log = debug('misskey:drive:add-file');
|
||||||
|
|
||||||
const tmpFile = (): Promise<string> => new Promise((resolve, reject) => {
|
const tmpFile = (): Promise<string> => new Promise((resolve, reject) => {
|
||||||
tmp.file((e, path) => {
|
tmp.file((e, path) => {
|
||||||
|
@ -46,7 +47,7 @@ const addFile = async (
|
||||||
folderId: mongodb.ObjectID = null,
|
folderId: mongodb.ObjectID = null,
|
||||||
force: boolean = false
|
force: boolean = false
|
||||||
) => {
|
) => {
|
||||||
log(`registering ${name} (user: ${user.username}, path: ${path})`);
|
log(`registering ${name} (user: ${getAcct(user)}, path: ${path})`);
|
||||||
|
|
||||||
// Calculate hash, get content type and get file size
|
// Calculate hash, get content type and get file size
|
||||||
const [hash, [mime, ext], size] = await Promise.all([
|
const [hash, [mime, ext], size] = await Promise.all([
|
46
src/api/common/drive/upload_from_url.ts
Normal file
46
src/api/common/drive/upload_from_url.ts
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import * as URL from 'url';
|
||||||
|
import { IDriveFile, validateFileName } from '../../models/drive-file';
|
||||||
|
import create from './add-file';
|
||||||
|
import * as debug from 'debug';
|
||||||
|
import * as tmp from 'tmp';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as request from 'request';
|
||||||
|
|
||||||
|
const log = debug('misskey:common:drive:upload_from_url');
|
||||||
|
|
||||||
|
export default async (url, user, folderId = null): Promise<IDriveFile> => {
|
||||||
|
let name = URL.parse(url).pathname.split('/').pop();
|
||||||
|
if (!validateFileName(name)) {
|
||||||
|
name = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create temp file
|
||||||
|
const path = await new Promise((res: (string) => void, rej) => {
|
||||||
|
tmp.file((e, path) => {
|
||||||
|
if (e) return rej(e);
|
||||||
|
res(path);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// write content at URL to temp file
|
||||||
|
await new Promise((res, rej) => {
|
||||||
|
const writable = fs.createWriteStream(path);
|
||||||
|
request(url)
|
||||||
|
.on('error', rej)
|
||||||
|
.on('end', () => {
|
||||||
|
writable.close();
|
||||||
|
res(path);
|
||||||
|
})
|
||||||
|
.pipe(writable)
|
||||||
|
.on('error', rej);
|
||||||
|
});
|
||||||
|
|
||||||
|
const driveFile = await create(user, path, name, null, folderId);
|
||||||
|
|
||||||
|
// clean-up
|
||||||
|
fs.unlink(path, (e) => {
|
||||||
|
if (e) log(e.stack);
|
||||||
|
});
|
||||||
|
|
||||||
|
return driveFile;
|
||||||
|
};
|
5
src/api/common/get-host-lower.ts
Normal file
5
src/api/common/get-host-lower.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { toUnicode } from 'punycode';
|
||||||
|
|
||||||
|
export default host => {
|
||||||
|
return toUnicode(host).replace(/[A-Z]+/, match => match.toLowerCase());
|
||||||
|
};
|
|
@ -1,14 +1,17 @@
|
||||||
/**
|
/**
|
||||||
* Mention
|
* Mention
|
||||||
*/
|
*/
|
||||||
|
import parseAcct from '../../../../common/user/parse-acct';
|
||||||
|
|
||||||
module.exports = text => {
|
module.exports = text => {
|
||||||
const match = text.match(/^@[a-zA-Z0-9\-]+/);
|
const match = text.match(/^(?:@[a-zA-Z0-9\-]+){1,2}/);
|
||||||
if (!match) return null;
|
if (!match) return null;
|
||||||
const mention = match[0];
|
const mention = match[0];
|
||||||
|
const { username, host } = parseAcct(mention.substr(1));
|
||||||
return {
|
return {
|
||||||
type: 'mention',
|
type: 'mention',
|
||||||
content: mention,
|
content: mention,
|
||||||
username: mention.substr(1)
|
username,
|
||||||
|
host
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import { validateFileName, pack } from '../../../models/drive-file';
|
import { validateFileName, pack } from '../../../models/drive-file';
|
||||||
import create from '../../../common/add-file-to-drive';
|
import create from '../../../common/drive/add-file';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a file
|
* Create a file
|
||||||
|
|
|
@ -1,16 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import * as URL from 'url';
|
|
||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import { validateFileName, pack } from '../../../models/drive-file';
|
import { pack } from '../../../models/drive-file';
|
||||||
import create from '../../../common/add-file-to-drive';
|
import uploadFromUrl from '../../../common/drive/upload_from_url';
|
||||||
import * as debug from 'debug';
|
|
||||||
import * as tmp from 'tmp';
|
|
||||||
import * as fs from 'fs';
|
|
||||||
import * as request from 'request';
|
|
||||||
|
|
||||||
const log = debug('misskey:endpoint:upload_from_url');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a file from a URL
|
* Create a file from a URL
|
||||||
|
@ -25,42 +18,9 @@ module.exports = async (params, user): Promise<any> => {
|
||||||
const [url, urlErr] = $(params.url).string().$;
|
const [url, urlErr] = $(params.url).string().$;
|
||||||
if (urlErr) throw 'invalid url param';
|
if (urlErr) throw 'invalid url param';
|
||||||
|
|
||||||
let name = URL.parse(url).pathname.split('/').pop();
|
|
||||||
if (!validateFileName(name)) {
|
|
||||||
name = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get 'folder_id' parameter
|
// Get 'folder_id' parameter
|
||||||
const [folderId = null, folderIdErr] = $(params.folder_id).optional.nullable.id().$;
|
const [folderId = null, folderIdErr] = $(params.folder_id).optional.nullable.id().$;
|
||||||
if (folderIdErr) throw 'invalid folder_id param';
|
if (folderIdErr) throw 'invalid folder_id param';
|
||||||
|
|
||||||
// Create temp file
|
return pack(await uploadFromUrl(url, user, folderId));
|
||||||
const path = await new Promise((res: (string) => void, rej) => {
|
|
||||||
tmp.file((e, path) => {
|
|
||||||
if (e) return rej(e);
|
|
||||||
res(path);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// write content at URL to temp file
|
|
||||||
await new Promise((res, rej) => {
|
|
||||||
const writable = fs.createWriteStream(path);
|
|
||||||
request(url)
|
|
||||||
.on('error', rej)
|
|
||||||
.on('end', () => {
|
|
||||||
writable.close();
|
|
||||||
res(path);
|
|
||||||
})
|
|
||||||
.pipe(writable)
|
|
||||||
.on('error', rej);
|
|
||||||
});
|
|
||||||
|
|
||||||
const driveFile = await create(user, path, name, null, folderId);
|
|
||||||
|
|
||||||
// clean-up
|
|
||||||
fs.unlink(path, (e) => {
|
|
||||||
if (e) log(e.stack);
|
|
||||||
});
|
|
||||||
|
|
||||||
return pack(driveFile);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,7 @@ import $ from 'cafy';
|
||||||
import deepEqual = require('deep-equal');
|
import deepEqual = require('deep-equal');
|
||||||
import parse from '../../common/text';
|
import parse from '../../common/text';
|
||||||
import { default as Post, IPost, isValidText } from '../../models/post';
|
import { default as Post, IPost, isValidText } from '../../models/post';
|
||||||
import { default as User, IUser } from '../../models/user';
|
import { default as User, ILocalAccount, IUser } from '../../models/user';
|
||||||
import { default as Channel, IChannel } from '../../models/channel';
|
import { default as Channel, IChannel } from '../../models/channel';
|
||||||
import Following from '../../models/following';
|
import Following from '../../models/following';
|
||||||
import Mute from '../../models/mute';
|
import Mute from '../../models/mute';
|
||||||
|
@ -16,6 +16,8 @@ import { pack } from '../../models/post';
|
||||||
import notify from '../../common/notify';
|
import notify from '../../common/notify';
|
||||||
import watch from '../../common/watch-post';
|
import watch from '../../common/watch-post';
|
||||||
import event, { pushSw, publishChannelStream } from '../../event';
|
import event, { pushSw, publishChannelStream } from '../../event';
|
||||||
|
import getAcct from '../../../common/user/get-acct';
|
||||||
|
import parseAcct from '../../../common/user/parse-acct';
|
||||||
import config from '../../../conf';
|
import config from '../../../conf';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -390,7 +392,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// この投稿をWatchする
|
// この投稿をWatchする
|
||||||
if (user.account.settings.auto_watch !== false) {
|
if ((user.account as ILocalAccount).settings.auto_watch !== false) {
|
||||||
watch(user._id, reply);
|
watch(user._id, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +479,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||||
// Extract an '@' mentions
|
// Extract an '@' mentions
|
||||||
const atMentions = tokens
|
const atMentions = tokens
|
||||||
.filter(t => t.type == 'mention')
|
.filter(t => t.type == 'mention')
|
||||||
.map(m => m.username)
|
.map(getAcct)
|
||||||
// Drop dupulicates
|
// Drop dupulicates
|
||||||
.filter((v, i, s) => s.indexOf(v) == i);
|
.filter((v, i, s) => s.indexOf(v) == i);
|
||||||
|
|
||||||
|
@ -486,9 +488,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||||
// Fetch mentioned user
|
// Fetch mentioned user
|
||||||
// SELECT _id
|
// SELECT _id
|
||||||
const mentionee = await User
|
const mentionee = await User
|
||||||
.findOne({
|
.findOne(parseAcct(mention), { _id: true });
|
||||||
username_lower: mention.toLowerCase()
|
|
||||||
}, { _id: true });
|
|
||||||
|
|
||||||
// When mentioned user not found
|
// When mentioned user not found
|
||||||
if (mentionee == null) return;
|
if (mentionee == null) return;
|
||||||
|
|
|
@ -19,6 +19,7 @@ module.exports = async (params) => new Promise(async (res, rej) => {
|
||||||
// Get exist
|
// Get exist
|
||||||
const exist = await User
|
const exist = await User
|
||||||
.count({
|
.count({
|
||||||
|
host: null,
|
||||||
username_lower: username.toLowerCase()
|
username_lower: username.toLowerCase()
|
||||||
}, {
|
}, {
|
||||||
limit: 1
|
limit: 1
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
|
import getHostLower from '../../common/get-host-lower';
|
||||||
import Post, { pack } from '../../models/post';
|
import Post, { pack } from '../../models/post';
|
||||||
import User from '../../models/user';
|
import User from '../../models/user';
|
||||||
|
|
||||||
|
@ -22,7 +23,15 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||||
if (usernameErr) return rej('invalid username param');
|
if (usernameErr) return rej('invalid username param');
|
||||||
|
|
||||||
if (userId === undefined && username === undefined) {
|
if (userId === undefined && username === undefined) {
|
||||||
return rej('user_id or username is required');
|
return rej('user_id or pair of username and host is required');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get 'host' parameter
|
||||||
|
const [host, hostErr] = $(params.host).optional.string().$;
|
||||||
|
if (hostErr) return rej('invalid host param');
|
||||||
|
|
||||||
|
if (userId === undefined && host === undefined) {
|
||||||
|
return rej('user_id or pair of username and host is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get 'include_replies' parameter
|
// Get 'include_replies' parameter
|
||||||
|
@ -60,7 +69,7 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||||
|
|
||||||
const q = userId !== undefined
|
const q = userId !== undefined
|
||||||
? { _id: userId }
|
? { _id: userId }
|
||||||
: { username_lower: username.toLowerCase() } ;
|
: { username_lower: username.toLowerCase(), host_lower: getHostLower(host) } ;
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
const user = await User.findOne(q, {
|
const user = await User.findOne(q, {
|
||||||
|
|
|
@ -30,9 +30,15 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||||
_id: {
|
_id: {
|
||||||
$nin: followingIds
|
$nin: followingIds
|
||||||
},
|
},
|
||||||
|
$or: [
|
||||||
|
{
|
||||||
'account.last_used_at': {
|
'account.last_used_at': {
|
||||||
$gte: new Date(Date.now() - ms('7days'))
|
$gte: new Date(Date.now() - ms('7days'))
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
host: { $not: null }
|
||||||
|
}
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
limit: limit,
|
limit: limit,
|
||||||
skip: offset,
|
skip: offset,
|
||||||
|
|
|
@ -2,7 +2,49 @@
|
||||||
* Module dependencies
|
* Module dependencies
|
||||||
*/
|
*/
|
||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import User, { pack } from '../../models/user';
|
import { JSDOM } from 'jsdom';
|
||||||
|
import { toUnicode, toASCII } from 'punycode';
|
||||||
|
import uploadFromUrl from '../../common/drive/upload_from_url';
|
||||||
|
import User, { pack, validateUsername, isValidName, isValidDescription } from '../../models/user';
|
||||||
|
const request = require('request-promise-native');
|
||||||
|
const WebFinger = require('webfinger.js');
|
||||||
|
|
||||||
|
const webFinger = new WebFinger({});
|
||||||
|
|
||||||
|
async function getCollectionCount(url) {
|
||||||
|
if (!url) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const collection = await request({ url, json: true });
|
||||||
|
return collection ? collection.totalItems : null;
|
||||||
|
} catch (exception) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function findUser(q) {
|
||||||
|
return User.findOne(q, {
|
||||||
|
fields: {
|
||||||
|
data: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function webFingerAndVerify(query, verifier) {
|
||||||
|
return new Promise((res, rej) => webFinger.lookup(query, (error, result) => {
|
||||||
|
if (error) {
|
||||||
|
return rej(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.object.subject.toLowerCase().replace(/^acct:/, '') !== verifier) {
|
||||||
|
return rej('WebFinger verfification failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
res(result.object);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a user
|
* Show a user
|
||||||
|
@ -12,6 +54,8 @@ import User, { pack } from '../../models/user';
|
||||||
* @return {Promise<any>}
|
* @return {Promise<any>}
|
||||||
*/
|
*/
|
||||||
module.exports = (params, me) => new Promise(async (res, rej) => {
|
module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||||
|
let user;
|
||||||
|
|
||||||
// Get 'user_id' parameter
|
// Get 'user_id' parameter
|
||||||
const [userId, userIdErr] = $(params.user_id).optional.id().$;
|
const [userId, userIdErr] = $(params.user_id).optional.id().$;
|
||||||
if (userIdErr) return rej('invalid user_id param');
|
if (userIdErr) return rej('invalid user_id param');
|
||||||
|
@ -20,24 +64,143 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||||
const [username, usernameErr] = $(params.username).optional.string().$;
|
const [username, usernameErr] = $(params.username).optional.string().$;
|
||||||
if (usernameErr) return rej('invalid username param');
|
if (usernameErr) return rej('invalid username param');
|
||||||
|
|
||||||
if (userId === undefined && username === undefined) {
|
// Get 'host' parameter
|
||||||
return rej('user_id or username is required');
|
const [host, hostErr] = $(params.host).optional.string().$;
|
||||||
}
|
if (hostErr) return rej('invalid username param');
|
||||||
|
|
||||||
const q = userId !== undefined
|
if (userId === undefined && typeof username !== 'string') {
|
||||||
? { _id: userId }
|
return rej('user_id or pair of username and host is required');
|
||||||
: { username_lower: username.toLowerCase() };
|
}
|
||||||
|
|
||||||
// Lookup user
|
// Lookup user
|
||||||
const user = await User.findOne(q, {
|
if (typeof host === 'string') {
|
||||||
fields: {
|
const username_lower = username.toLowerCase();
|
||||||
data: false
|
const host_lower_ascii = toASCII(host).toLowerCase();
|
||||||
|
const host_lower = toUnicode(host_lower_ascii);
|
||||||
|
|
||||||
|
user = await findUser({ username_lower, host_lower });
|
||||||
|
|
||||||
|
if (user === null) {
|
||||||
|
const acct_lower = `${username_lower}@${host_lower_ascii}`;
|
||||||
|
let activityStreams;
|
||||||
|
let finger;
|
||||||
|
let followers_count;
|
||||||
|
let following_count;
|
||||||
|
let likes_count;
|
||||||
|
let posts_count;
|
||||||
|
|
||||||
|
if (!validateUsername(username)) {
|
||||||
|
return rej('username validation failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
finger = await webFingerAndVerify(acct_lower, acct_lower);
|
||||||
|
} catch (exception) {
|
||||||
|
return rej('WebFinger lookup failed');
|
||||||
|
}
|
||||||
|
|
||||||
|
const self = finger.links.find(link => link.rel && link.rel.toLowerCase() === 'self');
|
||||||
|
if (!self) {
|
||||||
|
return rej('WebFinger has no reference to self representation');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
activityStreams = await request({
|
||||||
|
url: self.href,
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/activity+json, application/ld+json'
|
||||||
|
},
|
||||||
|
json: true
|
||||||
});
|
});
|
||||||
|
} catch (exception) {
|
||||||
|
return rej('failed to retrieve ActivityStreams representation');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(activityStreams &&
|
||||||
|
(Array.isArray(activityStreams['@context']) ?
|
||||||
|
activityStreams['@context'].includes('https://www.w3.org/ns/activitystreams') :
|
||||||
|
activityStreams['@context'] === 'https://www.w3.org/ns/activitystreams') &&
|
||||||
|
activityStreams.type === 'Person' &&
|
||||||
|
typeof activityStreams.preferredUsername === 'string' &&
|
||||||
|
activityStreams.preferredUsername.toLowerCase() === username_lower &&
|
||||||
|
isValidName(activityStreams.name) &&
|
||||||
|
isValidDescription(activityStreams.summary)
|
||||||
|
)) {
|
||||||
|
return rej('failed ActivityStreams validation');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
[followers_count, following_count, likes_count, posts_count] = await Promise.all([
|
||||||
|
getCollectionCount(activityStreams.followers),
|
||||||
|
getCollectionCount(activityStreams.following),
|
||||||
|
getCollectionCount(activityStreams.liked),
|
||||||
|
getCollectionCount(activityStreams.outbox),
|
||||||
|
webFingerAndVerify(activityStreams.id, acct_lower),
|
||||||
|
]);
|
||||||
|
} catch (exception) {
|
||||||
|
return rej('failed to fetch assets');
|
||||||
|
}
|
||||||
|
|
||||||
|
const summaryDOM = JSDOM.fragment(activityStreams.summary);
|
||||||
|
|
||||||
|
// Create user
|
||||||
|
user = await User.insert({
|
||||||
|
avatar_id: null,
|
||||||
|
banner_id: null,
|
||||||
|
created_at: new Date(),
|
||||||
|
description: summaryDOM.textContent,
|
||||||
|
followers_count,
|
||||||
|
following_count,
|
||||||
|
name: activityStreams.name,
|
||||||
|
posts_count,
|
||||||
|
likes_count,
|
||||||
|
liked_count: 0,
|
||||||
|
drive_capacity: 1073741824, // 1GB
|
||||||
|
username: username,
|
||||||
|
username_lower,
|
||||||
|
host: toUnicode(finger.subject.replace(/^.*?@/, '')),
|
||||||
|
host_lower,
|
||||||
|
account: {
|
||||||
|
uri: activityStreams.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [icon, image] = await Promise.all([
|
||||||
|
activityStreams.icon,
|
||||||
|
activityStreams.image,
|
||||||
|
].map(async image => {
|
||||||
|
if (!image || image.type !== 'Image') {
|
||||||
|
return { _id: null };
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return await uploadFromUrl(image.url, user);
|
||||||
|
} catch (exception) {
|
||||||
|
return { _id: null };
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
User.update({ _id: user._id }, {
|
||||||
|
$set: {
|
||||||
|
avatar_id: icon._id,
|
||||||
|
banner_id: image._id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
user.avatar_id = icon._id;
|
||||||
|
user.banner_id = icon._id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const q = userId !== undefined
|
||||||
|
? { _id: userId }
|
||||||
|
: { username_lower: username.toLowerCase(), host: null };
|
||||||
|
|
||||||
|
user = await findUser(q);
|
||||||
|
|
||||||
if (user === null) {
|
if (user === null) {
|
||||||
return rej('user not found');
|
return rej('user not found');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Send response
|
// Send response
|
||||||
res(await pack(user, me, {
|
res(await pack(user, me, {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import * as debug from 'debug';
|
||||||
import limiterDB from '../db/redis';
|
import limiterDB from '../db/redis';
|
||||||
import { Endpoint } from './endpoints';
|
import { Endpoint } from './endpoints';
|
||||||
import { IAuthContext } from './authenticate';
|
import { IAuthContext } from './authenticate';
|
||||||
|
import getAcct from '../common/user/get-acct';
|
||||||
|
|
||||||
const log = debug('misskey:limitter');
|
const log = debug('misskey:limitter');
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ export default (endpoint: Endpoint, ctx: IAuthContext) => new Promise((ok, rejec
|
||||||
return reject('ERR');
|
return reject('ERR');
|
||||||
}
|
}
|
||||||
|
|
||||||
log(`@${ctx.user.username} ${endpoint.name} min remaining: ${info.remaining}`);
|
log(`@${getAcct(ctx.user)} ${endpoint.name} min remaining: ${info.remaining}`);
|
||||||
|
|
||||||
if (info.remaining === 0) {
|
if (info.remaining === 0) {
|
||||||
reject('BRIEF_REQUEST_INTERVAL');
|
reject('BRIEF_REQUEST_INTERVAL');
|
||||||
|
@ -70,7 +71,7 @@ export default (endpoint: Endpoint, ctx: IAuthContext) => new Promise((ok, rejec
|
||||||
return reject('ERR');
|
return reject('ERR');
|
||||||
}
|
}
|
||||||
|
|
||||||
log(`@${ctx.user.username} ${endpoint.name} max remaining: ${info.remaining}`);
|
log(`@${getAcct(ctx.user)} ${endpoint.name} max remaining: ${info.remaining}`);
|
||||||
|
|
||||||
if (info.remaining === 0) {
|
if (info.remaining === 0) {
|
||||||
reject('RATE_LIMIT_EXCEEDED');
|
reject('RATE_LIMIT_EXCEEDED');
|
||||||
|
|
|
@ -39,28 +39,7 @@ export function isValidBirthday(birthday: string): boolean {
|
||||||
return typeof birthday == 'string' && /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday);
|
return typeof birthday == 'string' && /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday);
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IUser = {
|
export type ILocalAccount = {
|
||||||
_id: mongo.ObjectID;
|
|
||||||
created_at: Date;
|
|
||||||
deleted_at: Date;
|
|
||||||
followers_count: number;
|
|
||||||
following_count: number;
|
|
||||||
name: string;
|
|
||||||
posts_count: number;
|
|
||||||
drive_capacity: number;
|
|
||||||
username: string;
|
|
||||||
username_lower: string;
|
|
||||||
avatar_id: mongo.ObjectID;
|
|
||||||
banner_id: mongo.ObjectID;
|
|
||||||
data: any;
|
|
||||||
description: string;
|
|
||||||
latest_post: IPost;
|
|
||||||
pinned_post_id: mongo.ObjectID;
|
|
||||||
is_suspended: boolean;
|
|
||||||
keywords: string[];
|
|
||||||
host: string;
|
|
||||||
host_lower: string;
|
|
||||||
account: {
|
|
||||||
keypair: string;
|
keypair: string;
|
||||||
email: string;
|
email: string;
|
||||||
links: string[];
|
links: string[];
|
||||||
|
@ -87,7 +66,34 @@ export type IUser = {
|
||||||
two_factor_enabled: boolean;
|
two_factor_enabled: boolean;
|
||||||
client_settings: any;
|
client_settings: any;
|
||||||
settings: any;
|
settings: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type IRemoteAccount = {
|
||||||
|
uri: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type IUser = {
|
||||||
|
_id: mongo.ObjectID;
|
||||||
|
created_at: Date;
|
||||||
|
deleted_at: Date;
|
||||||
|
followers_count: number;
|
||||||
|
following_count: number;
|
||||||
|
name: string;
|
||||||
|
posts_count: number;
|
||||||
|
drive_capacity: number;
|
||||||
|
username: string;
|
||||||
|
username_lower: string;
|
||||||
|
avatar_id: mongo.ObjectID;
|
||||||
|
banner_id: mongo.ObjectID;
|
||||||
|
data: any;
|
||||||
|
description: string;
|
||||||
|
latest_post: IPost;
|
||||||
|
pinned_post_id: mongo.ObjectID;
|
||||||
|
is_suspended: boolean;
|
||||||
|
keywords: string[];
|
||||||
|
host: string;
|
||||||
|
host_lower: string;
|
||||||
|
account: ILocalAccount | IRemoteAccount;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function init(user): IUser {
|
export function init(user): IUser {
|
||||||
|
@ -162,6 +168,7 @@ export const pack = (
|
||||||
// Remove needless properties
|
// Remove needless properties
|
||||||
delete _user.latest_post;
|
delete _user.latest_post;
|
||||||
|
|
||||||
|
if (!_user.host) {
|
||||||
// Remove private properties
|
// Remove private properties
|
||||||
delete _user.account.keypair;
|
delete _user.account.keypair;
|
||||||
delete _user.account.password;
|
delete _user.account.password;
|
||||||
|
@ -185,6 +192,7 @@ export const pack = (
|
||||||
if (!opts.detail) {
|
if (!opts.detail) {
|
||||||
delete _user.account.two_factor_enabled;
|
delete _user.account.two_factor_enabled;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_user.avatar_url = _user.avatar_id != null
|
_user.avatar_url = _user.avatar_id != null
|
||||||
? `${config.drive_url}/${_user.avatar_id}`
|
? `${config.drive_url}/${_user.avatar_id}`
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
import * as bcrypt from 'bcryptjs';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import * as speakeasy from 'speakeasy';
|
import * as speakeasy from 'speakeasy';
|
||||||
import { default as User, IUser } from '../models/user';
|
import { default as User, ILocalAccount, IUser } from '../models/user';
|
||||||
import Signin, { pack } from '../models/signin';
|
import Signin, { pack } from '../models/signin';
|
||||||
import event from '../event';
|
import event from '../event';
|
||||||
import signin from '../common/signin';
|
import signin from '../common/signin';
|
||||||
|
@ -32,7 +32,8 @@ export default async (req: express.Request, res: express.Response) => {
|
||||||
|
|
||||||
// Fetch user
|
// Fetch user
|
||||||
const user: IUser = await User.findOne({
|
const user: IUser = await User.findOne({
|
||||||
username_lower: username.toLowerCase()
|
username_lower: username.toLowerCase(),
|
||||||
|
host: null
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
data: false,
|
data: false,
|
||||||
|
@ -47,13 +48,15 @@ export default async (req: express.Request, res: express.Response) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const account = user.account as ILocalAccount;
|
||||||
|
|
||||||
// Compare password
|
// Compare password
|
||||||
const same = await bcrypt.compare(password, user.account.password);
|
const same = await bcrypt.compare(password, account.password);
|
||||||
|
|
||||||
if (same) {
|
if (same) {
|
||||||
if (user.account.two_factor_enabled) {
|
if (account.two_factor_enabled) {
|
||||||
const verified = (speakeasy as any).totp.verify({
|
const verified = (speakeasy as any).totp.verify({
|
||||||
secret: user.account.two_factor_secret,
|
secret: account.two_factor_secret,
|
||||||
encoding: 'base32',
|
encoding: 'base32',
|
||||||
token: token
|
token: token
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,7 +64,8 @@ export default async (req: express.Request, res: express.Response) => {
|
||||||
// Fetch exist user that same username
|
// Fetch exist user that same username
|
||||||
const usernameExist = await User
|
const usernameExist = await User
|
||||||
.count({
|
.count({
|
||||||
username_lower: username.toLowerCase()
|
username_lower: username.toLowerCase(),
|
||||||
|
host: null
|
||||||
}, {
|
}, {
|
||||||
limit: 1
|
limit: 1
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,6 +39,7 @@ module.exports = (app: express.Application) => {
|
||||||
if (userToken == null) return res.send('plz signin');
|
if (userToken == null) return res.send('plz signin');
|
||||||
|
|
||||||
const user = await User.findOneAndUpdate({
|
const user = await User.findOneAndUpdate({
|
||||||
|
host: null,
|
||||||
'account.token': userToken
|
'account.token': userToken
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
|
@ -126,6 +127,7 @@ module.exports = (app: express.Application) => {
|
||||||
const result = await twAuth.done(JSON.parse(ctx), req.query.oauth_verifier);
|
const result = await twAuth.done(JSON.parse(ctx), req.query.oauth_verifier);
|
||||||
|
|
||||||
const user = await User.findOne({
|
const user = await User.findOne({
|
||||||
|
host: null,
|
||||||
'account.twitter.user_id': result.userId
|
'account.twitter.user_id': result.userId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -148,6 +150,7 @@ module.exports = (app: express.Application) => {
|
||||||
const result = await twAuth.done(JSON.parse(ctx), verifier);
|
const result = await twAuth.done(JSON.parse(ctx), verifier);
|
||||||
|
|
||||||
const user = await User.findOneAndUpdate({
|
const user = await User.findOneAndUpdate({
|
||||||
|
host: null,
|
||||||
'account.token': userToken
|
'account.token': userToken
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
|
|
|
@ -94,6 +94,7 @@ function authenticate(token: string): Promise<IUser> {
|
||||||
// Fetch user
|
// Fetch user
|
||||||
const user: IUser = await User
|
const user: IUser = await User
|
||||||
.findOne({
|
.findOne({
|
||||||
|
host: null,
|
||||||
'account.token': token
|
'account.token': token
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
import { IUser } from '../api/models/user';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ユーザーを表す文字列を取得します。
|
|
||||||
* @param user ユーザー
|
|
||||||
*/
|
|
||||||
export default function(user: IUser): string {
|
|
||||||
return `${user.name} (@${user.username})\n` +
|
|
||||||
`${user.posts_count}投稿、${user.following_count}フォロー、${user.followers_count}フォロワー\n` +
|
|
||||||
`場所: ${user.account.profile.location}、誕生日: ${user.account.profile.birthday}\n` +
|
|
||||||
`「${user.description}」`;
|
|
||||||
}
|
|
3
src/common/user/get-acct.ts
Normal file
3
src/common/user/get-acct.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export default user => {
|
||||||
|
return user.host === null ? user.username : `${user.username}@${user.host}`;
|
||||||
|
};
|
18
src/common/user/get-summary.ts
Normal file
18
src/common/user/get-summary.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { ILocalAccount, IUser } from '../../api/models/user';
|
||||||
|
import getAcct from './get-acct';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ユーザーを表す文字列を取得します。
|
||||||
|
* @param user ユーザー
|
||||||
|
*/
|
||||||
|
export default function(user: IUser): string {
|
||||||
|
let string = `${user.name} (@${getAcct(user)})\n` +
|
||||||
|
`${user.posts_count}投稿、${user.following_count}フォロー、${user.followers_count}フォロワー\n`;
|
||||||
|
|
||||||
|
if (user.host === null) {
|
||||||
|
const account = user.account as ILocalAccount;
|
||||||
|
string += `場所: ${account.profile.location}、誕生日: ${account.profile.birthday}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return string + `「${user.description}」`;
|
||||||
|
}
|
4
src/common/user/parse-acct.ts
Normal file
4
src/common/user/parse-acct.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export default acct => {
|
||||||
|
const splitted = acct.split('@', 2);
|
||||||
|
return { username: splitted[0], host: splitted[1] || null };
|
||||||
|
};
|
|
@ -165,10 +165,10 @@
|
||||||
<mk-channel-post>
|
<mk-channel-post>
|
||||||
<header>
|
<header>
|
||||||
<a class="index" @click="reply">{ post.index }:</a>
|
<a class="index" @click="reply">{ post.index }:</a>
|
||||||
<a class="name" href={ _URL_ + '/@' + post.user.username }><b>{ post.user.name }</b></a>
|
<a class="name" href={ _URL_ + '/@' + acct }><b>{ post.user.name }</b></a>
|
||||||
<mk-time time={ post.created_at }/>
|
<mk-time time={ post.created_at }/>
|
||||||
<mk-time time={ post.created_at } mode="detail"/>
|
<mk-time time={ post.created_at } mode="detail"/>
|
||||||
<span>ID:<i>{ post.user.username }</i></span>
|
<span>ID:<i>{ acct }</i></span>
|
||||||
</header>
|
</header>
|
||||||
<div>
|
<div>
|
||||||
<a v-if="post.reply">>>{ post.reply.index }</a>
|
<a v-if="post.reply">>>{ post.reply.index }</a>
|
||||||
|
@ -229,8 +229,11 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
|
import getAcct from '../../../../common/user/get-acct';
|
||||||
|
|
||||||
this.post = this.opts.post;
|
this.post = this.opts.post;
|
||||||
this.form = this.opts.form;
|
this.form = this.opts.form;
|
||||||
|
this.acct = getAcct(this.post.user);
|
||||||
|
|
||||||
this.reply = () => {
|
this.reply = () => {
|
||||||
this.form.update({
|
this.form.update({
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<li v-for="user in users" @click="complete(type, user)" @keydown="onKeydown" tabindex="-1">
|
<li v-for="user in users" @click="complete(type, user)" @keydown="onKeydown" tabindex="-1">
|
||||||
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=32`" alt=""/>
|
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=32`" alt=""/>
|
||||||
<span class="name">{{ user.name }}</span>
|
<span class="name">{{ user.name }}</span>
|
||||||
<span class="username">@{{ user.username }}</span>
|
<span class="username">@{{ getAcct(user) }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<ol class="emojis" ref="suggests" v-if="emojis.length > 0">
|
<ol class="emojis" ref="suggests" v-if="emojis.length > 0">
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import * as emojilib from 'emojilib';
|
import * as emojilib from 'emojilib';
|
||||||
import contains from '../../../common/scripts/contains';
|
import contains from '../../../common/scripts/contains';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
const lib = Object.entries(emojilib.lib).filter((x: any) => {
|
const lib = Object.entries(emojilib.lib).filter((x: any) => {
|
||||||
return x[1].category != 'flags';
|
return x[1].category != 'flags';
|
||||||
|
@ -105,6 +106,7 @@ export default Vue.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAcct,
|
||||||
exec() {
|
exec() {
|
||||||
this.select = -1;
|
this.select = -1;
|
||||||
if (this.$refs.suggests) {
|
if (this.$refs.suggests) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="message" :data-is-me="isMe">
|
<div class="message" :data-is-me="isMe">
|
||||||
<router-link class="avatar-anchor" :to="`/@${message.user.username}`" :title="message.user.username" target="_blank">
|
<router-link class="avatar-anchor" :to="`/@${acct}`" :title="acct" target="_blank">
|
||||||
<img class="avatar" :src="`${message.user.avatar_url}?thumbnail&size=80`" alt=""/>
|
<img class="avatar" :src="`${message.user.avatar_url}?thumbnail&size=80`" alt=""/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -34,10 +34,14 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['message'],
|
props: ['message'],
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.message.user);
|
||||||
|
},
|
||||||
isMe(): boolean {
|
isMe(): boolean {
|
||||||
return this.message.user_id == (this as any).os.i.id;
|
return this.message.user_id == (this as any).os.i.id;
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
>
|
>
|
||||||
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=32`" alt=""/>
|
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=32`" alt=""/>
|
||||||
<span class="name">{{ user.name }}</span>
|
<span class="name">{{ user.name }}</span>
|
||||||
<span class="username">@{{ user.username }}</span>
|
<span class="username">@{{ getAcct(user) }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<template>
|
<template>
|
||||||
<a v-for="message in messages"
|
<a v-for="message in messages"
|
||||||
class="user"
|
class="user"
|
||||||
:href="`/i/messaging/${isMe(message) ? message.recipient.username : message.user.username}`"
|
:href="`/i/messaging/${getAcct(isMe(message) ? message.recipient : message.user)}`"
|
||||||
:data-is-me="isMe(message)"
|
:data-is-me="isMe(message)"
|
||||||
:data-is-read="message.is_read"
|
:data-is-read="message.is_read"
|
||||||
@click.prevent="navigate(isMe(message) ? message.recipient : message.user)"
|
@click.prevent="navigate(isMe(message) ? message.recipient : message.user)"
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<img class="avatar" :src="`${isMe(message) ? message.recipient.avatar_url : message.user.avatar_url}?thumbnail&size=64`" alt=""/>
|
<img class="avatar" :src="`${isMe(message) ? message.recipient.avatar_url : message.user.avatar_url}?thumbnail&size=64`" alt=""/>
|
||||||
<header>
|
<header>
|
||||||
<span class="name">{{ isMe(message) ? message.recipient.name : message.user.name }}</span>
|
<span class="name">{{ isMe(message) ? message.recipient.name : message.user.name }}</span>
|
||||||
<span class="username">@{{ isMe(message) ? message.recipient.username : message.user.username }}</span>
|
<span class="username">@{{ getAcct(isMe(message) ? message.recipient : message.user) }}</span>
|
||||||
<mk-time :time="message.created_at"/>
|
<mk-time :time="message.created_at"/>
|
||||||
</header>
|
</header>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
|
@ -92,6 +93,7 @@ export default Vue.extend({
|
||||||
(this as any).os.streams.messagingIndexStream.dispose(this.connectionId);
|
(this as any).os.streams.messagingIndexStream.dispose(this.connectionId);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAcct,
|
||||||
isMe(message) {
|
isMe(message) {
|
||||||
return message.user_id == (this as any).os.i.id;
|
return message.user_id == (this as any).os.i.id;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import * as emojilib from 'emojilib';
|
import * as emojilib from 'emojilib';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
import { url } from '../../../config';
|
import { url } from '../../../config';
|
||||||
import MkUrl from './url.vue';
|
import MkUrl from './url.vue';
|
||||||
|
|
||||||
|
@ -61,9 +62,9 @@ export default Vue.component('mk-post-html', {
|
||||||
case 'mention':
|
case 'mention':
|
||||||
return (createElement as any)('a', {
|
return (createElement as any)('a', {
|
||||||
attrs: {
|
attrs: {
|
||||||
href: `${url}/@${token.username}`,
|
href: `${url}/@${getAcct(token)}`,
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
dataIsMe: (this as any).i && (this as any).i.username == token.username
|
dataIsMe: (this as any).i && getAcct((this as any).i) == getAcct(token)
|
||||||
},
|
},
|
||||||
directives: [{
|
directives: [{
|
||||||
name: 'user-preview',
|
name: 'user-preview',
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-welcome-timeline">
|
<div class="mk-welcome-timeline">
|
||||||
<div v-for="post in posts">
|
<div v-for="post in posts">
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`" v-user-preview="post.user.id">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(post.user)}`" v-user-preview="post.user.id">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=96`" alt="avatar"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=96`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${post.user.username}`" v-user-preview="post.user.id">{{ post.user.name }}</router-link>
|
<router-link class="name" :to="`/@${getAcct(post.user)}`" v-user-preview="post.user.id">{{ post.user.name }}</router-link>
|
||||||
<span class="username">@{{ post.user.username }}</span>
|
<span class="username">@{{ getAcct(post.user) }}</span>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<router-link class="created-at" :to="`/@${post.user.username}/${post.id}`">
|
<router-link class="created-at" :to="`/@${getAcct(post.user)}/${post.id}`">
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
|
@ -36,6 +37,7 @@ export default Vue.extend({
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAcct,
|
||||||
fetch(cb?) {
|
fetch(cb?) {
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
(this as any).api('posts', {
|
(this as any).api('posts', {
|
||||||
|
|
|
@ -49,7 +49,7 @@ init(async (launch) => {
|
||||||
routes: [
|
routes: [
|
||||||
{ path: '/', name: 'index', component: MkIndex },
|
{ path: '/', name: 'index', component: MkIndex },
|
||||||
{ path: '/i/customize-home', component: MkHomeCustomize },
|
{ path: '/i/customize-home', component: MkHomeCustomize },
|
||||||
{ path: '/i/messaging/:username', component: MkMessagingRoom },
|
{ path: '/i/messaging/:user', component: MkMessagingRoom },
|
||||||
{ path: '/i/drive', component: MkDrive },
|
{ path: '/i/drive', component: MkDrive },
|
||||||
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
||||||
{ path: '/selectdrive', component: MkSelectDrive },
|
{ path: '/selectdrive', component: MkSelectDrive },
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
<p class="title">気になるユーザーをフォロー:</p>
|
<p class="title">気になるユーザーをフォロー:</p>
|
||||||
<div class="users" v-if="!fetching && users.length > 0">
|
<div class="users" v-if="!fetching && users.length > 0">
|
||||||
<div class="user" v-for="user in users" :key="user.id">
|
<div class="user" v-for="user in users" :key="user.id">
|
||||||
<router-link class="avatar-anchor" :to="`/@${user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(user)}`">
|
||||||
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="user.id"/>
|
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="user.id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<router-link class="name" :to="`/@${user.username}`" v-user-preview="user.id">{{ user.name }}</router-link>
|
<router-link class="name" :to="`/@${getAcct(user)}`" v-user-preview="user.id">{{ user.name }}</router-link>
|
||||||
<p class="username">@{{ user.username }}</p>
|
<p class="username">@{{ getAcct(user) }}</p>
|
||||||
</div>
|
</div>
|
||||||
<mk-follow-button :user="user"/>
|
<mk-follow-button :user="user"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -35,6 +37,7 @@ export default Vue.extend({
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAcct,
|
||||||
fetch() {
|
fetch() {
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
this.users = [];
|
this.users = [];
|
||||||
|
|
|
@ -8,12 +8,13 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { url } from '../../../config';
|
import { url } from '../../../config';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
computed: {
|
computed: {
|
||||||
popout(): string {
|
popout(): string {
|
||||||
return `${url}/i/messaging/${this.user.username}`;
|
return `${url}/i/messaging/${getAcct(this.user)}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,82 +5,82 @@
|
||||||
<div class="notification" :class="notification.type" :key="notification.id">
|
<div class="notification" :class="notification.type" :key="notification.id">
|
||||||
<mk-time :time="notification.created_at"/>
|
<mk-time :time="notification.created_at"/>
|
||||||
<template v-if="notification.type == 'reaction'">
|
<template v-if="notification.type == 'reaction'">
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.user.username}`" v-user-preview="notification.user.id">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">
|
||||||
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>
|
<p>
|
||||||
<mk-reaction-icon :reaction="notification.reaction"/>
|
<mk-reaction-icon :reaction="notification.reaction"/>
|
||||||
<router-link :to="`/@${notification.user.username}`" v-user-preview="notification.user.id">{{ notification.user.name }}</router-link>
|
<router-link :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ notification.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
<router-link class="post-ref" :to="`/@${notification.post.user.username}/${notification.post.id}`">
|
<router-link class="post-ref" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">
|
||||||
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
|
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="notification.type == 'repost'">
|
<template v-if="notification.type == 'repost'">
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.post.user.username}`" v-user-preview="notification.post.user_id">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.user_id">
|
||||||
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>%fa:retweet%
|
<p>%fa:retweet%
|
||||||
<router-link :to="`/@${notification.post.user.username}`" v-user-preview="notification.post.user_id">{{ notification.post.user.name }}</router-link>
|
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.user_id">{{ notification.post.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
<router-link class="post-ref" :to="`/@${notification.post.user.username}/${notification.post.id}`">
|
<router-link class="post-ref" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">
|
||||||
%fa:quote-left%{{ getPostSummary(notification.post.repost) }}%fa:quote-right%
|
%fa:quote-left%{{ getPostSummary(notification.post.repost) }}%fa:quote-right%
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="notification.type == 'quote'">
|
<template v-if="notification.type == 'quote'">
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.post.user.username}`" v-user-preview="notification.post.user_id">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.user_id">
|
||||||
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>%fa:quote-left%
|
<p>%fa:quote-left%
|
||||||
<router-link :to="`/@${notification.post.user.username}`" v-user-preview="notification.post.user_id">{{ notification.post.user.name }}</router-link>
|
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.user_id">{{ notification.post.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
<router-link class="post-preview" :to="`/@${notification.post.user.username}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</router-link>
|
<router-link class="post-preview" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</router-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="notification.type == 'follow'">
|
<template v-if="notification.type == 'follow'">
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.user.username}`" v-user-preview="notification.user.id">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">
|
||||||
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>%fa:user-plus%
|
<p>%fa:user-plus%
|
||||||
<router-link :to="`/@${notification.user.username}`" v-user-preview="notification.user.id">{{ notification.user.name }}</router-link>
|
<router-link :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ notification.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="notification.type == 'reply'">
|
<template v-if="notification.type == 'reply'">
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.post.user.username}`" v-user-preview="notification.post.user_id">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.user_id">
|
||||||
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>%fa:reply%
|
<p>%fa:reply%
|
||||||
<router-link :to="`/@${notification.post.user.username}`" v-user-preview="notification.post.user_id">{{ notification.post.user.name }}</router-link>
|
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.user_id">{{ notification.post.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
<router-link class="post-preview" :to="`/@${notification.post.user.username}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</router-link>
|
<router-link class="post-preview" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</router-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="notification.type == 'mention'">
|
<template v-if="notification.type == 'mention'">
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.post.user.username}`" v-user-preview="notification.post.user_id">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.user_id">
|
||||||
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>%fa:at%
|
<p>%fa:at%
|
||||||
<router-link :to="`/@${notification.post.user.username}`" v-user-preview="notification.post.user_id">{{ notification.post.user.name }}</router-link>
|
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.user_id">{{ notification.post.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
<a class="post-preview" :href="`/@${notification.post.user.username}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</a>
|
<a class="post-preview" :href="`/@${getAcct(notification.post.user)}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</a>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="notification.type == 'poll_vote'">
|
<template v-if="notification.type == 'poll_vote'">
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.user.username}`" v-user-preview="notification.user.id">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">
|
||||||
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=48`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>%fa:chart-pie%<a :href="`/@${notification.user.username}`" v-user-preview="notification.user.id">{{ notification.user.name }}</a></p>
|
<p>%fa:chart-pie%<a :href="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ notification.user.name }}</a></p>
|
||||||
<router-link class="post-ref" :to="`/@${notification.post.user.username}/${notification.post.id}`">
|
<router-link class="post-ref" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">
|
||||||
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
|
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,6 +102,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
import getPostSummary from '../../../../../common/get-post-summary';
|
import getPostSummary from '../../../../../common/get-post-summary';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
@ -152,6 +153,7 @@ export default Vue.extend({
|
||||||
(this as any).os.stream.dispose(this.connectionId);
|
(this as any).os.stream.dispose(this.connectionId);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAcct,
|
||||||
fetchMoreNotifications() {
|
fetchMoreNotifications() {
|
||||||
this.fetchingMoreNotifications = true;
|
this.fetchingMoreNotifications = true;
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="sub" :title="title">
|
<div class="sub" :title="title">
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="post.user_id"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="post.user_id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<router-link class="name" :to="`/@${post.user.username}`" v-user-preview="post.user_id">{{ post.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.user_id">{{ post.user.name }}</router-link>
|
||||||
<span class="username">@{{ post.user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<router-link class="time" :to="`/@${post.user.username}/${post.id}`">
|
<router-link class="time" :to="`/@${acct}/${post.id}`">
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,10 +28,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import dateStringify from '../../../common/scripts/date-stringify';
|
import dateStringify from '../../../common/scripts/date-stringify';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['post'],
|
props: ['post'],
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
},
|
||||||
title(): string {
|
title(): string {
|
||||||
return dateStringify(this.post.created_at);
|
return dateStringify(this.post.created_at);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,22 +18,22 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="repost" v-if="isRepost">
|
<div class="repost" v-if="isRepost">
|
||||||
<p>
|
<p>
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`" v-user-preview="post.user_id">
|
<router-link class="avatar-anchor" :to="`/@${acct}`" v-user-preview="post.user_id">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=32`" alt="avatar"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=32`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
%fa:retweet%
|
%fa:retweet%
|
||||||
<router-link class="name" :href="`/@${post.user.username}`">{{ post.user.name }}</router-link>
|
<router-link class="name" :href="`/@${acct}`">{{ post.user.name }}</router-link>
|
||||||
がRepost
|
がRepost
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<article>
|
<article>
|
||||||
<router-link class="avatar-anchor" :to="`/@${p.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="p.user.id"/>
|
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="p.user.id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${p.user.username}`" v-user-preview="p.user.id">{{ p.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`" v-user-preview="p.user.id">{{ p.user.name }}</router-link>
|
||||||
<span class="username">@{{ p.user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
<router-link class="time" :to="`/@${p.user.username}/${p.id}`">
|
<router-link class="time" :to="`/@${acct}/${p.id}`">
|
||||||
<mk-time :time="p.created_at"/>
|
<mk-time :time="p.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</header>
|
</header>
|
||||||
|
@ -78,6 +78,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import dateStringify from '../../../common/scripts/date-stringify';
|
import dateStringify from '../../../common/scripts/date-stringify';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
import MkPostFormWindow from './post-form-window.vue';
|
import MkPostFormWindow from './post-form-window.vue';
|
||||||
import MkRepostFormWindow from './repost-form-window.vue';
|
import MkRepostFormWindow from './repost-form-window.vue';
|
||||||
|
@ -98,6 +99,11 @@ export default Vue.extend({
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
context: [],
|
context: [],
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-post-preview" :title="title">
|
<div class="mk-post-preview" :title="title">
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="post.user_id"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="post.user_id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${post.user.username}`" v-user-preview="post.user_id">{{ post.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.user_id">{{ post.user.name }}</router-link>
|
||||||
<span class="username">@{{ post.user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
<router-link class="time" :to="`/@${post.user.username}/${post.id}`">
|
<router-link class="time" :to="`/@${acct}/${post.id}`">
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</header>
|
</header>
|
||||||
|
@ -21,10 +21,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import dateStringify from '../../../common/scripts/date-stringify';
|
import dateStringify from '../../../common/scripts/date-stringify';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['post'],
|
props: ['post'],
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
},
|
||||||
title(): string {
|
title(): string {
|
||||||
return dateStringify(this.post.created_at);
|
return dateStringify(this.post.created_at);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="sub" :title="title">
|
<div class="sub" :title="title">
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="post.user_id"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="post.user_id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${post.user.username}`" v-user-preview="post.user_id">{{ post.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.user_id">{{ post.user.name }}</router-link>
|
||||||
<span class="username">@{{ post.user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
<router-link class="created-at" :to="`/@${post.user.username}/${post.id}`">
|
<router-link class="created-at" :to="`/@${acct}/${post.id}`">
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</header>
|
</header>
|
||||||
|
@ -21,10 +21,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import dateStringify from '../../../common/scripts/date-stringify';
|
import dateStringify from '../../../common/scripts/date-stringify';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['post'],
|
props: ['post'],
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
},
|
||||||
title(): string {
|
title(): string {
|
||||||
return dateStringify(this.post.created_at);
|
return dateStringify(this.post.created_at);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,25 +5,25 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="repost" v-if="isRepost">
|
<div class="repost" v-if="isRepost">
|
||||||
<p>
|
<p>
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`" v-user-preview="post.user_id">
|
<router-link class="avatar-anchor" :to="`/@${acct}`" v-user-preview="post.user_id">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=32`" alt="avatar"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=32`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
%fa:retweet%
|
%fa:retweet%
|
||||||
<span>{{ '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('{')) }}</span>
|
<span>{{ '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('{')) }}</span>
|
||||||
<a class="name" :href="`/@${post.user.username}`" v-user-preview="post.user_id">{{ post.user.name }}</a>
|
<a class="name" :href="`/@${acct}`" v-user-preview="post.user_id">{{ post.user.name }}</a>
|
||||||
<span>{{ '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr('%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1) }}</span>
|
<span>{{ '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr('%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1) }}</span>
|
||||||
</p>
|
</p>
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</div>
|
</div>
|
||||||
<article>
|
<article>
|
||||||
<router-link class="avatar-anchor" :to="`/@${p.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="p.user.id"/>
|
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=64`" alt="avatar" v-user-preview="p.user.id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${p.user.username}`" v-user-preview="p.user.id">{{ p.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`" v-user-preview="p.user.id">{{ acct }}</router-link>
|
||||||
<span class="is-bot" v-if="p.user.account.is_bot">bot</span>
|
<span class="is-bot" v-if="p.user.host === null && p.user.account.is_bot">bot</span>
|
||||||
<span class="username">@{{ p.user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
|
<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
|
||||||
<span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
|
<span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
|
||||||
|
@ -85,6 +85,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import dateStringify from '../../../common/scripts/date-stringify';
|
import dateStringify from '../../../common/scripts/date-stringify';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
import MkPostFormWindow from './post-form-window.vue';
|
import MkPostFormWindow from './post-form-window.vue';
|
||||||
import MkRepostFormWindow from './repost-form-window.vue';
|
import MkRepostFormWindow from './repost-form-window.vue';
|
||||||
import MkPostMenu from '../../../common/views/components/post-menu.vue';
|
import MkPostMenu from '../../../common/views/components/post-menu.vue';
|
||||||
|
@ -115,6 +116,9 @@ export default Vue.extend({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.p.user);
|
||||||
|
},
|
||||||
isRepost(): boolean {
|
isRepost(): boolean {
|
||||||
return (this.post.repost &&
|
return (this.post.repost &&
|
||||||
this.post.text == null &&
|
this.post.text == null &&
|
||||||
|
@ -135,7 +139,7 @@ export default Vue.extend({
|
||||||
return dateStringify(this.p.created_at);
|
return dateStringify(this.p.created_at);
|
||||||
},
|
},
|
||||||
url(): string {
|
url(): string {
|
||||||
return `/@${this.p.user.username}/${this.p.id}`;
|
return `/@${this.acct}/${this.p.id}`;
|
||||||
},
|
},
|
||||||
urls(): string[] {
|
urls(): string[] {
|
||||||
if (this.p.ast) {
|
if (this.p.ast) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="users" v-if="users.length != 0">
|
<div class="users" v-if="users.length != 0">
|
||||||
<div v-for="user in users" :key="user.id">
|
<div v-for="user in users" :key="user.id">
|
||||||
<p><b>{{ user.name }}</b> @{{ user.username }}</p>
|
<p><b>{{ user.name }}</b> @{{ getAcct(user) }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
|
@ -21,6 +22,9 @@ export default Vue.extend({
|
||||||
users: []
|
users: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
getAcct
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
(this as any).api('mute/list').then(x => {
|
(this as any).api('mute/list').then(x => {
|
||||||
this.users = x.users;
|
this.users = x.users;
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
<div class="mk-user-preview">
|
<div class="mk-user-preview">
|
||||||
<template v-if="u != null">
|
<template v-if="u != null">
|
||||||
<div class="banner" :style="u.banner_url ? `background-image: url(${u.banner_url}?thumbnail&size=512)` : ''"></div>
|
<div class="banner" :style="u.banner_url ? `background-image: url(${u.banner_url}?thumbnail&size=512)` : ''"></div>
|
||||||
<router-link class="avatar" :to="`/@${u.username}`">
|
<router-link class="avatar" :to="`/@${acct}`">
|
||||||
<img :src="`${u.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img :src="`${u.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<router-link class="name" :to="`/@${u.username}`">{{ u.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`">{{ u.name }}</router-link>
|
||||||
<p class="username">@{{ u.username }}</p>
|
<p class="username">@{{ acct }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="description">{{ u.description }}</div>
|
<div class="description">{{ u.description }}</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
|
@ -29,6 +29,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import * as anime from 'animejs';
|
import * as anime from 'animejs';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
import parseAcct from '../../../../../common/user/parse-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
|
@ -37,6 +39,11 @@ export default Vue.extend({
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.u);
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
u: null
|
u: null
|
||||||
|
@ -49,10 +56,11 @@ export default Vue.extend({
|
||||||
this.open();
|
this.open();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
(this as any).api('users/show', {
|
const query = this.user[0] == '@' ?
|
||||||
user_id: this.user[0] == '@' ? undefined : this.user,
|
parseAcct(this.user[0].substr(1)) :
|
||||||
username: this.user[0] == '@' ? this.user.substr(1) : undefined
|
{ user_id: this.user[0] };
|
||||||
}).then(user => {
|
|
||||||
|
(this as any).api('users/show', query).then(user => {
|
||||||
this.u = user;
|
this.u = user;
|
||||||
this.open();
|
this.open();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="root item">
|
<div class="root item">
|
||||||
<router-link class="avatar-anchor" :to="`/@${user.username}`" v-user-preview="user.id">
|
<router-link class="avatar-anchor" :to="`/@${acct}`" v-user-preview="user.id">
|
||||||
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${user.username}`" v-user-preview="user.id">{{ user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`" v-user-preview="user.id">{{ user.name }}</router-link>
|
||||||
<span class="username">@{{ user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
</header>
|
</header>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<p class="followed" v-if="user.is_followed">フォローされています</p>
|
<p class="followed" v-if="user.is_followed">フォローされています</p>
|
||||||
|
@ -19,8 +19,15 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user']
|
props: ['user'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.user);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Progress from '../../../common/scripts/loading';
|
import Progress from '../../../common/scripts/loading';
|
||||||
|
import parseAcct from '../../../../../common/user/parse-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
|
@ -29,9 +30,7 @@ export default Vue.extend({
|
||||||
Progress.start();
|
Progress.start();
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
|
|
||||||
(this as any).api('users/show', {
|
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => {
|
||||||
username: this.$route.params.username
|
|
||||||
}).then(user => {
|
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<p class="title">%fa:users%%i18n:desktop.tags.mk-user.followers-you-know.title%</p>
|
<p class="title">%fa:users%%i18n:desktop.tags.mk-user.followers-you-know.title%</p>
|
||||||
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.followers-you-know.loading%<mk-ellipsis/></p>
|
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.followers-you-know.loading%<mk-ellipsis/></p>
|
||||||
<div v-if="!fetching && users.length > 0">
|
<div v-if="!fetching && users.length > 0">
|
||||||
<router-link v-for="user in users" :to="`/@${user.username}`" :key="user.id">
|
<router-link v-for="user in users" :to="`/@${getAcct(user)}`" :key="user.id">
|
||||||
<img :src="`${user.avatar_url}?thumbnail&size=64`" :alt="user.name" v-user-preview="user.id"/>
|
<img :src="`${user.avatar_url}?thumbnail&size=64`" :alt="user.name" v-user-preview="user.id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
data() {
|
data() {
|
||||||
|
@ -21,6 +23,9 @@ export default Vue.extend({
|
||||||
fetching: true
|
fetching: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
method() {
|
||||||
|
getAcct
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
(this as any).api('users/followers', {
|
(this as any).api('users/followers', {
|
||||||
user_id: this.user.id,
|
user_id: this.user.id,
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.frequently-replied-users.loading%<mk-ellipsis/></p>
|
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.frequently-replied-users.loading%<mk-ellipsis/></p>
|
||||||
<template v-if="!fetching && users.length != 0">
|
<template v-if="!fetching && users.length != 0">
|
||||||
<div class="user" v-for="friend in users">
|
<div class="user" v-for="friend in users">
|
||||||
<router-link class="avatar-anchor" :to="`/@${friend.username}`">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(friend)}`">
|
||||||
<img class="avatar" :src="`${friend.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="friend.id"/>
|
<img class="avatar" :src="`${friend.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="friend.id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<router-link class="name" :to="`/@${friend.username}`" v-user-preview="friend.id">{{ friend.name }}</router-link>
|
<router-link class="name" :to="`/@${getAcct(friend)}`" v-user-preview="friend.id">{{ friend.name }}</router-link>
|
||||||
<p class="username">@{{ friend.username }}</p>
|
<p class="username">@{{ getAcct(friend) }}</p>
|
||||||
</div>
|
</div>
|
||||||
<mk-follow-button :user="friend"/>
|
<mk-follow-button :user="friend"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
data() {
|
data() {
|
||||||
|
@ -28,6 +30,9 @@ export default Vue.extend({
|
||||||
fetching: true
|
fetching: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
method() {
|
||||||
|
getAcct
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
(this as any).api('users/get_frequently_replied_users', {
|
(this as any).api('users/get_frequently_replied_users', {
|
||||||
user_id: this.user.id,
|
user_id: this.user.id,
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=150`" alt="avatar"/>
|
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=150`" alt="avatar"/>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<p class="name">{{ user.name }}</p>
|
<p class="name">{{ user.name }}</p>
|
||||||
<p class="username">@{{ user.username }}</p>
|
<p class="username">@{{ acct }}</p>
|
||||||
<p class="location" v-if="user.account.profile.location">%fa:map-marker%{{ user.account.profile.location }}</p>
|
<p class="location" v-if="user.host === null && user.account.profile.location">%fa:map-marker%{{ user.account.profile.location }}</p>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<router-link :to="`/@${user.username}`" :data-active="$parent.page == 'home'">%fa:home%概要</router-link>
|
<router-link :to="`/@${acct}`" :data-active="$parent.page == 'home'">%fa:home%概要</router-link>
|
||||||
<router-link :to="`/@${user.username}/media`" :data-active="$parent.page == 'media'">%fa:image%メディア</router-link>
|
<router-link :to="`/@${acct}/media`" :data-active="$parent.page == 'media'">%fa:image%メディア</router-link>
|
||||||
<router-link :to="`/@${user.username}/graphs`" :data-active="$parent.page == 'graphs'">%fa:chart-bar%グラフ</router-link>
|
<router-link :to="`/@${acct}/graphs`" :data-active="$parent.page == 'graphs'">%fa:chart-bar%グラフ</router-link>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,9 +22,15 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.user);
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('load', this.onScroll);
|
window.addEventListener('load', this.onScroll);
|
||||||
window.addEventListener('scroll', this.onScroll);
|
window.addEventListener('scroll', this.onScroll);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<x-profile :user="user"/>
|
<x-profile :user="user"/>
|
||||||
<x-photos :user="user"/>
|
<x-photos :user="user"/>
|
||||||
<x-followers-you-know v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
|
<x-followers-you-know v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
|
||||||
<p>%i18n:desktop.tags.mk-user.last-used-at%: <b><mk-time :time="user.account.last_used_at"/></b></p>
|
<p v-if="user.host === null">%i18n:desktop.tags.mk-user.last-used-at%: <b><mk-time :time="user.account.last_used_at"/></b></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<main>
|
<main>
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
<p v-if="!user.is_muted"><a @click="mute">%i18n:desktop.tags.mk-user.mute%</a></p>
|
<p v-if="!user.is_muted"><a @click="mute">%i18n:desktop.tags.mk-user.mute%</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="description" v-if="user.description">{{ user.description }}</div>
|
<div class="description" v-if="user.description">{{ user.description }}</div>
|
||||||
<div class="birthday" v-if="user.account.profile.birthday">
|
<div class="birthday" v-if="user.host === null && user.account.profile.birthday">
|
||||||
<p>%fa:birthday-cake%{{ user.account.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)</p>
|
<p>%fa:birthday-cake%{{ user.account.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="twitter" v-if="user.account.twitter">
|
<div class="twitter" v-if="user.host === null && user.account.twitter">
|
||||||
<p>%fa:B twitter%<a :href="`https://twitter.com/${user.account.twitter.screen_name}`" target="_blank">@{{ user.account.twitter.screen_name }}</a></p>
|
<p>%fa:B twitter%<a :href="`https://twitter.com/${user.account.twitter.screen_name}`" target="_blank">@{{ user.account.twitter.screen_name }}</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import parseAcct from '../../../../../../common/user/parse-acct';
|
||||||
import Progress from '../../../../common/scripts/loading';
|
import Progress from '../../../../common/scripts/loading';
|
||||||
import XHeader from './user.header.vue';
|
import XHeader from './user.header.vue';
|
||||||
import XHome from './user.home.vue';
|
import XHome from './user.home.vue';
|
||||||
|
@ -39,9 +40,7 @@ export default Vue.extend({
|
||||||
fetch() {
|
fetch() {
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
Progress.start();
|
Progress.start();
|
||||||
(this as any).api('users/show', {
|
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => {
|
||||||
username: this.$route.params.user
|
|
||||||
}).then(user => {
|
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
Progress.done();
|
Progress.done();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<p>ようこそ! <b>Misskey</b>はTwitter風ミニブログSNSです。思ったことや皆と共有したいことを投稿しましょう。タイムラインを見れば、皆の関心事をすぐにチェックすることもできます。<a :href="aboutUrl">詳しく...</a></p>
|
<p>ようこそ! <b>Misskey</b>はTwitter風ミニブログSNSです。思ったことや皆と共有したいことを投稿しましょう。タイムラインを見れば、皆の関心事をすぐにチェックすることもできます。<a :href="aboutUrl">詳しく...</a></p>
|
||||||
<p><button class="signup" @click="signup">はじめる</button><button class="signin" @click="signin">ログイン</button></p>
|
<p><button class="signup" @click="signup">はじめる</button><button class="signin" @click="signin">ログイン</button></p>
|
||||||
<div class="users">
|
<div class="users">
|
||||||
<router-link v-for="user in users" :key="user.id" class="avatar-anchor" :to="`/@${user.username}`" v-user-preview="user.id">
|
<router-link v-for="user in users" :key="user.id" class="avatar-anchor" :to="`/@${getAcct(user)}`" v-user-preview="user.id">
|
||||||
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -43,6 +43,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { docsUrl, copyright, lang } from '../../../config';
|
import { docsUrl, copyright, lang } from '../../../config';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
const shares = [
|
const shares = [
|
||||||
'Everything!',
|
'Everything!',
|
||||||
|
@ -97,6 +98,7 @@ export default Vue.extend({
|
||||||
clearInterval(this.clock);
|
clearInterval(this.clock);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAcct,
|
||||||
signup() {
|
signup() {
|
||||||
this.$modal.show('signup');
|
this.$modal.show('signup');
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<div class="post">
|
<div class="post">
|
||||||
<header>
|
<header>
|
||||||
<a class="index" @click="reply">{{ post.index }}:</a>
|
<a class="index" @click="reply">{{ post.index }}:</a>
|
||||||
<router-link class="name" :to="`/@${post.user.username}`" v-user-preview="post.user.id"><b>{{ post.user.name }}</b></router-link>
|
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.user.id"><b>{{ post.user.name }}</b></router-link>
|
||||||
<span>ID:<i>{{ post.user.username }}</i></span>
|
<span>ID:<i>{{ acct }}</i></span>
|
||||||
</header>
|
</header>
|
||||||
<div>
|
<div>
|
||||||
<a v-if="post.reply">>>{{ post.reply.index }}</a>
|
<a v-if="post.reply">>>{{ post.reply.index }}</a>
|
||||||
|
@ -19,8 +19,15 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['post'],
|
props: ['post'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
reply() {
|
reply() {
|
||||||
this.$emit('reply', this.post);
|
this.$emit('reply', this.post);
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<button @click="fetch" title="%i18n:desktop.tags.mk-recommended-polls-home-widget.refresh%">%fa:sync%</button>
|
<button @click="fetch" title="%i18n:desktop.tags.mk-recommended-polls-home-widget.refresh%">%fa:sync%</button>
|
||||||
</template>
|
</template>
|
||||||
<div class="poll" v-if="!fetching && poll != null">
|
<div class="poll" v-if="!fetching && poll != null">
|
||||||
<p v-if="poll.text"><router-link to="`/@${ poll.user.username }/${ poll.id }`">{{ poll.text }}</router-link></p>
|
<p v-if="poll.text"><router-link to="`/@${ acct }/${ poll.id }`">{{ poll.text }}</router-link></p>
|
||||||
<p v-if="!poll.text"><router-link to="`/@${ poll.user.username }/${ poll.id }`">%fa:link%</router-link></p>
|
<p v-if="!poll.text"><router-link to="`/@${ acct }/${ poll.id }`">%fa:link%</router-link></p>
|
||||||
<mk-poll :post="poll"/>
|
<mk-poll :post="poll"/>
|
||||||
</div>
|
</div>
|
||||||
<p class="empty" v-if="!fetching && poll == null">%i18n:desktop.tags.mk-recommended-polls-home-widget.nothing%</p>
|
<p class="empty" v-if="!fetching && poll == null">%i18n:desktop.tags.mk-recommended-polls-home-widget.nothing%</p>
|
||||||
|
@ -16,12 +16,19 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import define from '../../../common/define-widget';
|
import define from '../../../common/define-widget';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default define({
|
export default define({
|
||||||
name: 'polls',
|
name: 'polls',
|
||||||
props: () => ({
|
props: () => ({
|
||||||
compact: false
|
compact: false
|
||||||
})
|
})
|
||||||
}).extend({
|
}).extend({
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.poll.user);
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
poll: null,
|
poll: null,
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
</template>
|
</template>
|
||||||
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
|
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
|
||||||
<div class="post" v-else-if="post != null">
|
<div class="post" v-else-if="post != null">
|
||||||
<p class="text"><router-link :to="`/@${ post.user.username }/${ post.id }`">{{ post.text }}</router-link></p>
|
<p class="text"><router-link :to="`/@${ acct }/${ post.id }`">{{ post.text }}</router-link></p>
|
||||||
<p class="author">―<router-link :to="`/@${ post.user.username }`">@{{ post.user.username }}</router-link></p>
|
<p class="author">―<router-link :to="`/@${ acct }`">@{{ acct }}</router-link></p>
|
||||||
</div>
|
</div>
|
||||||
<p class="empty" v-else>%i18n:desktop.tags.mk-trends-home-widget.nothing%</p>
|
<p class="empty" v-else>%i18n:desktop.tags.mk-trends-home-widget.nothing%</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,12 +15,19 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import define from '../../../common/define-widget';
|
import define from '../../../common/define-widget';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default define({
|
export default define({
|
||||||
name: 'trends',
|
name: 'trends',
|
||||||
props: () => ({
|
props: () => ({
|
||||||
compact: false
|
compact: false
|
||||||
})
|
})
|
||||||
}).extend({
|
}).extend({
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
post: null,
|
post: null,
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
|
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
|
||||||
<template v-else-if="users.length != 0">
|
<template v-else-if="users.length != 0">
|
||||||
<div class="user" v-for="_user in users">
|
<div class="user" v-for="_user in users">
|
||||||
<router-link class="avatar-anchor" :to="`/@${_user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${getAcct(_user)}`">
|
||||||
<img class="avatar" :src="`${_user.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="_user.id"/>
|
<img class="avatar" :src="`${_user.avatar_url}?thumbnail&size=42`" alt="" v-user-preview="_user.id"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<router-link class="name" :to="`/@${_user.username}`" v-user-preview="_user.id">{{ _user.name }}</router-link>
|
<router-link class="name" :to="`/@${getAcct(_user)}`" v-user-preview="_user.id">{{ _user.name }}</router-link>
|
||||||
<p class="username">@{{ _user.username }}</p>
|
<p class="username">@{{ getAcct(_user) }}</p>
|
||||||
</div>
|
</div>
|
||||||
<mk-follow-button :user="_user"/>
|
<mk-follow-button :user="_user"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import define from '../../../common/define-widget';
|
import define from '../../../common/define-widget';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
const limit = 3;
|
const limit = 3;
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ export default define({
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAcct,
|
||||||
func() {
|
func() {
|
||||||
this.props.compact = !this.props.compact;
|
this.props.compact = !this.props.compact;
|
||||||
},
|
},
|
||||||
|
|
|
@ -57,7 +57,7 @@ init((launch) => {
|
||||||
{ path: '/i/settings/profile', component: MkProfileSetting },
|
{ path: '/i/settings/profile', component: MkProfileSetting },
|
||||||
{ path: '/i/notifications', component: MkNotifications },
|
{ path: '/i/notifications', component: MkNotifications },
|
||||||
{ path: '/i/messaging', component: MkMessaging },
|
{ path: '/i/messaging', component: MkMessaging },
|
||||||
{ path: '/i/messaging/:username', component: MkMessagingRoom },
|
{ path: '/i/messaging/:user', component: MkMessagingRoom },
|
||||||
{ path: '/i/drive', component: MkDrive },
|
{ path: '/i/drive', component: MkDrive },
|
||||||
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
||||||
{ path: '/i/drive/file/:file', component: MkDrive },
|
{ path: '/i/drive/file/:file', component: MkDrive },
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
<div class="mk-notification">
|
<div class="mk-notification">
|
||||||
<div class="notification reaction" v-if="notification.type == 'reaction'">
|
<div class="notification reaction" v-if="notification.type == 'reaction'">
|
||||||
<mk-time :time="notification.created_at"/>
|
<mk-time :time="notification.created_at"/>
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>
|
<p>
|
||||||
<mk-reaction-icon :reaction="notification.reaction"/>
|
<mk-reaction-icon :reaction="notification.reaction"/>
|
||||||
<router-link :to="`/@${notification.user.username}`">{{ notification.user.name }}</router-link>
|
<router-link :to="`/@${acct}`">{{ notification.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
<router-link class="post-ref" :to="`/@${notification.post.user.username}/${notification.post.id}`">
|
<router-link class="post-ref" :to="`/@${acct}/${notification.post.id}`">
|
||||||
%fa:quote-left%{{ getPostSummary(notification.post) }}
|
%fa:quote-left%{{ getPostSummary(notification.post) }}
|
||||||
%fa:quote-right%
|
%fa:quote-right%
|
||||||
</router-link>
|
</router-link>
|
||||||
|
@ -19,15 +19,15 @@
|
||||||
|
|
||||||
<div class="notification repost" v-if="notification.type == 'repost'">
|
<div class="notification repost" v-if="notification.type == 'repost'">
|
||||||
<mk-time :time="notification.created_at"/>
|
<mk-time :time="notification.created_at"/>
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>
|
<p>
|
||||||
%fa:retweet%
|
%fa:retweet%
|
||||||
<router-link :to="`/@${notification.post.user.username}`">{{ notification.post.user.name }}</router-link>
|
<router-link :to="`/@${acct}`">{{ notification.post.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
<router-link class="post-ref" :to="`/@${notification.post.user.username}/${notification.post.id}`">
|
<router-link class="post-ref" :to="`/@${acct}/${notification.post.id}`">
|
||||||
%fa:quote-left%{{ getPostSummary(notification.post.repost) }}%fa:quote-right%
|
%fa:quote-left%{{ getPostSummary(notification.post.repost) }}%fa:quote-right%
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -39,13 +39,13 @@
|
||||||
|
|
||||||
<div class="notification follow" v-if="notification.type == 'follow'">
|
<div class="notification follow" v-if="notification.type == 'follow'">
|
||||||
<mk-time :time="notification.created_at"/>
|
<mk-time :time="notification.created_at"/>
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>
|
<p>
|
||||||
%fa:user-plus%
|
%fa:user-plus%
|
||||||
<router-link :to="`/@${notification.user.username}`">{{ notification.user.name }}</router-link>
|
<router-link :to="`/@${acct}`">{{ notification.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -60,15 +60,15 @@
|
||||||
|
|
||||||
<div class="notification poll_vote" v-if="notification.type == 'poll_vote'">
|
<div class="notification poll_vote" v-if="notification.type == 'poll_vote'">
|
||||||
<mk-time :time="notification.created_at"/>
|
<mk-time :time="notification.created_at"/>
|
||||||
<router-link class="avatar-anchor" :to="`/@${notification.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${notification.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>
|
<p>
|
||||||
%fa:chart-pie%
|
%fa:chart-pie%
|
||||||
<router-link :to="`/@${notification.user.username}`">{{ notification.user.name }}</router-link>
|
<router-link :to="`/@${acct}`">{{ notification.user.name }}</router-link>
|
||||||
</p>
|
</p>
|
||||||
<router-link class="post-ref" :to="`/@${notification.post.user.username}/${notification.post.id}`">
|
<router-link class="post-ref" :to="`/@${acct}/${notification.post.id}`">
|
||||||
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
|
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -79,9 +79,15 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import getPostSummary from '../../../../../common/get-post-summary';
|
import getPostSummary from '../../../../../common/get-post-summary';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['notification'],
|
props: ['notification'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.notification.user);
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
getPostSummary
|
getPostSummary
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-post-card">
|
<div class="mk-post-card">
|
||||||
<a :href="`/@${post.user.username}/${post.id}`">
|
<a :href="`/@${acct}/${post.id}`">
|
||||||
<header>
|
<header>
|
||||||
<img :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/><h3>{{ post.user.name }}</h3>
|
<img :src="`${acct}?thumbnail&size=64`" alt="avatar"/><h3>{{ post.user.name }}</h3>
|
||||||
</header>
|
</header>
|
||||||
<div>
|
<div>
|
||||||
{{ text }}
|
{{ text }}
|
||||||
|
@ -15,10 +15,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import summary from '../../../../../common/get-post-summary';
|
import summary from '../../../../../common/get-post-summary';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['post'],
|
props: ['post'],
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
},
|
||||||
text(): string {
|
text(): string {
|
||||||
return summary(this.post);
|
return summary(this.post);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="root sub">
|
<div class="root sub">
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${post.user.username}`">{{ post.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`">{{ post.user.name }}</router-link>
|
||||||
<span class="username">@{{ post.user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
<router-link class="time" :to="`/@${post.user.username}/${post.id}`">
|
<router-link class="time" :to="`/@${acct}/${post.id}`">
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</header>
|
</header>
|
||||||
|
@ -20,8 +20,15 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['post']
|
props: ['post'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="repost" v-if="isRepost">
|
<div class="repost" v-if="isRepost">
|
||||||
<p>
|
<p>
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=32`" alt="avatar"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=32`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
%fa:retweet%
|
%fa:retweet%
|
||||||
<router-link class="name" :to="`/@${post.user.username}`">
|
<router-link class="name" :to="`/@${acct}`">
|
||||||
{{ post.user.name }}
|
{{ post.user.name }}
|
||||||
</router-link>
|
</router-link>
|
||||||
がRepost
|
がRepost
|
||||||
|
@ -29,12 +29,12 @@
|
||||||
</div>
|
</div>
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<router-link class="avatar-anchor" :to="`/@${p.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${pAcct}`">
|
||||||
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div>
|
<div>
|
||||||
<router-link class="name" :to="`/@${p.user.username}`">{{ p.user.name }}</router-link>
|
<router-link class="name" :to="`/@${pAcct}`">{{ p.user.name }}</router-link>
|
||||||
<span class="username">@{{ p.user.username }}</span>
|
<span class="username">@{{ pAcct }}</span>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<mk-post-preview :post="p.repost"/>
|
<mk-post-preview :post="p.repost"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<router-link class="time" :to="`/@${p.user.username}/${p.id}`">
|
<router-link class="time" :to="`/@${pAcct}/${p.id}`">
|
||||||
<mk-time :time="p.created_at" mode="detail"/>
|
<mk-time :time="p.created_at" mode="detail"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<footer>
|
<footer>
|
||||||
|
@ -80,6 +80,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
import MkPostMenu from '../../../common/views/components/post-menu.vue';
|
import MkPostMenu from '../../../common/views/components/post-menu.vue';
|
||||||
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
||||||
import XSub from './post-detail.sub.vue';
|
import XSub from './post-detail.sub.vue';
|
||||||
|
@ -105,6 +106,12 @@ export default Vue.extend({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
},
|
||||||
|
pAcct() {
|
||||||
|
return getAcct(this.p.user);
|
||||||
|
},
|
||||||
isRepost(): boolean {
|
isRepost(): boolean {
|
||||||
return (this.post.repost &&
|
return (this.post.repost &&
|
||||||
this.post.text == null &&
|
this.post.text == null &&
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-post-preview">
|
<div class="mk-post-preview">
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${post.user.username}`">{{ post.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`">{{ post.user.name }}</router-link>
|
||||||
<span class="username">@{{ post.user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
<router-link class="time" :to="`/@${post.user.username}/${post.id}`">
|
<router-link class="time" :to="`/@${acct}/${post.id}`">
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</header>
|
</header>
|
||||||
|
@ -20,8 +20,15 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['post']
|
props: ['post'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="sub">
|
<div class="sub">
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=96`" alt="avatar"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=96`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${post.user.username}`">{{ post.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`">{{ post.user.name }}</router-link>
|
||||||
<span class="username">@{{ post.user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
<router-link class="created-at" :to="`/@${post.user.username}/${post.id}`">
|
<router-link class="created-at" :to="`/@${acct}/${post.id}`">
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</header>
|
</header>
|
||||||
|
@ -20,8 +20,15 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['post']
|
props: ['post'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,25 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="repost" v-if="isRepost">
|
<div class="repost" v-if="isRepost">
|
||||||
<p>
|
<p>
|
||||||
<router-link class="avatar-anchor" :to="`/@${post.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
%fa:retweet%
|
%fa:retweet%
|
||||||
<span>{{ '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.indexOf('{')) }}</span>
|
<span>{{ '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.indexOf('{')) }}</span>
|
||||||
<router-link class="name" :to="`/@${post.user.username}`">{{ post.user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`">{{ post.user.name }}</router-link>
|
||||||
<span>{{ '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.substr('%i18n:mobile.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1) }}</span>
|
<span>{{ '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.substr('%i18n:mobile.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1) }}</span>
|
||||||
</p>
|
</p>
|
||||||
<mk-time :time="post.created_at"/>
|
<mk-time :time="post.created_at"/>
|
||||||
</div>
|
</div>
|
||||||
<article>
|
<article>
|
||||||
<router-link class="avatar-anchor" :to="`/@${p.user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${pAcct}`">
|
||||||
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=96`" alt="avatar"/>
|
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=96`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${p.user.username}`">{{ p.user.name }}</router-link>
|
<router-link class="name" :to="`/@${pAcct}`">{{ p.user.name }}</router-link>
|
||||||
<span class="is-bot" v-if="p.user.account.is_bot">bot</span>
|
<span class="is-bot" v-if="p.user.host === null && p.user.account.is_bot">bot</span>
|
||||||
<span class="username">@{{ p.user.username }}</span>
|
<span class="username">@{{ pAcct }}</span>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
|
<span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
|
||||||
<router-link class="created-at" :to="url">
|
<router-link class="created-at" :to="url">
|
||||||
|
@ -77,6 +77,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
import MkPostMenu from '../../../common/views/components/post-menu.vue';
|
import MkPostMenu from '../../../common/views/components/post-menu.vue';
|
||||||
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
||||||
import XSub from './post.sub.vue';
|
import XSub from './post.sub.vue';
|
||||||
|
@ -93,6 +94,12 @@ export default Vue.extend({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.post.user);
|
||||||
|
},
|
||||||
|
pAcct() {
|
||||||
|
return getAcct(this.p.user);
|
||||||
|
},
|
||||||
isRepost(): boolean {
|
isRepost(): boolean {
|
||||||
return (this.post.repost &&
|
return (this.post.repost &&
|
||||||
this.post.text == null &&
|
this.post.text == null &&
|
||||||
|
@ -110,7 +117,7 @@ export default Vue.extend({
|
||||||
: 0;
|
: 0;
|
||||||
},
|
},
|
||||||
url(): string {
|
url(): string {
|
||||||
return `/@${this.p.user.username}/${this.p.id}`;
|
return `/@${this.pAcct}/${this.p.id}`;
|
||||||
},
|
},
|
||||||
urls(): string[] {
|
urls(): string[] {
|
||||||
if (this.p.ast) {
|
if (this.p.ast) {
|
||||||
|
|
|
@ -1,20 +1,27 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-user-card">
|
<div class="mk-user-card">
|
||||||
<header :style="user.banner_url ? `background-image: url(${user.banner_url}?thumbnail&size=1024)` : ''">
|
<header :style="user.banner_url ? `background-image: url(${user.banner_url}?thumbnail&size=1024)` : ''">
|
||||||
<a :href="`/@${user.username}`">
|
<a :href="`/@${acct}`">
|
||||||
<img :src="`${user.avatar_url}?thumbnail&size=200`" alt="avatar"/>
|
<img :src="`${user.avatar_url}?thumbnail&size=200`" alt="avatar"/>
|
||||||
</a>
|
</a>
|
||||||
</header>
|
</header>
|
||||||
<a class="name" :href="`/@${user.username}`" target="_blank">{{ user.name }}</a>
|
<a class="name" :href="`/@${acct}`" target="_blank">{{ user.name }}</a>
|
||||||
<p class="username">@{{ user.username }}</p>
|
<p class="username">@{{ acct }}</p>
|
||||||
<mk-follow-button :user="user"/>
|
<mk-follow-button :user="user"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user']
|
props: ['user'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.user);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-user-preview">
|
<div class="mk-user-preview">
|
||||||
<router-link class="avatar-anchor" :to="`/@${user.username}`">
|
<router-link class="avatar-anchor" :to="`/@${acct}`">
|
||||||
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
<img class="avatar" :src="`${user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<header>
|
<header>
|
||||||
<router-link class="name" :to="`/@${user.username}`">{{ user.name }}</router-link>
|
<router-link class="name" :to="`/@${acct}`">{{ user.name }}</router-link>
|
||||||
<span class="username">@{{ user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
</header>
|
</header>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="description">{{ user.description }}</div>
|
<div class="description">{{ user.description }}</div>
|
||||||
|
@ -17,8 +17,15 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user']
|
props: ['user'],
|
||||||
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return getAcct(this.user);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Progress from '../../../common/scripts/loading';
|
import Progress from '../../../common/scripts/loading';
|
||||||
|
import parseAcct from '../../../../../common/user/parse-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
|
@ -41,9 +42,7 @@ export default Vue.extend({
|
||||||
Progress.start();
|
Progress.start();
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
|
|
||||||
(this as any).api('users/show', {
|
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => {
|
||||||
username: this.$route.params.user
|
|
||||||
}).then(user => {
|
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Progress from '../../../common/scripts/loading';
|
import Progress from '../../../common/scripts/loading';
|
||||||
|
import parseAcct from '../../../../../common/user/parse-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
|
@ -41,9 +42,7 @@ export default Vue.extend({
|
||||||
Progress.start();
|
Progress.start();
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
|
|
||||||
(this as any).api('users/show', {
|
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => {
|
||||||
username: this.$route.params.user
|
|
||||||
}).then(user => {
|
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import parseAcct from '../../../../../common/user/parse-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -27,9 +29,7 @@ export default Vue.extend({
|
||||||
methods: {
|
methods: {
|
||||||
fetch() {
|
fetch() {
|
||||||
this.fetching = true;
|
this.fetching = true;
|
||||||
(this as any).api('users/show', {
|
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => {
|
||||||
username: (this as any).$route.params.username
|
|
||||||
}).then(user => {
|
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey %i18n:mobile.tags.mk-messaging-page.message%';
|
document.title = 'Misskey %i18n:mobile.tags.mk-messaging-page.message%';
|
||||||
|
@ -14,7 +16,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
navigate(user) {
|
navigate(user) {
|
||||||
(this as any).$router.push(`/i/messaging/${user.username}`);
|
(this as any).$router.push(`/i/messaging/${getAcct(user)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h1>{{ user.name }}</h1>
|
<h1>{{ user.name }}</h1>
|
||||||
<span class="username">@{{ user.username }}</span>
|
<span class="username">@{{ acct }}</span>
|
||||||
<span class="followed" v-if="user.is_followed">%i18n:mobile.tags.mk-user.follows-you%</span>
|
<span class="followed" v-if="user.is_followed">%i18n:mobile.tags.mk-user.follows-you%</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="description">{{ user.description }}</div>
|
<div class="description">{{ user.description }}</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<p class="location" v-if="user.account.profile.location">
|
<p class="location" v-if="user.host === null && user.account.profile.location">
|
||||||
%fa:map-marker%{{ user.account.profile.location }}
|
%fa:map-marker%{{ user.account.profile.location }}
|
||||||
</p>
|
</p>
|
||||||
<p class="birthday" v-if="user.account.profile.birthday">
|
<p class="birthday" v-if="user.host === null && user.account.profile.birthday">
|
||||||
%fa:birthday-cake%{{ user.account.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)
|
%fa:birthday-cake%{{ user.account.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,11 +30,11 @@
|
||||||
<b>{{ user.posts_count | number }}</b>
|
<b>{{ user.posts_count | number }}</b>
|
||||||
<i>%i18n:mobile.tags.mk-user.posts%</i>
|
<i>%i18n:mobile.tags.mk-user.posts%</i>
|
||||||
</a>
|
</a>
|
||||||
<a :href="`@${user.username}/following`">
|
<a :href="`@${acct}/following`">
|
||||||
<b>{{ user.following_count | number }}</b>
|
<b>{{ user.following_count | number }}</b>
|
||||||
<i>%i18n:mobile.tags.mk-user.following%</i>
|
<i>%i18n:mobile.tags.mk-user.following%</i>
|
||||||
</a>
|
</a>
|
||||||
<a :href="`@${user.username}/followers`">
|
<a :href="`@${acct}/followers`">
|
||||||
<b>{{ user.followers_count | number }}</b>
|
<b>{{ user.followers_count | number }}</b>
|
||||||
<i>%i18n:mobile.tags.mk-user.followers%</i>
|
<i>%i18n:mobile.tags.mk-user.followers%</i>
|
||||||
</a>
|
</a>
|
||||||
|
@ -60,6 +60,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import * as age from 's-age';
|
import * as age from 's-age';
|
||||||
|
import getAcct from '../../../../../common/user/get-acct';
|
||||||
|
import getAcct from '../../../../../common/user/parse-acct';
|
||||||
import Progress from '../../../common/scripts/loading';
|
import Progress from '../../../common/scripts/loading';
|
||||||
import XHome from './user/home.vue';
|
import XHome from './user/home.vue';
|
||||||
|
|
||||||
|
@ -75,6 +77,9 @@ export default Vue.extend({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
acct() {
|
||||||
|
return this.getAcct(this.user);
|
||||||
|
},
|
||||||
age(): number {
|
age(): number {
|
||||||
return age(this.user.account.profile.birthday);
|
return age(this.user.account.profile.birthday);
|
||||||
}
|
}
|
||||||
|
@ -92,9 +97,7 @@ export default Vue.extend({
|
||||||
fetch() {
|
fetch() {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
|
||||||
(this as any).api('users/show', {
|
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => {
|
||||||
username: this.$route.params.user
|
|
||||||
}).then(user => {
|
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="root followers-you-know">
|
<div class="root followers-you-know">
|
||||||
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-followers-you-know.loading%<mk-ellipsis/></p>
|
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-followers-you-know.loading%<mk-ellipsis/></p>
|
||||||
<div v-if="!fetching && users.length > 0">
|
<div v-if="!fetching && users.length > 0">
|
||||||
<a v-for="user in users" :key="user.id" :href="`/@${user.username}`">
|
<a v-for="user in users" :key="user.id" :href="`/@${getAcct(user)}`">
|
||||||
<img :src="`${user.avatar_url}?thumbnail&size=64`" :alt="user.name"/>
|
<img :src="`${user.avatar_url}?thumbnail&size=64`" :alt="user.name"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
data() {
|
data() {
|
||||||
|
@ -20,6 +22,9 @@ export default Vue.extend({
|
||||||
users: []
|
users: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
getAcct
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
(this as any).api('users/followers', {
|
(this as any).api('users/followers', {
|
||||||
user_id: this.user.id,
|
user_id: this.user.id,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<a v-for="image in images"
|
<a v-for="image in images"
|
||||||
class="img"
|
class="img"
|
||||||
:style="`background-image: url(${image.media.url}?thumbnail&size=256)`"
|
:style="`background-image: url(${image.media.url}?thumbnail&size=256)`"
|
||||||
:href="`/@${image.post.user.username}/${image.post.id}`"
|
:href="`/@${getAcct(image.post.user)}/${image.post.id}`"
|
||||||
></a>
|
></a>
|
||||||
</div>
|
</div>
|
||||||
<p class="empty" v-if="!fetching && images.length == 0">%i18n:mobile.tags.mk-user-overview-photos.no-photos%</p>
|
<p class="empty" v-if="!fetching && images.length == 0">%i18n:mobile.tags.mk-user-overview-photos.no-photos%</p>
|
||||||
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import getAcct from '../../../../../../common/user/get-acct';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
data() {
|
data() {
|
||||||
|
@ -22,6 +24,9 @@ export default Vue.extend({
|
||||||
images: []
|
images: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
getAcct
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
(this as any).api('users/posts', {
|
(this as any).api('users/posts', {
|
||||||
user_id: this.user.id,
|
user_id: this.user.id,
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<x-followers-you-know :user="user"/>
|
<x-followers-you-know :user="user"/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<p>%i18n:mobile.tags.mk-user-overview.last-used-at%: <b><mk-time :time="user.account.last_used_at"/></b></p>
|
<p v-if="user.host === null">%i18n:mobile.tags.mk-user-overview.last-used-at%: <b><mk-time :time="user.account.last_used_at"/></b></p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe('Text', () => {
|
||||||
it('can be analyzed', () => {
|
it('can be analyzed', () => {
|
||||||
const tokens = analyze('@himawari お腹ペコい :cat: #yryr');
|
const tokens = analyze('@himawari お腹ペコい :cat: #yryr');
|
||||||
assert.deepEqual([
|
assert.deepEqual([
|
||||||
{ type: 'mention', content: '@himawari', username: 'himawari' },
|
{ type: 'mention', content: '@himawari', username: 'himawari', host: null },
|
||||||
{ type: 'text', content: ' お腹ペコい ' },
|
{ type: 'text', content: ' お腹ペコい ' },
|
||||||
{ type: 'emoji', content: ':cat:', emoji: 'cat'},
|
{ type: 'emoji', content: ':cat:', emoji: 'cat'},
|
||||||
{ type: 'text', content: ' '},
|
{ type: 'text', content: ' '},
|
||||||
|
@ -36,7 +36,7 @@ describe('Text', () => {
|
||||||
it('mention', () => {
|
it('mention', () => {
|
||||||
const tokens = analyze('@himawari お腹ペコい');
|
const tokens = analyze('@himawari お腹ペコい');
|
||||||
assert.deepEqual([
|
assert.deepEqual([
|
||||||
{ type: 'mention', content: '@himawari', username: 'himawari' },
|
{ type: 'mention', content: '@himawari', username: 'himawari', host: null },
|
||||||
{ type: 'text', content: ' お腹ペコい' }
|
{ type: 'text', content: ' お腹ペコい' }
|
||||||
], tokens);
|
], tokens);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue