Skip to content

Commit

Permalink
10.100.0-l190410182002
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Apr 10, 2019
2 parents 491aa6f + 43c5b1c commit 85ada7a
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 90 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo <[email protected]>",
"version": "10.100.0-l190409212035",
"version": "10.100.0-l190410182002",
"codename": "nighthike",
"repository": {
"type": "git",
Expand Down Expand Up @@ -250,7 +250,6 @@
"vuex": "3.1.0",
"vuex-persistedstate": "2.5.4",
"web-push": "3.3.3",
"webfinger.js": "2.7.0",
"webpack": "4.28.4",
"webpack-cli": "3.2.3",
"websocket": "1.0.28",
Expand Down
65 changes: 0 additions & 65 deletions src/@types/webfinger.js.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/client/app/common/views/deck/deck.notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
</div>

<div class="notification renote" v-if="notification.type == 'renote'">
<div class="notification renote" v-if="notification.type == 'renote' && notification.note">
<mk-avatar class="avatar" :user="notification.user"/>
<div>
<header>
Expand All @@ -28,7 +28,7 @@
</router-link>
<mk-time :time="notification.createdAt"/>
</header>
<router-link class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note.renote)">
<router-link v-if="notification.note.renote" class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note.renote)">
<fa icon="quote-left"/>
<mfm :text="getNoteSummary(notification.note.renote)" :should-break="false" :plain-text="true" :custom-emojis="notification.note.renote.emojis"/>
<fa icon="quote-right"/>
Expand Down
4 changes: 2 additions & 2 deletions src/client/app/desktop/views/components/notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
</div>
</template>

<template v-if="notification.type == 'renote'">
<template v-if="notification.type == 'renote' && notification.note">
<mk-avatar class="avatar" :user="notification.note.user"/>
<div class="text">
<p><fa icon="retweet"/>
<router-link :to="notification.note.user | userPage" v-user-preview="notification.note.userId">
<mk-user-name :user="notification.note.user"/>
</router-link>
</p>
<router-link class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note.renote)">
<router-link v-if="notification.note.renote" class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note.renote)">
<fa icon="quote-left"/>
<mfm :text="getNoteSummary(notification.note.renote)" :should-break="false" :plain-text="true" :custom-emojis="notification.note.renote.emojis"/>
<fa icon="quote-right"/>
Expand Down
4 changes: 2 additions & 2 deletions src/client/app/mobile/views/components/notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
</div>
</div>

<div class="notification renote" v-if="notification.type == 'renote'">
<div class="notification renote" v-if="notification.type == 'renote' && notification.note">
<mk-avatar class="avatar" :user="notification.user"/>
<div>
<header>
<fa icon="retweet"/>
<router-link :to="notification.user | userPage"><mk-user-name :user="notification.user"/></router-link>
<mk-time :time="notification.createdAt"/>
</header>
<router-link class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note.renote)">
<router-link v-if="notification.note.renote" class="note-ref" :to="notification.note | notePage" :title="getNoteSummary(notification.note.renote)">
<fa icon="quote-left"/>
<mfm :text="getNoteSummary(notification.note.renote)" :should-break="false" :plain-text="true" :custom-emojis="notification.note.renote.emojis"/>
<fa icon="quote-right"/>
Expand Down
3 changes: 3 additions & 0 deletions src/models/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ export const pack = async (
const renote = await Note.findOne({
userId: meId,
renoteId: _note.id,
text: null,
poll: null,
'fileIds.0': { $exists: false },
deletedAt: { $exists: false }
}, {
_id: 1
Expand Down
4 changes: 2 additions & 2 deletions src/remote/resolve-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export default async (username: string, _host: string, option?: any, resync?: bo
async function resolveSelf(acctLower: string) {
logger.info(`WebFinger for ${chalk.yellow(acctLower)}`);
const finger = await webFinger(acctLower).catch(e => {
logger.error(`Failed to WebFinger for ${chalk.yellow(acctLower)}: ${e.message} (${e.status})`);
throw e;
logger.error(`Failed to WebFinger for ${chalk.yellow(acctLower)}: ${ e.statusCode || e.message }`);
throw new Error(`Failed to WebFinger for ${acctLower}: ${ e.statusCode || e.message }`);
});
const self = finger.links.find(link => link.rel && link.rel.toLowerCase() === 'self');
if (!self) {
Expand Down
42 changes: 32 additions & 10 deletions src/remote/webfinger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { WebFinger } from 'webfinger.js';

const webFinger = new WebFinger({ });
import config from '../config';
import * as request from 'request-promise-native';
import { URL } from 'url';
import { query as urlQuery } from '../prelude/url';

type ILink = {
href: string;
Expand All @@ -12,12 +13,33 @@ type IWebFinger = {
subject: string;
};

export default async function resolve(query: any): Promise<IWebFinger> {
return await new Promise((res, rej) => webFinger.lookup(query, (error: Error | string, result: any) => {
if (error) {
return rej(error);
}
export default async function(query: string): Promise<IWebFinger> {
const url = genUrl(query);

return await request({
url,
proxy: config.proxy,
timeout: 10 * 1000,
forever: true,
headers: {
'User-Agent': config.userAgent,
Accept: 'application/jrd+json, application/json'
},
json: true
});
}

function genUrl(query: string) {
if (query.match(/^https?:\/\//)) {
const u = new URL(query);
return `${u.protocol}//${u.hostname}/.well-known/webfinger?` + urlQuery({ resource: query });
}

const m = query.match(/^([^@]+)@(.*)/);
if (m) {
const hostname = m[2];
return `https://${hostname}/.well-known/webfinger?` + urlQuery({ resource: `acct:${query}` });
}

res(result.object);
})) as IWebFinger;
throw new Error(`Invalied query (${query})`);
}
12 changes: 7 additions & 5 deletions src/services/note/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,13 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
}

// renote対象noteに対してrenotedイベント
publishNoteStream(data.renote._id, 'renoted', {
renoteeId: user._id, // renoteした人
noteId: note._id, // renote扱いのNoteId
renoteCount: (data.renote.renoteCount || 0) + 1,
});
if (!isQuote(note)) {
publishNoteStream(data.renote._id, 'renoted', {
renoteeId: user._id, // renoteした人
noteId: note._id, // renote扱いのNoteId
renoteCount: (data.renote.renoteCount || 0) + 1,
});
}
}

if (!silent) {
Expand Down

0 comments on commit 85ada7a

Please sign in to comment.