Compare commits

...

103 Commits

Author SHA1 Message Date
063f372f3c 11.0.0-beta.5 2019-04-13 01:53:00 +09:00
987168b863 strictNullChecks (#4666)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip
2019-04-13 01:43:22 +09:00
4ee40c3345 Fix bug 2019-04-12 14:24:56 +09:00
654daff7ce Better error handling 2019-04-12 13:07:56 +09:00
64e10e9619 11.0.0-beta.4 2019-04-12 02:25:56 +09:00
b89cffe98d Fix bug 2019-04-12 02:22:22 +09:00
bd76ba702f 🎨 2019-04-12 02:15:22 +09:00
5d52e9ce6b 11.0.0-beta.3 2019-04-12 01:56:48 +09:00
3c29027ca3 Clean up 2019-04-12 01:54:28 +09:00
2ff3069d23 トランザクションを使うようにしたり 2019-04-12 01:52:25 +09:00
4198246351 トランザクションを使用してアンケートレコードの挿入に失敗した場合に投稿レコードの挿入もなかったことにするように 2019-04-12 01:30:10 +09:00
2b6389b4dc Fix bug 2019-04-12 01:03:40 +09:00
d7df75ae6c Clean up 2019-04-12 01:01:25 +09:00
11c30eccb3 非正規化カラムを削除
非正規化するほどの情報じゃない
2019-04-12 00:42:39 +09:00
ab8c6515b8 Fix error log 2019-04-12 00:33:26 +09:00
d4ad36fa41 Update migrate.ts 2019-04-11 22:49:12 +09:00
4d688be3df Update migrate.ts 2019-04-11 22:44:04 +09:00
d2b75f3501 Update migrate.ts 2019-04-11 19:42:35 +09:00
46b78cb4ff Increase url column length 2019-04-11 19:03:49 +09:00
5d6e0d0f37 Update migrate.ts 2019-04-11 16:15:27 +09:00
e19d0a37bb Update migrate.ts 2019-04-11 16:09:33 +09:00
dea3e2132e Update migrate.ts 2019-04-11 15:53:15 +09:00
91c1ceefbd Merge branch 'develop' of https://github.com/syuilo/misskey into develop 2019-04-11 12:59:16 +09:00
5c50989970 Fix bug 2019-04-11 12:59:09 +09:00
2a7e3b9c51 Fix: AP actor Service のサポートが不完全 (v11) (#4662) 2019-04-11 03:09:12 +09:00
ab302df0ae Update CHANGELOG.md 2019-04-11 00:18:37 +09:00
21e5809993 Clean up 2019-04-10 23:57:39 +09:00
c58afc67e8 Update migrate.ts 2019-04-10 20:13:14 +09:00
8e344f2deb 11.0.0-beta.2 2019-04-10 20:08:19 +09:00
c28f4ffb3f Clean up 2019-04-10 20:07:36 +09:00
2a40240310 Fix bug 2019-04-10 18:35:51 +09:00
0e9fba9287 11.0.0-beta.1 2019-04-10 18:25:16 +09:00
2e3dd2a30a Fix bug 2019-04-10 18:13:33 +09:00
dda5f6559d Fix bug 2019-04-10 18:10:09 +09:00
4152e59638 Fix bug 2019-04-10 18:05:39 +09:00
9d5a92bce6 11.0.0-alpha.10 2019-04-10 15:08:05 +09:00
30172b92e6 WebFingerリクエストで Proxy, Keep-Alive などをサポート #4658
Co-Authored-By: MeiMei <mei23@users.noreply.github.com>
2019-04-10 15:07:21 +09:00
8468a9d4c7 11.0.0-alpha.9 2019-04-10 15:04:33 +09:00
626cfb61ac テーブル分割 2019-04-10 15:04:27 +09:00
9603f3fa4f Delete get-user-summary.ts 2019-04-10 14:58:45 +09:00
619a1b9e53 Fix bug 2019-04-10 14:10:00 +09:00
62e76ad588 11.0.0-alpha.8 2019-04-10 01:00:00 +09:00
236d72685d More puny 2019-04-10 00:59:41 +09:00
72a5f7b1e2 Fix bug 2019-04-10 00:40:10 +09:00
d1c16a90b4 11.0.0-alpha.7 2019-04-10 00:01:10 +09:00
33a9783ae5 ドメインは常にPunycodeで保存するように 2019-04-09 23:59:32 +09:00
4d64fd665e Update update.ts 2019-04-09 23:40:55 +09:00
96443384fe 11.0.0-alpha.6 2019-04-09 23:35:34 +09:00
69939f1edb :) 2019-04-09 23:31:41 +09:00
e3c0058942 Refactor 2019-04-09 23:29:48 +09:00
3dc2361654 Update migrate.ts 2019-04-09 23:12:11 +09:00
ec2f709018 Update migrate.ts 2019-04-09 23:09:57 +09:00
ea06665c51 isRemote --> isLink 2019-04-09 23:07:08 +09:00
74a4bd704c Update migrate.ts 2019-04-09 21:05:49 +09:00
c62f3e0e45 11.0.0-alpha.5 2019-04-09 20:51:23 +09:00
a56a969433 Update dependencies 🚀 2019-04-09 20:49:56 +09:00
1016f94bbb Fix bug 2019-04-09 20:47:31 +09:00
e98cce9aee Update migrate.ts 2019-04-09 19:20:10 +09:00
d4bdb5d327 Update migrate.ts 2019-04-09 19:14:18 +09:00
db4378415e Update migrate.ts 2019-04-09 19:02:09 +09:00
9b594880c8 Restore crypto_key to migration 2019-04-09 19:02:02 +09:00
d44fc3db2f Update migrate.ts 2019-04-09 18:45:21 +09:00
5133b0a0c0 Update migrate.ts 2019-04-09 18:41:53 +09:00
815469304f typo 2019-04-09 18:37:14 +09:00
c651921c79 Fix bug 2019-04-09 18:36:43 +09:00
d18c835221 Update migrate.ts 2019-04-09 18:35:07 +09:00
e38335077e Update user.ts 2019-04-09 12:36:01 +09:00
34c150cf73 Merge branch 'develop' of https://github.com/syuilo/misskey into develop 2019-04-09 12:31:48 +09:00
24cb3ba091 Update migrate.ts 2019-04-09 12:31:45 +09:00
c07eaef2d1 Update note.ts 2019-04-09 12:25:19 +09:00
5df708ac9f Delete mark-admin.js 2019-04-09 04:09:34 +09:00
38ffbe95e9 Update migrate.ts 2019-04-09 01:42:07 +09:00
8bec4042fc Update migrate.ts 2019-04-09 01:31:54 +09:00
ee7ef89dfb Fix bug 2019-04-09 01:31:48 +09:00
54a5246061 Update migrate.ts 2019-04-09 01:03:58 +09:00
fa6eae2937 Update migrate.ts 2019-04-08 23:24:44 +09:00
795be20ee1 Clean up 2019-04-08 23:06:05 +09:00
87d3a06dcd revert rename 2019-04-08 23:05:41 +09:00
8b5c917195 Update CHANGELOG.md 2019-04-08 22:23:33 +09:00
c7da0e59ff Update CHANGELOG.md 2019-04-08 21:46:11 +09:00
eb14acbe0c Doc: Update installing command (#4655)
Replace the "Checkout to Latest Release" command.
Current setup document will checkout latest alpha version.
Because grep command in the document does not exclude alpha version tags.
2019-04-08 21:40:13 +09:00
56860a6bef wip migration 2019-04-08 20:33:42 +09:00
735687be21 update token generation 2019-04-08 20:29:52 +09:00
fab0cc51b3 Fix 2019-04-08 19:56:42 +09:00
3a26acbdb2 ユーザーリストでフォローボタンを表示するように (#4603) 2019-04-08 17:20:16 +09:00
8d0c31bcda 11.0.0-alpha.4 2019-04-08 17:07:50 +09:00
0b99293d4c Fix bug 2019-04-08 17:04:37 +09:00
802153ff9b Fix bug 2019-04-08 16:49:05 +09:00
ec73e2d237 11.0.0-alpha.3 2019-04-08 16:43:51 +09:00
c32b020535 Update ja-JP.yml 2019-04-08 16:43:27 +09:00
c4441804e2 Fix bug 2019-04-08 16:41:41 +09:00
6c9d80d4e8 Fix bug 2019-04-08 16:39:02 +09:00
a231f8d26c Fix bug 2019-04-08 16:34:45 +09:00
08da258b63 Update README.md 2019-04-08 15:11:03 +09:00
5994926440 11.0.0-alpha.2 2019-04-08 14:51:36 +09:00
30f2da4215 Fix bug 2019-04-08 14:41:23 +09:00
1a2229f886 Improve instance chart 2019-04-08 14:29:17 +09:00
1e166490d9 [Client] Better pagination
Fix #4628
Close #4629
2019-04-08 14:17:44 +09:00
1c57e6f80a i18n 2019-04-08 13:55:09 +09:00
a6537a8748 Fix: 投稿ウィジットでローカルのみの公開範囲で投稿できない (#4647) 2019-04-08 13:31:42 +09:00
842b75977b Update README.md [AUTOGEN] (#4652) 2019-04-08 04:21:37 +09:00
9b3dccf60c Update README.md [AUTOGEN] (#4649) 2019-04-08 04:20:53 +09:00
2d533e0cd8 Update CHANGELOG.md 2019-04-08 03:52:46 +09:00
310 changed files with 2456 additions and 1630 deletions

View File

@ -5,6 +5,30 @@ 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`)
11.0.0
----------
* データベースがMongoDBからPostgreSQLに変更されました
* アカウントを完全に削除できるように
* ミュート/ブロック時にそのユーザーの投稿のウォッチをすべて解除するように
* フォロー申請数が実際より1すくなくなる問題を修正
* リストからアカウント削除したユーザーを削除できない問題を修正
* リストTLでフォローしていないユーザーの非公開投稿が流れる問題を修正
* リストTLでダイレクト投稿が流れない問題を修正
* ミュートしているユーザーの投稿がタイムラインに流れてくることがある問題を修正
### APIの破壊的変更
* v10時点で deprecated だったパラメータなどを削除
* ユーザーリストの title が name に
10.100.0
----------
* ユーザーリストでフォローボタンを表示するように
* ドライブのファイルのサムネイルを修正
* 投稿ウィジットでローカルのみの公開範囲で投稿できない問題を修正
* TLを遡った時に抜けがある時がある問題を修正
* ユーザータイムラインが投稿日時順ではなくなっているのを修正
* 10.99.0 でチャートのレンダリングがおかしい問題を修正
10.99.0
----------
* manifest.json にインスタンス名を反映させるように

View File

@ -1,4 +1,4 @@
<a href="https://ai.misskey.xyz/"><img src="https://github.com/syuilo/misskey/blob/develop/assets/ai-orig.png?raw=true" align="right" height="320px"/></a>
<a href="https://xn--931a.moe/"><img src="https://github.com/syuilo/misskey/blob/develop/assets/ai-orig.png?raw=true" align="right" height="320px"/></a>
[![Misskey](/assets/title.png)](https://misskey.xyz/)
================================================================
@ -102,7 +102,7 @@ Please see the [Contribution Guide](./CONTRIBUTING.md).
<!-- PATREON_START -->
<table><tr>
<td><img src="https://c10.patreonusercontent.com/3/eyJ3IjoyMDB9/patreon-media/p/user/5888816/36da0f7c15954df0ab13f9abdf227f66/1?token-time=2145916800&token-hash=HGkZJ7s4bSaQVoOJ5q30mTWHTxDLiw1LuyaogKPLy24%3D" alt="Hiroshi Seki" width="100"></td>
<td><img src="https://c10.patreonusercontent.com/3/eyJ3IjoyMDB9/patreon-media/p/user/12190916/fb7fa7983c14425f890369535b1506a4/1?token-time=2145916800&token-hash=WeuDzzz24cRXJogyIkU-mxARqkdyms-rcZKbO-GpGjw%3D" alt="weep" width="100"></td>
<td><img src="https://c10.patreonusercontent.com/3/eyJ3IjoyMDB9/patreon-media/p/user/12190916/fb7fa7983c14425f890369535b1506a4/3?token-time=2145916800&token-hash=gr7DF8BuwflHvNoP24He4aa-5j8_KycrAQe3fHwQIUE%3D" alt="weep" width="100"></td>
<td><img src="https://c8.patreon.com/2/200/12059069" alt="naga_rus" width="100"></td>
<td><img src="https://c10.patreonusercontent.com/3/eyJ3IjoyMDB9/patreon-media/p/user/12913507/f7181eacafe8469a93033d85f5969c29/4?token-time=2145916800&token-hash=vZdDTTF-ahiKBjjgppS2ev4rkD8H7TTKkXXoxsucs6Y%3D" alt="Melilot" width="100"></td>
<td><img src="https://c10.patreonusercontent.com/3/eyJ3IjoyMDB9/patreon-media/p/user/5670915/ee175f0bfb6347ffa4ea101a8c097bff/1?token-time=2145916800&token-hash=ubqJzjhBQUo8Nw6h_8jMDlJ5ocIO46EflpiRkp2jIw4%3D" alt="osapon" width="100"></td>
@ -158,7 +158,7 @@ Please see the [Contribution Guide](./CONTRIBUTING.md).
<td><a href="https://www.patreon.com/user?u=12531784">Takashi Shibuya</a></td>
</tr></table>
**Last updated:** Sat, 06 Apr 2019 03:35:05 UTC
**Last updated:** Sun, 07 Apr 2019 19:21:08 UTC
<!-- PATREON_END -->
:four_leaf_clover: Copyright

9
binding.gyp Normal file
View File

@ -0,0 +1,9 @@
{
'targets': [
{
'target_name': 'crypto_key',
'sources': ['src/crypto_key.cc'],
'include_dirs': ['<!(node -e "require(\'nan\')")']
}
]
}

View File

@ -1,23 +0,0 @@
const mongo = require('mongodb');
const User = require('../built/models/user').default;
const args = process.argv.slice(2);
const user = args[0];
const q = user.startsWith('@') ? {
username: user.split('@')[1],
host: user.split('@')[2] || null
} : { _id: new mongo.ObjectID(user) };
console.log(`Mark as admin ${user}...`);
User.update(q, {
$set: {
isAdmin: true
}
}).then(() => {
console.log(`Done ${user}`);
}, e => {
console.error(e);
});

View File

@ -11,7 +11,7 @@ This guide describes how to install and setup Misskey with Docker.
----------------------------------------------------------------
1. `git clone -b master git://github.com/syuilo/misskey.git` Clone Misskey repository's master branch.
2. `cd misskey` Move to misskey directory.
3. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)` Checkout to the [latest release](https://github.com/syuilo/misskey/releases/latest) tag.
3. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)` Checkout to the [latest release](https://github.com/syuilo/misskey/releases/latest) tag.
*2.* Configure Misskey
----------------------------------------------------------------
@ -67,7 +67,7 @@ Just `docker-compose up -d`. GLHF!
### How to update your Misskey server to the latest version
1. `git fetch`
2. `git stash`
3. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)`
3. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)`
4. `git stash pop`
5. `docker-compose build`
6. Check [ChangeLog](../CHANGELOG.md) for migration information

View File

@ -12,7 +12,7 @@ Ce guide explique comment installer et configurer Misskey avec Docker.
----------------------------------------------------------------
1. `git clone -b master git://github.com/syuilo/misskey.git` Clone le dépôt de Misskey sur la branche master.
2. `cd misskey` Naviguez dans le dossier du dépôt.
3. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)` Checkout sur le tag de la [dernière version](https://github.com/syuilo/misskey/releases/latest).
3. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)` Checkout sur le tag de la [dernière version](https://github.com/syuilo/misskey/releases/latest).
*2.* Configuration de Misskey
----------------------------------------------------------------
@ -40,7 +40,7 @@ Utilisez la commande `docker-compose up -d`. GLHF!
### How to update your Misskey server to the latest version
1. `git fetch`
2. `git stash`
3. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)`
3. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)`
4. `git stash pop`
5. `docker-compose build`
6. Consultez le [ChangeLog](../CHANGELOG.md) pour avoir les éventuelles informations de migration

View File

@ -11,7 +11,7 @@ Dockerを使ったMisskey構築方法
----------------------------------------------------------------
1. `git clone -b master git://github.com/syuilo/misskey.git` masterブランチからMisskeyレポジトリをクローン
2. `cd misskey` misskeyディレクトリに移動
3. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)` [最新のリリース](https://github.com/syuilo/misskey/releases/latest)を確認
3. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)` [最新のリリース](https://github.com/syuilo/misskey/releases/latest)を確認
*2.* 設定ファイルの作成と編集
----------------------------------------------------------------
@ -67,7 +67,7 @@ cp docker_example.env docker.env
### Misskeyを最新バージョンにアップデートする方法:
1. `git fetch`
2. `git stash`
3. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)`
3. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)`
4. `git stash pop`
5. `docker-compose build`
6. [ChangeLog](../CHANGELOG.md)でマイグレーション情報を確認する

View File

@ -40,7 +40,7 @@ Please install and setup these softwares:
1. `su - misskey` Connect to misskey user.
2. `git clone -b master git://github.com/syuilo/misskey.git` Clone the misskey repo from master branch.
3. `cd misskey` Navigate to misskey directory
4. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)` Checkout to the [latest release](https://github.com/syuilo/misskey/releases/latest)
4. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)` Checkout to the [latest release](https://github.com/syuilo/misskey/releases/latest)
5. `npm install` Install misskey dependencies.
*5.* Configure Misskey
@ -109,7 +109,7 @@ You can check if the service is running with `systemctl status misskey`.
### How to update your Misskey server to the latest version
1. `git fetch`
2. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)`
2. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)`
3. `npm install`
4. `NODE_ENV=production npm run build`
5. Check [ChangeLog](../CHANGELOG.md) for migration information

View File

@ -40,7 +40,7 @@ Installez les paquets suivants :
1. `su - misskey` Basculez vers l'utilisateur misskey.
2. `git clone -b master git://github.com/syuilo/misskey.git` Clonez la branche master du dépôt misskey.
3. `cd misskey` Accédez au dossier misskey.
4. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)` Checkout sur le tag de la [version la plus récente](https://github.com/syuilo/misskey/releases/latest)
4. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)` Checkout sur le tag de la [version la plus récente](https://github.com/syuilo/misskey/releases/latest)
5. `npm install` Installez les dépendances de misskey.
*5.* Création du fichier de configuration
@ -103,7 +103,7 @@ Vous pouvez vérifier si le service a démarré en utilisant la commande `system
### Méthode de mise à jour vers la plus récente version de Misskey
1. `git fetch`
2. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)`
2. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)`
3. `npm install`
4. `NODE_ENV=production npm run build`
5. Consultez [ChangeLog](../CHANGELOG.md) pour les information de migration.

View File

@ -47,7 +47,7 @@ adduser --disabled-password --disabled-login misskey
1. `su - misskey` misskeyユーザーを使用
2. `git clone -b master git://github.com/syuilo/misskey.git` masterブランチからMisskeyレポジトリをクローン
3. `cd misskey` misskeyディレクトリに移動
4. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)` [最新のリリース](https://github.com/syuilo/misskey/releases/latest)を確認
4. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)` [最新のリリース](https://github.com/syuilo/misskey/releases/latest)を確認
5. `npm install` Misskeyの依存パッケージをインストール
*5.* 設定ファイルを作成する
@ -115,7 +115,7 @@ CentOSで1024以下のポートを使用してMisskeyを使用する場合は`Ex
### Misskeyを最新バージョンにアップデートする方法:
1. `git fetch`
2. `git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)`
2. `git checkout $(git tag -l | grep -Ev -- '-(rc|alpha)\.[0-9]+$' | sort -V | tail -n 1)`
3. `npm install`
4. `NODE_ENV=production npm run build`
5. [ChangeLog](../CHANGELOG.md)でマイグレーション情報を確認する

View File

@ -49,6 +49,7 @@ gulp.task('build:copy:views', () =>
gulp.task('build:copy', gulp.parallel('build:copy:views', () =>
gulp.src([
'./build/Release/crypto_key.node',
'./src/const.json',
'./src/server/web/views/**/*',
'./src/**/assets/**/*',
@ -119,7 +120,7 @@ gulp.task('copy:client', () =>
])
.pipe(isProduction ? (imagemin as any)() : gutil.noop())
.pipe(rename(path => {
path.dirname = path.dirname.replace('assets', '.');
path.dirname = path.dirname!.replace('assets', '.');
}))
.pipe(gulp.dest('./built/client/assets/'))
);

View File

@ -73,6 +73,12 @@ common:
followers: "フォロワー"
favorites: "お気に入り"
permissions:
'read:account': "アカウントの情報を見る"
'write:account': "アカウントの情報を変更する"
'read:drive': "ドライブを見る"
'write:drive': "ドライブを操作する"
empty-timeline-info:
follow-users-to-make-your-timeline: "ユーザーをフォローすると投稿がタイムラインに表示されます。"
explore: "ユーザーを探索する"
@ -299,15 +305,6 @@ common:
auth/views/form.vue:
share-access: "<i>{name}</i>があなたのアカウントにアクセスすることを許可しますか?"
permission-ask: "このアプリは次の権限を要求しています:"
account-read: "アカウントの情報を見る。"
account-write: "アカウントの情報を操作する。"
note-write: "投稿する。"
like-write: "いいねしたりいいね解除する。"
following-write: "フォローしたりフォロー解除する。"
drive-read: "ドライブを見る。"
drive-write: "ドライブを操作する。"
notification-read: "通知を見る。"
notification-write: "通知を操作する。"
cancel: "キャンセル"
accept: "アクセスを許可"
@ -1085,9 +1082,6 @@ desktop/views/components/settings.tags.vue:
add: "追加"
save: "保存"
desktop/views/components/taskmanager.vue:
title: "タスクマネージャ"
desktop/views/components/timeline.vue:
home: "ホーム"
local: "ローカル"
@ -1818,12 +1812,3 @@ dev/views/new-app.vue:
authority: "権限"
authority-desc: "ここで要求した機能だけがAPIからアクセスできます。"
authority-warning: "アプリ作成後も変更できますが、新たな権限を付与する場合、その時点で関連付けられているユーザーキーはすべて無効になります。"
account-read: "アカウントの情報を見る。"
account-write: "アカウントの情報を操作する。"
note-write: "投稿する。"
reaction-write: "リアクションしたりリアクションをキャンセルする。"
following-write: "フォローしたりフォロー解除する。"
drive-read: "ドライブを見る。"
drive-write: "ドライブを操作する。"
notification-read: "通知を見る。"
notification-write: "通知を操作する。"

View File

@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo <i@syuilo.com>",
"version": "11.0.0-alpha.1",
"version": "11.0.0-beta.5",
"codename": "daybreak",
"repository": {
"type": "git",
@ -12,6 +12,7 @@
"scripts": {
"start": "node ./index.js",
"init": "node ./built/init.js",
"migrate": "node ./built/migrate.js",
"debug": "DEBUG=misskey:* node ./index.js",
"build": "webpack && gulp build",
"webpack": "webpack",
@ -66,6 +67,8 @@
"@types/lolex": "3.1.1",
"@types/minio": "7.0.1",
"@types/mocha": "5.2.6",
"@types/mongodb": "3.1.22",
"@types/monk": "6.0.0",
"@types/node": "11.10.4",
"@types/nodemailer": "4.6.6",
"@types/nprogress": "0.0.29",
@ -96,14 +99,14 @@
"@types/websocket": "0.0.40",
"@types/ws": "6.0.1",
"animejs": "3.0.1",
"apexcharts": "3.6.5",
"apexcharts": "3.6.6",
"autobind-decorator": "2.4.0",
"autosize": "4.0.2",
"autwh": "0.1.0",
"bcryptjs": "2.4.3",
"bootstrap-vue": "2.0.0-rc.13",
"bull": "3.7.0",
"cafy": "15.1.0",
"cafy": "15.1.1",
"chai": "4.2.0",
"chai-http": "4.2.1",
"chalk": "2.4.2",
@ -168,7 +171,10 @@
"mocha": "6.0.2",
"moji": "0.5.1",
"moment": "2.24.0",
"mongodb": "3.2.3",
"monk": "6.0.6",
"ms": "2.1.1",
"nan": "2.12.1",
"nested-property": "0.0.7",
"node-fetch": "2.3.0",
"nodemailer": "5.1.1",
@ -234,7 +240,7 @@
"video-thumbnail-generator": "1.1.3",
"vue": "2.6.10",
"vue-color": "2.7.0",
"vue-content-loading": "1.5.3",
"vue-content-loading": "1.6.0",
"vue-cropperjs": "3.0.0",
"vue-i18n": "8.10.0",
"vue-js-modal": "1.3.28",
@ -242,7 +248,7 @@
"vue-loader": "15.7.0",
"vue-marquee-text-component": "1.1.1",
"vue-prism-component": "1.1.1",
"vue-router": "3.0.2",
"vue-router": "3.0.3",
"vue-sequential-entrance": "1.1.3",
"vue-style-loader": "4.1.2",
"vue-svg-inline-loader": "1.2.15",
@ -252,7 +258,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",

View File

@ -1,65 +0,0 @@
declare module 'webfinger.js' {
interface IWebFingerConstructorConfig {
tls_only?: boolean;
webfist_fallback?: boolean;
uri_fallback?: boolean;
request_timeout?: number;
}
type JRDProperties = { [type: string]: string };
interface IJRDLink {
rel: string;
type?: string;
href?: string;
template?: string;
titles?: { [lang: string]: string };
properties?: JRDProperties;
}
interface IJRD {
subject?: string;
expires?: Date;
aliases?: string[];
properties?: JRDProperties;
links?: IJRDLink[];
}
interface IIDXLinks {
'avatar': IJRDLink[];
'remotestorage': IJRDLink[];
'blog': IJRDLink[];
'vcard': IJRDLink[];
'updates': IJRDLink[];
'share': IJRDLink[];
'profile': IJRDLink[];
'webfist': IJRDLink[];
'camlistore': IJRDLink[];
[type: string]: IJRDLink[];
}
interface IIDXProperties {
'name': string;
[type: string]: string;
}
interface IIDX {
links: IIDXLinks;
properties: IIDXProperties;
}
interface ILookupCallbackResult {
object: IJRD;
json: string;
idx: IIDX;
}
type LookupCallback = (err: Error | string, result?: ILookupCallbackResult) => void;
export class WebFinger {
constructor(config?: IWebFingerConstructorConfig);
public lookup(address: string, cb: LookupCallback): NodeJS.Timeout;
public lookupLink(address: string, rel: string, cb: IJRDLink): void;
}
}

View File

@ -44,7 +44,7 @@ function greet() {
export async function masterMain() {
greet();
let config: Config;
let config!: Config;
try {
// initialize app

View File

@ -15,6 +15,6 @@ export async function workerMain() {
if (cluster.isWorker) {
// Send a 'ready' message to parent process
process.send('ready');
process.send!('ready');
}
}

View File

@ -153,7 +153,7 @@ export default Vue.extend({
thumbnail(file: any): any {
return {
'background-color': file.properties.avgColor && file.properties.avgColor.length == 3 ? `rgb(${file.properties.avgColor.join(',')})` : 'transparent',
'background-color': file.properties.avgColor || 'transparent',
'background-image': `url(${file.thumbnailUrl})`
};
},

View File

@ -14,15 +14,7 @@
<h2>{{ $t('permission-ask') }}</h2>
<ul>
<template v-for="p in app.permission">
<li v-if="p == 'read:account'">{{ $t('read:account') }}</li>
<li v-if="p == 'write:account'">{{ $t('write:account') }}</li>
<li v-if="p == 'write:notes'">{{ $t('write:notes') }}</li>
<li v-if="p == 'like-write'">{{ $t('like-write') }}</li>
<li v-if="p == 'write:following'">{{ $t('write:following') }}</li>
<li v-if="p == 'read:drive'">{{ $t('read:drive') }}</li>
<li v-if="p == 'write:drive'">{{ $t('write:drive') }}</li>
<li v-if="p == 'read:notifications'">{{ $t('read:notifications') }}</li>
<li v-if="p == 'write:notifications'">{{ $t('write:notifications') }}</li>
<li :key="p">{{ $t(`@.permissions.${p}`) }}</li>
</template>
</ul>
</section>

View File

@ -55,12 +55,7 @@ export default Vue.extend({
},
icon(): any {
return {
backgroundColor: this.user.avatarColor ? this.lightmode
? this.user.avatarColor
: this.user.avatarColor.startsWith('rgb(')
? this.user.avatarColor
: null
: null,
backgroundColor: this.user.avatarColor,
backgroundImage: this.lightmode ? null : `url(${this.url})`,
borderRadius: this.$store.state.settings.circleIcons ? '100%' : null
};

View File

@ -111,9 +111,7 @@ export default Vue.extend({
: false;
},
background(): string {
return this.file.properties.avgColor && this.file.properties.avgColor.length == 3
? `rgb(${this.file.properties.avgColor.join(',')})`
: 'transparent';
return this.file.properties.avgColor || 'transparent';
}
},
mounted() {
@ -122,10 +120,10 @@ export default Vue.extend({
},
methods: {
onThumbnailLoaded() {
if (this.file.properties.avgColor && this.file.properties.avgColor.length == 3) {
if (this.file.properties.avgColor) {
anime({
targets: this.$refs.thumbnail,
backgroundColor: `rgba(${this.file.properties.avgColor.join(',')}, 0)`,
backgroundColor: this.file.properties.avgColor.replace('255)', '0)'),
duration: 100,
easing: 'linear'
});

View File

@ -52,7 +52,7 @@ export default Vue.extend({
}
return {
'background-color': this.image.properties.avgColor && this.image.properties.avgColor.length == 3 ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent',
'background-color': this.image.properties.avgColor || 'transparent',
'background-image': url
};
}

View File

@ -11,7 +11,7 @@
<div class="file" v-if="message.file">
<a :href="message.file.url" target="_blank" :title="message.file.name">
<img v-if="message.file.type.split('/')[0] == 'image'" :src="message.file.url" :alt="message.file.name"
:style="{ backgroundColor: message.file.properties.avgColor && message.file.properties.avgColor.length == 3 ? `rgb(${message.file.properties.avgColor.join(',')})` : 'transparent' }"/>
:style="{ backgroundColor: message.file.properties.avgColor || 'transparent' }"/>
<p v-else>{{ message.file.name }}</p>
</a>
</div>

View File

@ -165,7 +165,7 @@ export default Vue.extend({
bannerStyle(): any {
if (this.$store.state.i.bannerUrl == null) return {};
return {
backgroundColor: this.$store.state.i.bannerColor ? this.$store.state.i.bannerColor : null,
backgroundColor: this.$store.state.i.bannerColor,
backgroundImage: `url(${ this.$store.state.i.bannerUrl })`
};
},

View File

@ -8,7 +8,7 @@
<div class="no-users" v-if="inited && us.length == 0">
<p>{{ $t('no-users') }}</p>
</div>
<div class="user" v-for="user in us">
<div class="user" v-for="user in us" :key="user.id">
<mk-avatar class="avatar" :user="user"/>
<div class="body" v-if="!iconOnly">
<div class="name">
@ -18,6 +18,7 @@
<div class="description" v-if="user.description" :title="user.description">
<mfm :text="user.description" :is-note="false" :author="user" :i="$store.state.i" :custom-emojis="user.emojis" :should-break="false" :plain-text="true"/>
</div>
<mk-follow-button class="follow-button" v-if="$store.getters.isSignedIn && user.id != $store.state.i.id" :user="user" mini/>
</div>
</div>
<button class="more" :class="{ fetching: fetchingMoreUsers }" v-if="cursor != null" @click="fetchMoreUsers()" :disabled="fetchingMoreUsers">
@ -50,7 +51,7 @@ export default Vue.extend({
fetchingMoreUsers: false,
us: [],
inited: false,
cursor: null
more: false
};
},
@ -160,6 +161,12 @@ export default Vue.extend({
text-overflow ellipsis
opacity 0.7
font-size 14px
padding-right 40px
> .follow-button
position absolute
top 8px
right 0px
> .more
display block

View File

@ -3,7 +3,7 @@
<x-notifications-column v-else-if="column.type == 'notifications'" :column="column" :is-stacked="isStacked" v-on="$listeners"/>
<x-tl-column v-else-if="column.type == 'home'" :column="column" :is-stacked="isStacked" v-on="$listeners"/>
<x-tl-column v-else-if="column.type == 'local'" :column="column" :is-stacked="isStacked" v-on="$listeners"/>
<x-tl-column v-else-if="column.type == 'social'" :column="column" :is-stacked="isStacked" v-on="$listeners"/>
<x-tl-column v-else-if="column.type == 'hybrid'" :column="column" :is-stacked="isStacked" v-on="$listeners"/>
<x-tl-column v-else-if="column.type == 'global'" :column="column" :is-stacked="isStacked" v-on="$listeners"/>
<x-tl-column v-else-if="column.type == 'list'" :column="column" :is-stacked="isStacked" v-on="$listeners"/>
<x-tl-column v-else-if="column.type == 'hashtag'" :column="column" :is-stacked="isStacked" v-on="$listeners"/>

View File

@ -28,12 +28,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -37,12 +37,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -41,12 +41,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -41,12 +41,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -27,12 +27,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -26,8 +26,8 @@
</template>
</component>
<footer v-if="cursor != null">
<button @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
<footer v-if="more">
<button @click="fetchMore()" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
<template v-if="!moreFetching">{{ $t('@.load-more') }}</template>
<template v-if="moreFetching"><fa icon="spinner" pulse fixed-width/></template>
</button>
@ -61,7 +61,7 @@ export default Vue.extend({
fetching: true,
moreFetching: false,
inited: false,
cursor: null
more: false
};
},
@ -119,7 +119,7 @@ export default Vue.extend({
this.notes = x;
} else {
this.notes = x.notes;
this.cursor = x.cursor;
this.more = x.more;
}
this.inited = true;
this.fetching = false;
@ -129,12 +129,12 @@ export default Vue.extend({
});
},
more() {
if (this.cursor == null || this.moreFetching) return;
fetchMore() {
if (!this.more || this.moreFetching) return;
this.moreFetching = true;
this.makePromise(this.cursor).then(x => {
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
this.notes = this.notes.concat(x.notes);
this.cursor = x.cursor;
this.more = x.more;
this.moreFetching = false;
}, e => {
this.moreFetching = false;
@ -157,6 +157,7 @@ export default Vue.extend({
// オーバーフローしたら古い投稿は捨てる
if (this.notes.length >= displayLimit) {
this.notes = this.notes.slice(0, displayLimit);
this.more = true;
}
} else {
this.queue.push(note);
@ -179,7 +180,7 @@ export default Vue.extend({
},
onBottom() {
this.more();
this.fetchMore();
}
}
});

View File

@ -39,7 +39,7 @@ export default Vue.extend({
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -3,7 +3,7 @@
<template #header>
<fa v-if="column.type == 'home'" icon="home"/>
<fa v-if="column.type == 'local'" :icon="['far', 'comments']"/>
<fa v-if="column.type == 'social'" icon="share-alt"/>
<fa v-if="column.type == 'hybrid'" icon="share-alt"/>
<fa v-if="column.type == 'global'" icon="globe"/>
<fa v-if="column.type == 'list'" icon="list"/>
<fa v-if="column.type == 'hashtag'" icon="hashtag"/>
@ -80,7 +80,7 @@ export default Vue.extend({
switch (this.column.type) {
case 'home': return this.$t('@deck.home');
case 'local': return this.$t('@deck.local');
case 'social': return this.$t('@deck.social');
case 'hybrid': return this.$t('@deck.hybrid');
case 'global': return this.$t('@deck.global');
case 'list': return this.column.list.name;
case 'hashtag': return this.$store.state.settings.tagTimelines.find(x => x.id == this.column.tagTlId).title;

View File

@ -51,7 +51,7 @@ export default Vue.extend({
switch (this.src) {
case 'home': return this.$root.stream.useSharedConnection('homeTimeline');
case 'local': return this.$root.stream.useSharedConnection('localTimeline');
case 'social': return this.$root.stream.useSharedConnection('socialTimeline');
case 'hybrid': return this.$root.stream.useSharedConnection('hybridTimeline');
case 'global': return this.$root.stream.useSharedConnection('globalTimeline');
}
},
@ -60,7 +60,7 @@ export default Vue.extend({
switch (this.src) {
case 'home': return 'notes/timeline';
case 'local': return 'notes/local-timeline';
case 'social': return 'notes/social-timeline';
case 'hybrid': return 'notes/hybrid-timeline';
case 'global': return 'notes/global-timeline';
}
},
@ -85,12 +85,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
});
@ -107,7 +107,7 @@ export default Vue.extend({
this.$root.getMeta().then(meta => {
this.disabled = !this.$store.state.i.isModerator && !this.$store.state.i.isAdmin && (
meta.disableLocalTimeline && ['local', 'social'].includes(this.src) ||
meta.disableLocalTimeline && ['local', 'hybrid'].includes(this.src) ||
meta.disableGlobalTimeline && ['global'].includes(this.src));
});
},

View File

@ -95,12 +95,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
});

View File

@ -8,7 +8,7 @@
<div class="is-remote" v-if="user.host != null">
<details>
<summary><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}</summary>
<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a>
<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a>
</details>
</div>
<header :style="bannerStyle">
@ -88,7 +88,7 @@ export default Vue.extend({
if (this.user == null) return {};
if (this.user.bannerUrl == null) return {};
return {
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
backgroundColor: this.user.bannerColor,
backgroundImage: `url(${ this.user.bannerUrl })`
};
},

View File

@ -145,11 +145,11 @@ export default Vue.extend({
}
}, {
icon: 'share-alt',
text: this.$t('@deck.social'),
text: this.$t('@deck.hybrid'),
action: () => {
this.$store.commit('device/addDeckColumn', {
id: uuid(),
type: 'social'
type: 'hybrid'
});
}
}, {
@ -302,7 +302,7 @@ export default Vue.extend({
isTlColumn(id) {
const column = this.columns.find(c => c.id === id);
return ['home', 'local', 'social', 'global', 'list', 'hashtag', 'mentions', 'direct'].includes(column.type);
return ['home', 'local', 'hybrid', 'global', 'list', 'hashtag', 'mentions', 'direct'].includes(column.type);
}
}
});

View File

@ -57,7 +57,7 @@ export default Vue.extend({
bannerStyle(): any {
if (this.user.bannerUrl == null) return {};
return {
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
backgroundColor: this.user.bannerColor,
backgroundImage: `url(${ this.user.bannerUrl })`
};
}

View File

@ -30,7 +30,7 @@ export default Vue.extend({
} else {
return {
users: followings.map(following => following.follower),
cursor: null
more: false
};
}
}),

View File

@ -30,7 +30,7 @@ export default Vue.extend({
} else {
return {
users: followings.map(following => following.followee),
cursor: null
more: false
};
}
}),

View File

@ -176,10 +176,22 @@ export default define({
post() {
this.posting = true;
let visibility = 'public';
let localOnly = false;
const m = this.$store.state.settings.defaultNoteVisibility.match(/^local-(.+)/);
if (m) {
visibility = m[1];
localOnly = true;
} else {
visibility = this.$store.state.settings.defaultNoteVisibility;
}
this.$root.api('notes/create', {
text: this.text == '' ? undefined : this.text,
fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
visibility: this.$store.state.settings.defaultNoteVisibility
visibility,
localOnly,
}).then(data => {
this.clear();
}).catch(err => {

View File

@ -139,10 +139,10 @@ export default Vue.extend({
},
onThumbnailLoaded() {
if (this.file.properties.avgColor && this.file.properties.avgColor.length == 3) {
if (this.file.properties.avgColor) {
anime({
targets: this.$refs.thumbnail,
backgroundColor: `rgba(${this.file.properties.avgColor.join(',')}, 0)`,
backgroundColor: this.file.properties.avgColor.replace('255)', '0)'),
duration: 100,
easing: 'linear'
});

View File

@ -25,8 +25,8 @@
</template>
</component>
<footer v-if="cursor != null">
<button @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
<footer v-if="more">
<button @click="fetchMore()" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
<template v-if="!moreFetching">{{ $t('@.load-more') }}</template>
<template v-if="moreFetching"><fa icon="spinner" pulse fixed-width/></template>
</button>
@ -58,7 +58,7 @@ export default Vue.extend({
fetching: true,
moreFetching: false,
inited: false,
cursor: null
more: false
};
},
@ -112,7 +112,7 @@ export default Vue.extend({
this.notes = x;
} else {
this.notes = x.notes;
this.cursor = x.cursor;
this.more = x.more;
}
this.inited = true;
this.fetching = false;
@ -122,12 +122,12 @@ export default Vue.extend({
});
},
more() {
if (this.cursor == null || this.moreFetching) return;
fetchMore() {
if (!this.more || this.moreFetching) return;
this.moreFetching = true;
this.makePromise(this.cursor).then(x => {
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
this.notes = this.notes.concat(x.notes);
this.cursor = x.cursor;
this.more = x.more;
this.moreFetching = false;
}, e => {
this.moreFetching = false;
@ -157,6 +157,7 @@ export default Vue.extend({
// オーバーフローしたら古い投稿は捨てる
if (this.notes.length >= displayLimit) {
this.notes = this.notes.slice(0, displayLimit);
this.more = true;
}
} else {
this.queue.push(note);
@ -181,7 +182,7 @@ export default Vue.extend({
if (this.$store.state.settings.fetchOnScroll !== false) {
const current = window.scrollY + window.innerHeight;
if (current > document.body.offsetHeight - 8) this.more();
if (current > document.body.offsetHeight - 8) this.fetchMore();
}
}
}

View File

@ -30,12 +30,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -6,7 +6,7 @@
</template>
</sequential-entrance>
<div class="more" v-if="existMore">
<ui-button inline @click="more">{{ $t('@.load-more') }}</ui-button>
<ui-button inline @click="fetchMore()">{{ $t('@.load-more') }}</ui-button>
</div>
</div>
</template>
@ -48,7 +48,7 @@ export default Vue.extend({
Progress.done();
});
},
more() {
fetchMore() {
this.moreFetching = true;
this.$root.api('i/favorites', {
limit: 11,

View File

@ -35,7 +35,7 @@ export default Vue.extend({
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -35,7 +35,7 @@ export default Vue.extend({
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -77,9 +77,9 @@ export default Vue.extend({
this.endpoint = 'notes/local-timeline';
this.connection = this.$root.stream.useSharedConnection('localTimeline');
this.connection.on('note', prepend);
} else if (this.src == 'social') {
this.endpoint = 'notes/social-timeline';
this.connection = this.$root.stream.useSharedConnection('socialTimeline');
} else if (this.src == 'hybrid') {
this.endpoint = 'notes/hybrid-timeline';
this.connection = this.$root.stream.useSharedConnection('hybridTimeline');
this.connection.on('note', prepend);
} else if (this.src == 'global') {
this.endpoint = 'notes/global-timeline';
@ -113,12 +113,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
});

View File

@ -6,7 +6,7 @@
<header class="zahtxcqi">
<span :data-active="src == 'home'" @click="src = 'home'"><fa icon="home"/> {{ $t('home') }}</span>
<span :data-active="src == 'local'" @click="src = 'local'" v-if="enableLocalTimeline"><fa :icon="['far', 'comments']"/> {{ $t('local') }}</span>
<span :data-active="src == 'social'" @click="src = 'social'" v-if="enableLocalTimeline"><fa icon="share-alt"/> {{ $t('social') }}</span>
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline"><fa icon="share-alt"/> {{ $t('hybrid') }}</span>
<span :data-active="src == 'global'" @click="src = 'global'" v-if="enableGlobalTimeline"><fa icon="globe"/> {{ $t('global') }}</span>
<span :data-active="src == 'tag'" @click="src = 'tag'" v-if="tagTl"><fa icon="hashtag"/> {{ tagTl.title }}</span>
<span :data-active="src == 'list'" @click="src = 'list'" v-if="list"><fa icon="list"/> {{ list.name }}</span>
@ -78,7 +78,7 @@ export default Vue.extend({
) && this.src === 'global') this.src = 'local';
if (!(
this.enableLocalTimeline = !meta.disableLocalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin
) && ['local', 'social'].includes(this.src)) this.src = 'home';
) && ['local', 'hybrid'].includes(this.src)) this.src = 'home';
});
if (this.$store.state.device.tl) {
@ -89,7 +89,7 @@ export default Vue.extend({
this.tagTl = this.$store.state.device.tl.arg;
}
} else if (this.$store.state.i.followingCount == 0) {
this.src = 'social';
this.src = 'hybrid';
}
},

View File

@ -4,7 +4,7 @@
<fa icon="exclamation-triangle"/> {{ $t('@.user-suspended') }}
</div>
<div class="is-remote" v-if="user.host != null" :class="{ shadow: $store.state.device.useShadow, round: $store.state.device.roundedCorners }">
<fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a>
<fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a>
</div>
<div class="main">
<x-header class="header" :user="user"/>

View File

@ -65,7 +65,7 @@ export default Vue.extend({
style(): any {
if (this.user.bannerUrl == null) return {};
return {
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
backgroundColor: this.user.bannerColor,
backgroundImage: `url(${ this.user.bannerUrl })`
};
},

View File

@ -42,12 +42,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -85,8 +85,8 @@ export default Vue.extend({
},
style(): any {
return this.file.properties.avgColor && this.file.properties.avgColor.length == 3 ? {
'background-color': `rgb(${ this.file.properties.avgColor.join(',') })`
return this.file.properties.avgColor ? {
'background-color': this.file.properties.avgColor
} : {};
},

View File

@ -21,8 +21,8 @@
</template>
</component>
<footer v-if="cursor != null">
<button @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
<footer v-if="more">
<button @click="fetchMore()" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
<template v-if="!moreFetching">{{ $t('@.load-more') }}</template>
<template v-if="moreFetching"><fa icon="spinner" pulse fixed-width/></template>
</button>
@ -53,7 +53,7 @@ export default Vue.extend({
fetching: true,
moreFetching: false,
inited: false,
cursor: null
more: false
};
},
@ -113,7 +113,7 @@ export default Vue.extend({
this.notes = x;
} else {
this.notes = x.notes;
this.cursor = x.cursor;
this.more = x.more;
}
this.inited = true;
this.fetching = false;
@ -123,12 +123,12 @@ export default Vue.extend({
});
},
more() {
if (this.cursor == null || this.moreFetching) return;
fetchMore() {
if (!this.more || this.moreFetching) return;
this.moreFetching = true;
this.makePromise(this.cursor).then(x => {
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
this.notes = this.notes.concat(x.notes);
this.cursor = x.cursor;
this.more = x.more;
this.moreFetching = false;
}, e => {
this.moreFetching = false;
@ -151,6 +151,7 @@ export default Vue.extend({
// オーバーフローしたら古い投稿は捨てる
if (this.notes.length >= displayLimit) {
this.notes = this.notes.slice(0, displayLimit);
this.more = true;
}
} else {
this.queue.push(note);
@ -180,7 +181,7 @@ export default Vue.extend({
if (this.$el.offsetHeight == 0) return;
const current = window.scrollY + window.innerHeight;
if (current > document.body.offsetHeight - 8) this.more();
if (current > document.body.offsetHeight - 8) this.fetchMore();
}
}
}

View File

@ -27,12 +27,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -27,12 +27,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -8,7 +8,7 @@
<mk-note-detail class="post" :note="favorite.note" :key="favorite.note.id"/>
</template>
</sequential-entrance>
<ui-button v-if="existMore" @click="more">{{ $t('@.load-more') }}</ui-button>
<ui-button v-if="existMore" @click="fetchMore()">{{ $t('@.load-more') }}</ui-button>
</main>
</mk-ui>
</template>
@ -53,7 +53,7 @@ export default Vue.extend({
Progress.done();
});
},
more() {
fetchMore() {
this.moreFetching = true;
this.$root.api('i/favorites', {
limit: 11,

View File

@ -78,9 +78,9 @@ export default Vue.extend({
this.endpoint = 'notes/local-timeline';
this.connection = this.$root.stream.useSharedConnection('localTimeline');
this.connection.on('note', prepend);
} else if (this.src == 'social') {
this.endpoint = 'notes/social-timeline';
this.connection = this.$root.stream.useSharedConnection('socialTimeline');
} else if (this.src == 'hybrid') {
this.endpoint = 'notes/hybrid-timeline';
this.connection = this.$root.stream.useSharedConnection('hybridTimeline');
this.connection.on('note', prepend);
} else if (this.src == 'global') {
this.endpoint = 'notes/global-timeline';
@ -114,12 +114,12 @@ export default Vue.extend({
notes.pop();
return {
notes: notes,
cursor: notes[notes.length - 1].id
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
});

View File

@ -5,7 +5,7 @@
<span :class="$style.title">
<span v-if="src == 'home'"><fa icon="home"/>{{ $t('home') }}</span>
<span v-if="src == 'local'"><fa :icon="['far', 'comments']"/>{{ $t('local') }}</span>
<span v-if="src == 'social'"><fa icon="share-alt"/>{{ $t('social') }}</span>
<span v-if="src == 'hybrid'"><fa icon="share-alt"/>{{ $t('hybrid') }}</span>
<span v-if="src == 'global'"><fa icon="globe"/>{{ $t('global') }}</span>
<span v-if="src == 'mentions'"><fa icon="at"/>{{ $t('mentions') }}</span>
<span v-if="src == 'messages'"><fa :icon="['far', 'envelope']"/>{{ $t('messages') }}</span>
@ -32,7 +32,7 @@
<div>
<span :data-active="src == 'home'" @click="src = 'home'"><fa icon="home"/> {{ $t('home') }}</span>
<span :data-active="src == 'local'" @click="src = 'local'" v-if="enableLocalTimeline"><fa :icon="['far', 'comments']"/> {{ $t('local') }}</span>
<span :data-active="src == 'social'" @click="src = 'social'" v-if="enableLocalTimeline"><fa icon="share-alt"/> {{ $t('social') }}</span>
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline"><fa icon="share-alt"/> {{ $t('hybrid') }}</span>
<span :data-active="src == 'global'" @click="src = 'global'" v-if="enableGlobalTimeline"><fa icon="globe"/> {{ $t('global') }}</span>
<div class="hr"></div>
<span :data-active="src == 'mentions'" @click="src = 'mentions'"><fa icon="at"/> {{ $t('mentions') }}<i class="badge" v-if="$store.state.i.hasUnreadMentions"><fa icon="circle"/></i></span>
@ -50,7 +50,7 @@
<div class="tl">
<x-tl v-if="src == 'home'" ref="tl" key="home" src="home"/>
<x-tl v-if="src == 'local'" ref="tl" key="local" src="local"/>
<x-tl v-if="src == 'social'" ref="tl" key="social" src="social"/>
<x-tl v-if="src == 'hybrid'" ref="tl" key="hybrid" src="hybrid"/>
<x-tl v-if="src == 'global'" ref="tl" key="global" src="global"/>
<x-tl v-if="src == 'mentions'" ref="tl" key="mentions" src="mentions"/>
<x-tl v-if="src == 'messages'" ref="tl" key="messages" src="messages"/>
@ -120,7 +120,7 @@ export default Vue.extend({
) && this.src === 'global') this.src = 'local';
if (!(
this.enableLocalTimeline = !meta.disableLocalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin
) && ['local', 'social'].includes(this.src)) this.src = 'home';
) && ['local', 'hybrid'].includes(this.src)) this.src = 'home';
});
if (this.$store.state.device.tl) {
@ -131,7 +131,7 @@ export default Vue.extend({
this.tagTl = this.$store.state.device.tl.arg;
}
} else if (this.$store.state.i.followingCount == 0) {
this.src = 'social';
this.src = 'hybrid';
}
},

View File

@ -21,19 +21,19 @@ export default Vue.extend({
return {
makePromise: cursor => this.$root.api('notes/search', {
limit: limit + 1,
offset: cursor ? cursor : undefined,
untilId: cursor ? cursor : undefined,
query: this.q
}).then(notes => {
if (notes.length == limit + 1) {
notes.pop();
return {
notes: notes,
cursor: cursor ? cursor + limit : limit
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -21,19 +21,19 @@ export default Vue.extend({
return {
makePromise: cursor => this.$root.api('notes/search-by-tag', {
limit: limit + 1,
offset: cursor ? cursor : undefined,
untilId: cursor ? cursor : undefined,
tag: this.$route.params.tag
}).then(notes => {
if (notes.length == limit + 1) {
notes.pop();
return {
notes: notes,
cursor: cursor ? cursor + limit : limit
more: true
};
} else {
return {
notes: notes,
cursor: null
more: false
};
}
})

View File

@ -4,7 +4,7 @@
<div class="stream" v-if="!fetching && images.length > 0">
<a v-for="(image, i) in images" :key="i"
class="img"
:style="`background-image: url(${thumbnail(image.media)})`"
:style="`background-image: url(${thumbnail(image.file)})`"
:href="image.note | notePage"
></a>
</div>
@ -40,11 +40,11 @@ export default Vue.extend({
untilDate: new Date().getTime() + 1000 * 86400 * 365
}).then(notes => {
for (const note of notes) {
for (const media of note.media) {
for (const file of note.files) {
if (this.images.length < 9) {
this.images.push({
note,
media
file
});
}
}

View File

@ -5,7 +5,7 @@
</template>
<div class="wwtwuxyh" v-if="!fetching">
<div class="is-suspended" v-if="user.isSuspended"><p><fa icon="exclamation-triangle"/> {{ $t('@.user-suspended') }}</p></div>
<div class="is-remote" v-if="user.host != null"><p><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a></p></div>
<div class="is-remote" v-if="user.host != null"><p><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a></p></div>
<header>
<div class="banner" :style="style"></div>
<div class="body">
@ -114,7 +114,7 @@ export default Vue.extend({
style(): any {
if (this.user.bannerUrl == null) return {};
return {
backgroundColor: this.user.bannerColor && this.user.bannerColor.length == 3 ? `rgb(${ this.user.bannerColor.join(',') })` : null,
backgroundColor: this.user.bannerColor,
backgroundImage: `url(${ this.user.bannerUrl })`
};
}

View File

@ -7,7 +7,7 @@
kind: 'light',
vars: {
primary: '#fb4e4e',
primary: '#f18570',
secondary: '#fff',
text: '#666',
},

View File

@ -25,11 +25,11 @@ export default function load() {
const mixin = {} as Mixin;
const url = validateUrl(config.url);
const url = tryCreateUrl(config.url);
config.url = normalizeUrl(config.url);
config.url = url.origin;
config.port = config.port || parseInt(process.env.PORT, 10);
config.port = config.port || parseInt(process.env.PORT || '', 10);
mixin.host = url.host;
mixin.hostname = url.hostname;
@ -53,14 +53,3 @@ function tryCreateUrl(url: string) {
throw `url="${url}" is not a valid URL.`;
}
}
function validateUrl(url: string) {
const result = tryCreateUrl(url);
if (result.pathname.replace('/', '').length) throw `url="${url}" is not a valid URL, has a pathname.`;
if (!url.includes(result.host)) throw `url="${url}" is not a valid URL, has an invalid hostname.`;
return result;
}
function normalizeUrl(url: string) {
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
}

111
src/crypto_key.cc Normal file
View File

@ -0,0 +1,111 @@
#include <nan.h>
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/crypto.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
NAN_METHOD(extractPublic)
{
const auto sourceString = info[0]->ToString(Nan::GetCurrentContext()).ToLocalChecked();
if (!sourceString->IsOneByte()) {
Nan::ThrowError("Malformed character found");
return;
}
size_t sourceLength = sourceString->Length();
const auto sourceBuf = new char[sourceLength];
Nan::DecodeWrite(sourceBuf, sourceLength, sourceString);
const auto source = BIO_new_mem_buf(sourceBuf, sourceLength);
if (source == nullptr) {
Nan::ThrowError("Memory allocation failed");
delete[] sourceBuf;
return;
}
const auto rsa = PEM_read_bio_RSAPrivateKey(source, nullptr, nullptr, nullptr);
BIO_free(source);
delete[] sourceBuf;
if (rsa == nullptr) {
Nan::ThrowError("Decode failed");
return;
}
const auto destination = BIO_new(BIO_s_mem());
if (destination == nullptr) {
Nan::ThrowError("Memory allocation failed");
return;
}
const auto result = PEM_write_bio_RSAPublicKey(destination, rsa);
RSA_free(rsa);
if (result != 1) {
Nan::ThrowError("Public key extraction failed");
BIO_free(destination);
return;
}
char *pem;
const auto pemLength = BIO_get_mem_data(destination, &pem);
info.GetReturnValue().Set(Nan::Encode(pem, pemLength));
BIO_free(destination);
}
NAN_METHOD(generate)
{
const auto exponent = BN_new();
const auto mem = BIO_new(BIO_s_mem());
const auto rsa = RSA_new();
char *data;
long result;
if (exponent == nullptr || mem == nullptr || rsa == nullptr) {
Nan::ThrowError("Memory allocation failed");
goto done;
}
result = BN_set_word(exponent, 65537);
if (result != 1) {
Nan::ThrowError("Exponent setting failed");
goto done;
}
result = RSA_generate_key_ex(rsa, 2048, exponent, nullptr);
if (result != 1) {
Nan::ThrowError("Key generation failed");
goto done;
}
result = PEM_write_bio_RSAPrivateKey(mem, rsa, NULL, NULL, 0, NULL, NULL);
if (result != 1) {
Nan::ThrowError("Key export failed");
goto done;
}
result = BIO_get_mem_data(mem, &data);
info.GetReturnValue().Set(Nan::Encode(data, result));
done:
RSA_free(rsa);
BIO_free(mem);
BN_free(exponent);
}
NAN_MODULE_INIT(InitAll)
{
Nan::Set(target, Nan::New<v8::String>("extractPublic").ToLocalChecked(),
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(extractPublic)).ToLocalChecked());
Nan::Set(target, Nan::New<v8::String>("generate").ToLocalChecked(),
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(generate)).ToLocalChecked());
}
NODE_MODULE(crypto_key, InitAll);

2
src/crypto_key.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export function extractPublic(keypair: string): string;
export function generate(): string;

View File

@ -19,7 +19,7 @@ initDb().then(() => {
all, local
};
process.send(stats);
process.send!(stats);
}
tick();

View File

@ -36,10 +36,10 @@ import { Emoji } from '../models/entities/emoji';
import { ReversiGame } from '../models/entities/games/reversi/game';
import { ReversiMatching } from '../models/entities/games/reversi/matching';
import { UserNotePining } from '../models/entities/user-note-pinings';
import { UserServiceLinking } from '../models/entities/user-service-linking';
import { Poll } from '../models/entities/poll';
import { UserKeypair } from '../models/entities/user-keypair';
import { UserPublickey } from '../models/entities/user-publickey';
import { UserProfile } from '../models/entities/user-profile';
const sqlLogger = dbLogger.createSubLogger('sql', 'white', false);
@ -76,7 +76,7 @@ class MyCustomLogger implements Logger {
}
export function initDb(justBorrow = false, sync = false, log = false) {
const enableLogging = log || !['production', 'test'].includes(process.env.NODE_ENV);
const enableLogging = log || !['production', 'test'].includes(process.env.NODE_ENV || '');
try {
const conn = getConnection();
@ -93,7 +93,7 @@ export function initDb(justBorrow = false, sync = false, log = false) {
synchronize: process.env.NODE_ENV === 'test' || sync,
dropSchema: process.env.NODE_ENV === 'test' && !justBorrow,
logging: enableLogging,
logger: enableLogging ? new MyCustomLogger() : null,
logger: enableLogging ? new MyCustomLogger() : undefined,
entities: [
Meta,
Instance,
@ -101,12 +101,12 @@ export function initDb(justBorrow = false, sync = false, log = false) {
AuthSession,
AccessToken,
User,
UserProfile,
UserKeypair,
UserPublickey,
UserList,
UserListJoining,
UserNotePining,
UserServiceLinking,
Following,
FollowRequest,
Muting,

View File

@ -339,7 +339,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
#### `note`
ローカルタイムラインに新しい投稿が流れてきたときに発生するイベントです。
## `socialTimeline`
## `hybridTimeline`
ソーシャルタイムラインの投稿情報が流れてきます。このチャンネルにパラメータはありません。
### 流れてくるイベント一覧

View File

@ -37,7 +37,7 @@ export type Undo = {
/**
* ターン
*/
turn: Color;
turn: Color | null;
};
/**
@ -47,12 +47,12 @@ export default class Reversi {
public map: MapPixel[];
public mapWidth: number;
public mapHeight: number;
public board: Color[];
public turn: Color = BLACK;
public board: (Color | null | undefined)[];
public turn: Color | null = BLACK;
public opts: Options;
public prevPos = -1;
public prevColor: Color = null;
public prevColor: Color | null = null;
private logs: Undo[] = [];
@ -145,12 +145,12 @@ export default class Reversi {
// ターン計算
this.turn =
this.canPutSomewhere(!this.prevColor) ? !this.prevColor :
this.canPutSomewhere(this.prevColor) ? this.prevColor :
this.canPutSomewhere(this.prevColor!) ? this.prevColor :
null;
}
public undo() {
const undo = this.logs.pop();
const undo = this.logs.pop()!;
this.prevColor = undo.color;
this.prevPos = undo.pos;
this.board[undo.pos] = null;
@ -254,10 +254,10 @@ export default class Reversi {
/**
* ゲームの勝者 (null = 引き分け)
*/
public get winner(): Color {
public get winner(): Color | null {
return this.isEnded ?
this.blackCount == this.whiteCount ? null :
this.opts.isLlotheo === this.blackCount > this.whiteCount ? WHITE : BLACK :
undefined;
undefined as never;
}
}

View File

@ -1,16 +1,10 @@
import { initDb } from './db/postgre';
async function main() {
try {
console.log('Connecting database...');
await initDb(false, true, true);
} catch (e) {
console.error('Cannot connect to database', null, true);
console.error(e);
process.exit(1);
}
console.log('Init database...');
initDb(false, true, true).then(() => {
console.log('Done :)');
}
main();
}, e => {
console.error('Failed to init database');
console.error(e);
});

View File

@ -3,8 +3,6 @@ import { URL } from 'url';
import { urlRegex } from './prelude';
export function fromHtml(html: string): string {
if (html == null) return null;
const dom = parseFragment(html) as DefaultTreeDocumentFragment;
let text = '';

View File

@ -2,7 +2,7 @@ import { mfmLanguage } from './language';
import { MfmForest } from './prelude';
import { normalize } from './normalize';
export function parse(source: string): MfmForest {
export function parse(source: string | null): MfmForest | null {
if (source == null || source == '') {
return null;
}
@ -10,7 +10,7 @@ export function parse(source: string): MfmForest {
return normalize(mfmLanguage.root.tryParse(source));
}
export function parsePlain(source: string): MfmForest {
export function parsePlain(source: string | null): MfmForest | null {
if (source == null || source == '') {
return null;
}

View File

@ -4,7 +4,7 @@ import { intersperse } from '../prelude/array';
import { MfmForest, MfmTree } from './prelude';
import { IMentionedRemoteUsers } from '../models/entities/note';
export function toHtml(tokens: MfmForest, mentionedRemoteUsers: IMentionedRemoteUsers = []) {
export function toHtml(tokens: MfmForest | null, mentionedRemoteUsers: IMentionedRemoteUsers = []) {
if (tokens == null) {
return null;
}

497
src/migrate.ts Normal file
View File

@ -0,0 +1,497 @@
process.env.NODE_ENV = 'production';
import monk from 'monk';
import * as mongo from 'mongodb';
import * as fs from 'fs';
import * as uuid from 'uuid';
import chalk from 'chalk';
import config from './config';
import { initDb } from './db/postgre';
import { User } from './models/entities/user';
import { getRepository } from 'typeorm';
import generateUserToken from './server/api/common/generate-native-user-token';
import { DriveFile } from './models/entities/drive-file';
import { DriveFolder } from './models/entities/drive-folder';
import { InternalStorage } from './services/drive/internal-storage';
import { createTemp } from './misc/create-temp';
import { Note } from './models/entities/note';
import { Following } from './models/entities/following';
import { Poll } from './models/entities/poll';
import { PollVote } from './models/entities/poll-vote';
import { NoteFavorite } from './models/entities/note-favorite';
import { NoteReaction } from './models/entities/note-reaction';
import { UserPublickey } from './models/entities/user-publickey';
import { UserKeypair } from './models/entities/user-keypair';
import { extractPublic } from './crypto_key';
import { Emoji } from './models/entities/emoji';
import { toPuny } from './misc/convert-host';
import { UserProfile } from './models/entities/user-profile';
const u = (config as any).mongodb.user ? encodeURIComponent((config as any).mongodb.user) : null;
const p = (config as any).mongodb.pass ? encodeURIComponent((config as any).mongodb.pass) : null;
const uri = `mongodb://${u && p ? `${u}:${p}@` : ''}${(config as any).mongodb.host}:${(config as any).mongodb.port}/${(config as any).mongodb.db}`;
const db = monk(uri);
let mdb: mongo.Db;
const test = false;
const limit = 500;
const nativeDbConn = async (): Promise<mongo.Db> => {
if (mdb) return mdb;
const db = await ((): Promise<mongo.Db> => new Promise((resolve, reject) => {
mongo.MongoClient.connect(uri, { useNewUrlParser: true }, (e: Error, client: any) => {
if (e) return reject(e);
resolve(client.db((config as any).mongodb.db));
});
}))();
mdb = db;
return db;
};
const _User = db.get<any>('users');
const _DriveFile = db.get<any>('driveFiles.files');
const _DriveFolder = db.get<any>('driveFolders');
const _Note = db.get<any>('notes');
const _Following = db.get<any>('following');
const _PollVote = db.get<any>('pollVotes');
const _Favorite = db.get<any>('favorites');
const _NoteReaction = db.get<any>('noteReactions');
const _Emoji = db.get<any>('emoji');
const getDriveFileBucket = async (): Promise<mongo.GridFSBucket> => {
const db = await nativeDbConn();
const bucket = new mongo.GridFSBucket(db, {
bucketName: 'driveFiles'
});
return bucket;
};
async function main() {
await initDb();
const Users = getRepository(User);
const UserProfiles = getRepository(UserProfile);
const DriveFiles = getRepository(DriveFile);
const DriveFolders = getRepository(DriveFolder);
const Notes = getRepository(Note);
const Followings = getRepository(Following);
const Polls = getRepository(Poll);
const PollVotes = getRepository(PollVote);
const NoteFavorites = getRepository(NoteFavorite);
const NoteReactions = getRepository(NoteReaction);
const UserPublickeys = getRepository(UserPublickey);
const UserKeypairs = getRepository(UserKeypair);
const Emojis = getRepository(Emoji);
async function migrateUser(user: any) {
await Users.save({
id: user._id.toHexString(),
createdAt: user.createdAt || new Date(),
username: user.username,
usernameLower: user.username.toLowerCase(),
host: toPuny(user.host),
token: generateUserToken(),
isAdmin: user.isAdmin || false,
name: user.name,
followersCount: user.followersCount || 0,
followingCount: user.followingCount || 0,
notesCount: user.notesCount || 0,
isBot: user.isBot || false,
isCat: user.isCat || false,
isVerified: user.isVerified || false,
inbox: user.inbox,
sharedInbox: user.sharedInbox,
uri: user.uri,
});
await UserProfiles.save({
userId: user._id.toHexString(),
description: user.description,
userHost: toPuny(user.host),
autoAcceptFollowed: true,
autoWatch: false,
password: user.password,
location: user.profile ? user.profile.location : null,
birthday: user.profile ? user.profile.birthday : null,
});
if (user.publicKey) {
await UserPublickeys.save({
userId: user._id.toHexString(),
keyId: user.publicKey.id,
keyPem: user.publicKey.publicKeyPem
});
}
if (user.keypair) {
await UserKeypairs.save({
userId: user._id.toHexString(),
publicKey: extractPublic(user.keypair),
privateKey: user.keypair,
});
}
}
async function migrateFollowing(following: any) {
await Followings.save({
id: following._id.toHexString(),
createdAt: new Date(),
followerId: following.followerId.toHexString(),
followeeId: following.followeeId.toHexString(),
// 非正規化
followerHost: following._follower ? toPuny(following._follower.host) : null,
followerInbox: following._follower ? following._follower.inbox : null,
followerSharedInbox: following._follower ? following._follower.sharedInbox : null,
followeeHost: following._followee ? toPuny(following._followee.host) : null,
followeeInbox: following._followee ? following._followee.inbox : null,
followeeSharedInbox: following._followee ? following._followee.sharedInbo : null
});
}
async function migrateDriveFolder(folder: any) {
await DriveFolders.save({
id: folder._id.toHexString(),
createdAt: folder.createdAt || new Date(),
name: folder.name,
parentId: folder.parentId ? folder.parentId.toHexString() : null,
});
}
async function migrateDriveFile(file: any) {
const user = await _User.findOne({
_id: file.metadata.userId
});
if (user == null) return;
if (file.metadata.storage && file.metadata.storage.key) { // when object storage
await DriveFiles.save({
id: file._id.toHexString(),
userId: user._id.toHexString(),
userHost: toPuny(user.host),
createdAt: file.uploadDate || new Date(),
md5: file.md5,
name: file.filename,
type: file.contentType,
properties: file.metadata.properties || {},
size: file.length,
url: file.metadata.url,
uri: file.metadata.uri,
accessKey: file.metadata.storage.key,
folderId: file.metadata.folderId ? file.metadata.folderId.toHexString() : null,
storedInternal: false,
isLink: false
});
} else if (!file.metadata.isLink) {
const [temp, clean] = await createTemp();
await new Promise(async (res, rej) => {
const bucket = await getDriveFileBucket();
const readable = bucket.openDownloadStream(file._id);
const dest = fs.createWriteStream(temp);
readable.pipe(dest);
readable.on('end', () => {
dest.end();
res();
});
});
const key = uuid.v4();
const url = InternalStorage.saveFromPath(key, temp);
await DriveFiles.save({
id: file._id.toHexString(),
userId: user._id.toHexString(),
userHost: toPuny(user.host),
createdAt: file.uploadDate || new Date(),
md5: file.md5,
name: file.filename,
type: file.contentType,
properties: file.metadata.properties,
size: file.length,
url: url,
uri: file.metadata.uri,
accessKey: key,
folderId: file.metadata.folderId ? file.metadata.folderId.toHexString() : null,
storedInternal: true,
isLink: false
});
clean();
} else {
await DriveFiles.save({
id: file._id.toHexString(),
userId: user._id.toHexString(),
userHost: toPuny(user.host),
createdAt: file.uploadDate || new Date(),
md5: file.md5,
name: file.filename,
type: file.contentType,
properties: file.metadata.properties,
size: file.length,
url: file.metadata.url,
uri: file.metadata.uri,
accessKey: null,
folderId: file.metadata.folderId ? file.metadata.folderId.toHexString() : null,
storedInternal: false,
isLink: true
});
}
}
async function migrateNote(note: any) {
await Notes.save({
id: note._id.toHexString(),
createdAt: note.createdAt || new Date(),
text: note.text,
cw: note.cw || null,
tags: note.tags || [],
userId: note.userId.toHexString(),
viaMobile: note.viaMobile || false,
geo: note.geo,
appId: null,
visibility: note.visibility || 'public',
visibleUserIds: note.visibleUserIds ? note.visibleUserIds.map((id: any) => id.toHexString()) : [],
replyId: note.replyId ? note.replyId.toHexString() : null,
renoteId: note.renoteId ? note.renoteId.toHexString() : null,
userHost: null,
fileIds: note.fileIds ? note.fileIds.map((id: any) => id.toHexString()) : [],
localOnly: note.localOnly || false,
hasPoll: note.poll != null
});
if (note.poll) {
await Polls.save({
noteId: note._id.toHexString(),
choices: note.poll.choices.map((x: any) => x.text),
expiresAt: note.poll.expiresAt,
multiple: note.poll.multiple,
votes: note.poll.choices.map((x: any) => x.votes),
noteVisibility: note.visibility,
userId: note.userId.toHexString(),
userHost: null
});
}
}
async function migratePollVote(vote: any) {
await PollVotes.save({
id: vote._id.toHexString(),
createdAt: vote.createdAt,
noteId: vote.noteId.toHexString(),
userId: vote.userId.toHexString(),
choice: vote.choice
});
}
async function migrateNoteFavorite(favorite: any) {
await NoteFavorites.save({
id: favorite._id.toHexString(),
createdAt: favorite.createdAt,
noteId: favorite.noteId.toHexString(),
userId: favorite.userId.toHexString(),
});
}
async function migrateNoteReaction(reaction: any) {
await NoteReactions.save({
id: reaction._id.toHexString(),
createdAt: reaction.createdAt,
noteId: reaction.noteId.toHexString(),
userId: reaction.userId.toHexString(),
reaction: reaction.reaction
});
}
async function reMigrateUser(user: any) {
const u = await _User.findOne({
_id: new mongo.ObjectId(user.id)
});
const avatar = u.avatarId ? await DriveFiles.findOne(u.avatarId.toHexString()) : null;
const banner = u.bannerId ? await DriveFiles.findOne(u.bannerId.toHexString()) : null;
await Users.update(user.id, {
avatarId: avatar ? avatar.id : null,
bannerId: banner ? banner.id : null,
avatarUrl: avatar ? avatar.url : null,
bannerUrl: banner ? banner.url : null
});
}
async function migrateEmoji(emoji: any) {
await Emojis.save({
id: emoji._id.toHexString(),
updatedAt: emoji.createdAt,
aliases: emoji.aliases,
url: emoji.url,
uri: emoji.uri,
host: toPuny(emoji.host),
name: emoji.name
});
}
let allUsersCount = await _User.count({
deletedAt: { $exists: false }
});
if (test && allUsersCount > limit) allUsersCount = limit;
for (let i = 0; i < allUsersCount; i++) {
const user = await _User.findOne({
deletedAt: { $exists: false }
}, {
skip: i
});
try {
await migrateUser(user);
console.log(`USER (${i + 1}/${allUsersCount}) ${user._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`USER (${i + 1}/${allUsersCount}) ${user._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
let allFollowingsCount = await _Following.count();
if (test && allFollowingsCount > limit) allFollowingsCount = limit;
for (let i = 0; i < allFollowingsCount; i++) {
const following = await _Following.findOne({}, {
skip: i
});
try {
await migrateFollowing(following);
console.log(`FOLLOWING (${i + 1}/${allFollowingsCount}) ${following._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`FOLLOWING (${i + 1}/${allFollowingsCount}) ${following._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
let allDriveFoldersCount = await _DriveFolder.count();
if (test && allDriveFoldersCount > limit) allDriveFoldersCount = limit;
for (let i = 0; i < allDriveFoldersCount; i++) {
const folder = await _DriveFolder.findOne({}, {
skip: i
});
try {
await migrateDriveFolder(folder);
console.log(`FOLDER (${i + 1}/${allDriveFoldersCount}) ${folder._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`FOLDER (${i + 1}/${allDriveFoldersCount}) ${folder._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
let allDriveFilesCount = await _DriveFile.count({
'metadata._user.host': null,
'metadata.deletedAt': { $exists: false }
});
if (test && allDriveFilesCount > limit) allDriveFilesCount = limit;
for (let i = 0; i < allDriveFilesCount; i++) {
const file = await _DriveFile.findOne({
'metadata._user.host': null,
'metadata.deletedAt': { $exists: false }
}, {
skip: i
});
try {
await migrateDriveFile(file);
console.log(`FILE (${i + 1}/${allDriveFilesCount}) ${file._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`FILE (${i + 1}/${allDriveFilesCount}) ${file._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
let allNotesCount = await _Note.count({
'_user.host': null,
'metadata.deletedAt': { $exists: false }
});
if (test && allNotesCount > limit) allNotesCount = limit;
for (let i = 0; i < allNotesCount; i++) {
const note = await _Note.findOne({
'_user.host': null,
'metadata.deletedAt': { $exists: false }
}, {
skip: i
});
try {
await migrateNote(note);
console.log(`NOTE (${i + 1}/${allNotesCount}) ${note._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`NOTE (${i + 1}/${allNotesCount}) ${note._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
let allPollVotesCount = await _PollVote.count();
if (test && allPollVotesCount > limit) allPollVotesCount = limit;
for (let i = 0; i < allPollVotesCount; i++) {
const vote = await _PollVote.findOne({}, {
skip: i
});
try {
await migratePollVote(vote);
console.log(`VOTE (${i + 1}/${allPollVotesCount}) ${vote._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`VOTE (${i + 1}/${allPollVotesCount}) ${vote._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
let allNoteFavoritesCount = await _Favorite.count();
if (test && allNoteFavoritesCount > limit) allNoteFavoritesCount = limit;
for (let i = 0; i < allNoteFavoritesCount; i++) {
const favorite = await _Favorite.findOne({}, {
skip: i
});
try {
await migrateNoteFavorite(favorite);
console.log(`FAVORITE (${i + 1}/${allNoteFavoritesCount}) ${favorite._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`FAVORITE (${i + 1}/${allNoteFavoritesCount}) ${favorite._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
let allNoteReactionsCount = await _NoteReaction.count();
if (test && allNoteReactionsCount > limit) allNoteReactionsCount = limit;
for (let i = 0; i < allNoteReactionsCount; i++) {
const reaction = await _NoteReaction.findOne({}, {
skip: i
});
try {
await migrateNoteReaction(reaction);
console.log(`REACTION (${i + 1}/${allNoteReactionsCount}) ${reaction._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`REACTION (${i + 1}/${allNoteReactionsCount}) ${reaction._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
let allActualUsersCount = await Users.count();
if (test && allActualUsersCount > limit) allActualUsersCount = limit;
for (let i = 0; i < allActualUsersCount; i++) {
const [user] = await Users.find({
take: 1,
skip: i
});
try {
await reMigrateUser(user);
console.log(`RE:USER (${i + 1}/${allActualUsersCount}) ${user.id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`RE:USER (${i + 1}/${allActualUsersCount}) ${user.id} ${chalk.red('ERR')}`);
console.error(e);
}
}
const allEmojisCount = await _Emoji.count();
for (let i = 0; i < allEmojisCount; i++) {
const emoji = await _Emoji.findOne({}, {
skip: i
});
try {
await migrateEmoji(emoji);
console.log(`EMOJI (${i + 1}/${allEmojisCount}) ${emoji._id} ${chalk.green('DONE')}`);
} catch (e) {
console.log(`EMOJI (${i + 1}/${allEmojisCount}) ${emoji._id} ${chalk.red('ERR')}`);
console.error(e);
}
}
console.log('DONE :)');
}
main();

View File

@ -1,5 +1,5 @@
import Acct from './type';
export default (user: Acct) => {
return user.host === null ? user.username : `${user.username}@${user.host}`;
return user.host == null ? user.username : `${user.username}@${user.host}`;
};

View File

@ -1,6 +1,6 @@
type Acct = {
username: string;
host: string;
host: string | null;
};
export default Acct;

View File

@ -1,27 +1,21 @@
import config from '../config';
import { toUnicode, toASCII } from 'punycode';
import { toASCII } from 'punycode';
import { URL } from 'url';
export function getFullApAccount(username: string, host: string) {
return host ? `${username}@${toApHost(host)}` : `${username}@${toApHost(config.host)}`;
export function getFullApAccount(username: string, host: string | null) {
return host ? `${username}@${toPuny(host)}` : `${username}@${toPuny(config.host)}`;
}
export function isSelfHost(host: string) {
if (host == null) return true;
return toApHost(config.host) === toApHost(host);
return toPuny(config.host) === toPuny(host);
}
export function extractDbHost(uri: string) {
const url = new URL(uri);
return toDbHost(url.hostname);
return toPuny(url.hostname);
}
export function toDbHost(host: string) {
if (host == null) return null;
return toUnicode(host.toLowerCase());
}
export function toApHost(host: string) {
if (host == null) return null;
export function toPuny(host: string) {
return toASCII(host.toLowerCase());
}

View File

@ -3,7 +3,7 @@ import fileType from 'file-type';
import checkSvg from '../misc/check-svg';
export async function detectMine(path: string) {
return new Promise<[string, string]>((res, rej) => {
return new Promise<[string, string | null]>((res, rej) => {
const readable = fs.createReadStream(path);
readable
.on('error', rej)

View File

@ -1,5 +1,4 @@
import * as fs from 'fs';
import * as URL from 'url';
import * as request from 'request';
import config from '../config';
import chalk from 'chalk';
@ -26,7 +25,7 @@ export async function downloadUrl(url: string, path: string) {
rej(error);
});
const requestUrl = URL.parse(url).pathname.match(/[^\u0021-\u00ff]/) ? encodeURI(url) : url;
const requestUrl = new URL(url).pathname.match(/[^\u0021-\u00ff]/) ? encodeURI(url) : url;
const req = request({
url: requestUrl,

View File

@ -9,7 +9,6 @@ export default async function(): Promise<Meta> {
} else {
return Metas.save({
id: genId(),
hiddenTags: []
} as Meta);
}
}

View File

@ -1,8 +1,9 @@
import fetchMeta from './fetch-meta';
import { ILocalUser } from '../models/entities/user';
import { Users } from '../models';
import { ensure } from '../prelude/ensure';
export async function fetchProxyAccount(): Promise<ILocalUser> {
const meta = await fetchMeta();
return await Users.findOne({ username: meta.proxyAccount, host: null }) as ILocalUser;
return await Users.findOne({ username: meta.proxyAccount!, host: null }).then(ensure) as ILocalUser;
}

View File

@ -1,19 +0,0 @@
import getAcct from './acct/render';
import getUserName from './get-user-name';
import { User } from '../models/entities/user';
import { Users } from '../models';
/**
* ユーザーを表す文字列を取得します。
* @param user ユーザー
*/
export default function(user: User): string {
let string = `${getUserName(user)} (@${getAcct(user)})\n` +
`${user.notesCount}投稿、${user.followingCount}フォロー、${user.followersCount}フォロワー\n`;
if (Users.isLocalUser(user)) {
string += `場所: ${user.location}、誕生日: ${user.birthday}\n`;
}
return string + `${user.description}`;
}

View File

@ -7,7 +7,7 @@ export class IdentifiableError extends Error {
constructor(id: string, message?: string) {
super(message);
this.message = message;
this.message = message || '';
this.id = id;
}
}

View File

@ -3,7 +3,7 @@ export function nyaize(text: string): string {
// ja-JP
.replace(/な/g, 'にゃ').replace(/ナ/g, 'ニャ').replace(/ナ/g, 'ニャ')
// ko-KR
.replace(/[나-낳]/g, (match: string) => String.fromCharCode(
match.codePointAt(0) + '냐'.charCodeAt(0) - '나'.charCodeAt(0)
.replace(/[나-낳]/g, match => String.fromCharCode(
match.codePointAt(0)! + '냐'.charCodeAt(0) - '나'.charCodeAt(0)
));
}

View File

@ -19,8 +19,8 @@ type MyType<T extends Schema> = {
export type SchemaType<p extends Schema> =
p['type'] extends 'number' ? number :
p['type'] extends 'string' ? string :
p['type'] extends 'array' ? MyType<p['items']>[] :
p['type'] extends 'object' ? ObjType<p['properties']> :
p['type'] extends 'array' ? MyType<NonNullable<p['items']>>[] :
p['type'] extends 'object' ? ObjType<NonNullable<p['properties']>> :
any;
export function convertOpenApiSchema(schema: Schema) {

View File

@ -53,7 +53,7 @@ export class App {
public permission: string[];
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: 'The callbackUrl of the App.'
})
public callbackUrl: string | null;

View File

@ -95,9 +95,9 @@ export class DriveFile {
@Index({ unique: true })
@Column('varchar', {
length: 256,
length: 256, nullable: true,
})
public accessKey: string;
public accessKey: string | null;
@Index({ unique: true })
@Column('varchar', {
@ -150,5 +150,5 @@ export class DriveFile {
default: false,
comment: 'Whether the DriveFile is direct link to remote server.'
})
public isRemote: boolean;
public isLink: boolean;
}

View File

@ -25,12 +25,12 @@ export class Emoji {
public host: string | null;
@Column('varchar', {
length: 256,
length: 512,
})
public url: string;
@Column('varchar', {
length: 256, nullable: true
length: 512, nullable: true
})
public uri: string | null;

View File

@ -53,13 +53,13 @@ export class FollowRequest {
public followerHost: string | null;
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: '[Denormalized]'
})
public followerInbox: string | null;
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: '[Denormalized]'
})
public followerSharedInbox: string | null;
@ -71,13 +71,13 @@ export class FollowRequest {
public followeeHost: string | null;
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: '[Denormalized]'
})
public followeeInbox: string | null;
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: '[Denormalized]'
})
public followeeSharedInbox: string | null;

View File

@ -48,13 +48,13 @@ export class Following {
public followerHost: string | null;
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: '[Denormalized]'
})
public followerInbox: string | null;
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: '[Denormalized]'
})
public followerSharedInbox: string | null;
@ -66,13 +66,13 @@ export class Following {
public followeeHost: string | null;
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: '[Denormalized]'
})
public followeeInbox: string | null;
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: '[Denormalized]'
})
public followeeSharedInbox: string | null;

View File

@ -78,27 +78,27 @@ export class Meta {
public blockedHosts: string[];
@Column('varchar', {
length: 256,
length: 512,
nullable: true,
default: '/assets/ai.png'
})
public mascotImageUrl: string | null;
@Column('varchar', {
length: 256,
length: 512,
nullable: true
})
public bannerUrl: string | null;
@Column('varchar', {
length: 256,
length: 512,
nullable: true,
default: 'https://ai.misskey.xyz/aiart/yubitun.png'
})
public errorImageUrl: string | null;
@Column('varchar', {
length: 256,
length: 512,
nullable: true
})
public iconUrl: string | null;

View File

@ -15,13 +15,6 @@ export class Note {
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,
comment: 'The updated date of the Note.'
})
public updatedAt: Date | null;
@Index()
@Column({
...id(),
@ -126,7 +119,7 @@ export class Note {
@Index({ unique: true })
@Column('varchar', {
length: 256, nullable: true,
length: 512, nullable: true,
comment: 'The URI of a note. it will be null when the note is local.'
})
public uri: string | null;
@ -183,7 +176,7 @@ export class Note {
public hasPoll: boolean;
@Column('jsonb', {
nullable: true, default: {}
nullable: true, default: null
})
public geo: any | null;
@ -195,12 +188,6 @@ export class Note {
})
public userHost: string | null;
@Column('varchar', {
length: 128, nullable: true,
comment: '[Denormalized]'
})
public userInbox: string | null;
@Column({
...id(),
nullable: true,
@ -227,6 +214,14 @@ export class Note {
})
public renoteUserHost: string | null;
//#endregion
constructor(data: Partial<Note>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {
(this as any)[k] = v;
}
}
}
export type IMentionedRemoteUsers = {

View File

@ -6,10 +6,6 @@ import { User } from './user';
@Entity()
export class Poll {
@PrimaryColumn(id())
public id: string;
@Index({ unique: true })
@Column(id())
public noteId: Note['id'];
@OneToOne(type => Note, {
@ -57,11 +53,19 @@ export class Poll {
})
public userHost: string | null;
//#endregion
constructor(data: Partial<Poll>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {
(this as any)[k] = v;
}
}
}
export type IPoll = {
choices: string[];
votes?: number[];
multiple: boolean;
expiresAt: Date;
expiresAt: Date | null;
};

View File

@ -21,7 +21,7 @@ export class SwSubscription {
public user: User | null;
@Column('varchar', {
length: 256,
length: 512,
})
public endpoint: string;

View File

@ -1,14 +1,10 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from 'typeorm';
import { User } from './user';
import { id } from '../id';
@Entity()
export class UserKeypair {
@PrimaryColumn(id())
public id: string;
@Index({ unique: true })
@Column(id())
public userId: User['id'];
@OneToOne(type => User, {
@ -26,4 +22,12 @@ export class UserKeypair {
length: 4096,
})
public privateKey: string;
constructor(data: Partial<UserKeypair>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {
(this as any)[k] = v;
}
}
}

View File

@ -0,0 +1,209 @@
import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm';
import { id } from '../id';
import { User } from './user';
@Entity()
export class UserProfile {
@PrimaryColumn(id())
public userId: User['id'];
@OneToOne(type => User, {
onDelete: 'CASCADE'
})
@JoinColumn()
public user: User | null;
@Column('varchar', {
length: 128, nullable: true,
comment: 'The location of the User.'
})
public location: string | null;
@Column('char', {
length: 10, nullable: true,
comment: 'The birthday (YYYY-MM-DD) of the User.'
})
public birthday: string | null;
@Column('varchar', {
length: 1024, nullable: true,
comment: 'The description (bio) of the User.'
})
public description: string | null;
@Column('jsonb', {
default: [],
})
public fields: {
name: string;
value: string;
}[];
@Column('varchar', {
length: 512, nullable: true,
comment: 'Remote URL of the user.'
})
public url: string | null;
@Column('varchar', {
length: 128, nullable: true,
comment: 'The email address of the User.'
})
public email: string | null;
@Column('varchar', {
length: 128, nullable: true,
})
public emailVerifyCode: string | null;
@Column('boolean', {
default: false,
})
public emailVerified: boolean;
@Column('varchar', {
length: 128, nullable: true,
})
public twoFactorTempSecret: string | null;
@Column('varchar', {
length: 128, nullable: true,
})
public twoFactorSecret: string | null;
@Column('boolean', {
default: false,
})
public twoFactorEnabled: boolean;
@Column('varchar', {
length: 128, nullable: true,
comment: 'The password hash of the User. It will be null if the origin of the user is local.'
})
public password: string | null;
@Column('jsonb', {
default: {},
comment: 'The client-specific data of the User.'
})
public clientData: Record<string, any>;
@Column('boolean', {
default: false,
})
public autoWatch: boolean;
@Column('boolean', {
default: false,
})
public autoAcceptFollowed: boolean;
@Column('boolean', {
default: false,
})
public alwaysMarkNsfw: boolean;
@Column('boolean', {
default: false,
})
public carefulBot: boolean;
//#region Linking
@Column('boolean', {
default: false,
})
public twitter: boolean;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public twitterAccessToken: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public twitterAccessTokenSecret: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public twitterUserId: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public twitterScreenName: string | null;
@Column('boolean', {
default: false,
})
public github: boolean;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public githubAccessToken: string | null;
@Column('integer', {
nullable: true, default: null,
})
public githubId: number | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public githubLogin: string | null;
@Column('boolean', {
default: false,
})
public discord: boolean;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordAccessToken: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordRefreshToken: string | null;
@Column('integer', {
nullable: true, default: null,
})
public discordExpiresDate: number | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordId: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordUsername: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordDiscriminator: string | null;
//#endregion
//#region Denormalized fields
@Index()
@Column('varchar', {
length: 128, nullable: true,
comment: '[Denormalized]'
})
public userHost: string | null;
//#endregion
constructor(data: Partial<UserProfile>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {
(this as any)[k] = v;
}
}
}

View File

@ -5,10 +5,6 @@ import { id } from '../id';
@Entity()
export class UserPublickey {
@PrimaryColumn(id())
public id: string;
@Index({ unique: true })
@Column(id())
public userId: User['id'];
@OneToOne(type => User, {
@ -27,4 +23,12 @@ export class UserPublickey {
length: 4096,
})
public keyPem: string;
constructor(data: Partial<UserPublickey>) {
if (data == null) return;
for (const [k, v] of Object.entries(data)) {
(this as any)[k] = v;
}
}
}

View File

@ -1,108 +0,0 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
import { User } from './user';
import { id } from '../id';
@Entity()
export class UserServiceLinking {
@PrimaryColumn(id())
public id: string;
@Index({ unique: true })
@Column(id())
public userId: User['id'];
@OneToOne(type => User, {
onDelete: 'CASCADE'
})
@JoinColumn()
public user: User | null;
@Column('boolean', {
default: false,
})
public twitter: boolean;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public twitterAccessToken: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public twitterAccessTokenSecret: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public twitterUserId: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public twitterScreenName: string | null;
@Column('boolean', {
default: false,
})
public github: boolean;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public githubAccessToken: string | null;
@Column('integer', {
nullable: true, default: null,
})
public githubId: number | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public githubLogin: string | null;
@Column('boolean', {
default: false,
})
public discord: boolean;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordAccessToken: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordRefreshToken: string | null;
@Column('integer', {
nullable: true, default: null,
})
public discordExpiresDate: number | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordId: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordUsername: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
})
public discordDiscriminator: string | null;
//#region Denormalized fields
@Index()
@Column('varchar', {
length: 128, nullable: true,
comment: '[Denormalized]'
})
public userHost: string | null;
//#endregion
}

Some files were not shown because too many files have changed in this diff Show More