Skip to content

Commit

Permalink
10.102.1-l190422011801
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Apr 21, 2019
2 parents eaa2365 + da8d60c commit cc239e4
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 53 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ If you encounter any problems with updating, please try the following:
1. `npm run clean` or `npm run cleanall`
2. Retry update (Don't forget `npm i`)

10.102.1
----------
* 投稿が増殖する問題を修正
* リモートユーザーの修復処理が自動的に実行されない問題を修正

10.101.0
----------
* WebFingerリクエストで Proxy, Keep-Alive などをサポート
Expand Down
33 changes: 24 additions & 9 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -478,21 +478,25 @@ common/views/components/user-menu.vue:
mention: "Mention"
mute: "Mute"
unmute: "Unmute"
mute-confirm: "Do you want to mute this account?"
unmute-confirm: "Do you want to unmute this account?"
mute-confirm: "Are you sure you want to mute this user?"
unmute-confirm: "Are you certain that you want to unmute this user?"
block: "Block"
unblock: "Unblock"
block-confirm: "Do you want to block this account?"
unblock-confirm: "Do you want to unblock this account?"
block-confirm: "Are you sure you want to block this user?"
unblock-confirm: "Are you certain that you want to unblock this user?"
push-to-list: "Add to list"
select-list: "Select a list"
report-abuse: "Report abuse"
report-abuse-detail: "What kind of nuisance did you encounter?"
report-abuse-reported: "The issue has been reported to the administrator. Your cooperation is much appreciated."
silence: "Silence"
unsilence: "Unsilence"
silence-confirm: "Are you sure that you want to silence this user?"
unsilence-confirm: "Are you sure that you want to stop silencing this user?"
suspend: "Suspend"
unsuspend: "Unsuspend"
suspend-confirm: "Are you sure that you want to suspend this user?"
unsuspend-confirm: "Are you sure that you want to unsuspend this user?"
common/views/components/poll.vue:
vote-to: "Vote for '{}'"
vote-count: "{} votes"
Expand Down Expand Up @@ -675,6 +679,9 @@ common/views/components/user-list-editor.vue:
remove-user: "Remove from this list"
delete-are-you-sure: "Delete list \"$1\"?"
deleted: "Deleted successfully"
common/views/components/user-lists.vue:
create-list: "Create a list"
list-name: "List name"
common/views/widgets/broadcast.vue:
fetching: "Checking"
no-broadcasts: "No announcements"
Expand Down Expand Up @@ -1024,8 +1031,6 @@ desktop/views/components/received-follow-requests-window.vue:
reject: "Reject"
desktop/views/components/user-lists-window.vue:
title: "User lists"
create-list: "Create a list"
list-name: "List name"
desktop/views/components/user-preview.vue:
notes: "Posts"
following: "Following"
Expand Down Expand Up @@ -1208,7 +1213,9 @@ admin/views/users.vue:
unsuspend-confirm: "Are you sure you want to unsuspend this account?"
unsuspended: "The user has successfully unsuspended."
make-silence: "Silence"
silence-confirm: "Silence user?"
unmake-silence: "Unsilence"
unsilence-confirm: "Are you certain that you want to stop silencing this user?"
verify: "Verify account"
verify-confirm: "Do you want this to be a verified account?"
verified: "The account is now being verified"
Expand Down Expand Up @@ -1402,6 +1409,7 @@ desktop/views/widgets/polls.vue:
desktop/views/widgets/post-form.vue:
title: "Post"
note: "Post"
something-happened: "Could not be posted in this circumstance."
desktop/views/widgets/profile.vue:
update-banner: "Click to edit your banner"
update-avatar: "Click to edit your avatar"
Expand All @@ -1420,12 +1428,11 @@ mobile/views/components/drive.vue:
file-count: "File(s)"
nothing-in-drive: "There's nothing stored."
folder-is-empty: "This folder is empty"
prompt: "What do you want to do? (Please enter a number): <1 → Upload a file | 2 → Upload a file from a URL | 3 → Create a folder | 4 → Change this folder's name | 5 → Move this folder | 6 → Delete this folder>"
deletion-alert: "Sorry! Deleting a folder is not yet implemented."
folder-name: "Folder name"
here-is-root: "Currently, you are on the root, not inside of any folder."
url-prompt: "URL of the file you want to upload"
uploading: "Upload requested. It may take a while for the upload to finish."
folder-name-cannot-empty: "Folder name cannot be blank."
mobile/views/components/drive-file-chooser.vue:
select-file: "Choose files"
mobile/views/components/drive-folder-chooser.vue:
Expand Down Expand Up @@ -1499,9 +1506,16 @@ mobile/views/components/ui.nav.vue:
game: "Games"
admin: "Admin"
about: "About Misskey"
mobile/views/pages/drive.vue:
contextmenu:
upload: "Upload a file"
url-upload: "Upload file from a URL"
create-folder: "Create a folder"
rename-folder: "Rename folder"
move-folder: "Move this folder"
delete-folder: "Delete this folder"
mobile/views/pages/user-lists.vue:
title: "Lists"
enter-list-name: "Enter a name of the list to make"
mobile/views/pages/signup.vue:
lets-start: "Your account is now ready! 📦"
mobile/views/pages/followers.vue:
Expand Down Expand Up @@ -1630,6 +1644,7 @@ dev/views/apps.vue:
create-app: "Create app"
app-missing: "No apps"
dev/views/new-app.vue:
new-app: "New Application"
create-app: "Creating application"
app-name: "Application name"
app-name-desc: "The name of your app"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo <[email protected]>",
"version": "10.102.0-l190421021252",
"version": "10.102.1-l190422011801",
"codename": "nighthike",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/remote/activitypub/models/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export async function resolveNote(value: string | IObject, resolver?: Resolver):
// リモートサーバーからフェッチしてきて登録
// ここでuriの代わりに添付されてきたNote Objectが指定されていると、サーバーフェッチを経ずにノートが生成されるが
// 添付されてきたNote Objectは偽装されている可能性があるため、常にuriを指定してサーバーフェッチを行う。
return await createNote(uri, resolver);
return await createNote(uri, resolver, true);
}

export async function extractEmojis(tags: ITag[], host_: string) {
Expand Down
7 changes: 0 additions & 7 deletions src/remote/activitypub/models/person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,6 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
}
//#endregion

// 繋がらないインスタンスに何回も試行するのを防ぐ, 後続の同様処理の連続試行を防ぐ ため 試行前にも更新する
await User.update({ _id: exist._id }, {
$set: {
lastFetchedAt: new Date(),
},
});

if (resolver == null) resolver = new Resolver();

const object = hint || await resolver.resolve(uri) as any;
Expand Down
25 changes: 13 additions & 12 deletions src/remote/resolve-user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toUnicode, toASCII } from 'punycode';
import User, { IUser, IRemoteUser, isRemoteUser } from '../models/user';
import User, { IUser, IRemoteUser } from '../models/user';
import webFinger from './webfinger';
import config from '../config';
import { createPerson, updatePerson } from './activitypub/models/person';
Expand Down Expand Up @@ -28,7 +28,7 @@ export default async (username: string, _host: string, option?: any, resync = fa
return await User.findOne({ usernameLower, host: null });
}

const user = await User.findOne({ usernameLower, host }, option);
const user = await User.findOne({ usernameLower, host }, option) as IRemoteUser;

const acctLower = `${usernameLower}@${hostAscii}`;

Expand All @@ -39,14 +39,22 @@ export default async (username: string, _host: string, option?: any, resync = fa
return await createPerson(self.href);
}

if (resync) {
// resyncオプション OR ユーザー情報が古い場合は、WebFilgerからやりなおして返す
if (resync || user.lastFetchedAt == null || Date.now() - user.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24) {
// 繋がらないインスタンスに何回も試行するのを防ぐ, 後続の同様処理の連続試行を防ぐ ため 試行前にも更新する
await User.update({ _id: user._id }, {
$set: {
lastFetchedAt: new Date(),
},
});

logger.info(`try resync: ${acctLower}`);
const self = await resolveSelf(acctLower);

if ((user as IRemoteUser).uri !== self.href) {
if (user.uri !== self.href) {
// if uri mismatch, Fix (user@host <=> AP's Person id(IRemoteUser.uri)) mapping.
logger.info(`uri missmatch: ${acctLower}`);
logger.info(`recovery missmatch uri for (username=${username}, host=${host}) from ${(user as IRemoteUser).uri} to ${self.href}`);
logger.info(`recovery missmatch uri for (username=${username}, host=${host}) from ${user.uri} to ${self.href}`);

// validate uri
const uri = new URL(self.href);
Expand All @@ -72,13 +80,6 @@ export default async (username: string, _host: string, option?: any, resync = fa
return await User.findOne({ uri: self.href });
}

// ユーザーの情報が古かったらついでに更新しておく
if (isRemoteUser(user)) {
if (user.lastFetchedAt == null || Date.now() - user.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24) {
updatePerson(user.uri);
}
}

logger.info(`return existing remote user: ${acctLower}`);
return user;
};
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/endpoints/ap/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async function fetchAny(uri: string) {
}

if (['Note', 'Question', 'Article'].includes(object.type)) {
const note = await createNote(object.id);
const note = await createNote(object.id, null, true);
return {
type: 'Note',
object: await packNote(note, null, { detail: true })
Expand Down
16 changes: 1 addition & 15 deletions src/server/api/endpoints/users/search.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import $ from 'cafy';
import * as escapeRegexp from 'escape-regexp';
import User, { pack, validateUsername, IUser, isRemoteUser } from '../../../../models/user';
import User, { pack, validateUsername, IUser } from '../../../../models/user';
import define from '../../define';
import { toDbHost } from '../../../../misc/convert-host';
import { updatePerson } from '../../../../remote/activitypub/models/person';

export const meta = {
desc: {
Expand Down Expand Up @@ -102,18 +101,5 @@ export default define(meta, async (ps, me) => {
});
}

// ついでにバックグラウンドでリモートユーザー情報を更新しておく
updateUsers(users);

return await Promise.all(users.map(user => pack(user, me, { detail: ps.detail })));
});

async function updateUsers(users: IUser[]) {
for (const user of users) {
if (isRemoteUser(user)) {
if (user.lastFetchedAt == null || Date.now() - user.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24 * 30) { // 30days
await updatePerson(user.uri).catch(() => {});
}
}
}
}
11 changes: 4 additions & 7 deletions src/server/api/endpoints/users/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,16 @@ export default define(meta, async (ps, me) => {
: { usernameLower: ps.username.toLowerCase(), host: null };

user = await User.findOne(q, cursorOption);

if (isRemoteUser(user)) {
resolveRemoteUser(user.username, user.host);
}
}

if (user === null) {
throw new ApiError(meta.errors.noSuchUser);
}

// ユーザー情報更新
if (isRemoteUser(user)) {
if (user.lastFetchedAt == null || Date.now() - user.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24) {
resolveRemoteUser(ps.username, ps.host, { }, true);
}
}

return await pack(user, me, {
detail: true
});
Expand Down

0 comments on commit cc239e4

Please sign in to comment.