Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
3f2a7a561e | |||
332af15e3c | |||
fe184ce84a | |||
661c7f45ba | |||
01c0545409 | |||
c6492d3d58 | |||
638a2ab684 | |||
650f79d0fd | |||
a64817cea1 | |||
c32c3c1370 | |||
29ad7ab0cf | |||
11716fa9d3 | |||
210f11ffd8 | |||
814751d76a | |||
440cf139bb | |||
276d8ffc66 | |||
d9cdc1f079 | |||
414c600356 |
@ -52,9 +52,9 @@ If you want to translate Misskey, please see [Translation guide](./docs/translat
|
|||||||
[List of all contributors](https://github.com/syuilo/misskey/graphs/contributors)
|
[List of all contributors](https://github.com/syuilo/misskey/graphs/contributors)
|
||||||
|
|
||||||
### :earth_americas: Translators
|
### :earth_americas: Translators
|
||||||
| ![][mirro-san-icon] | ![][Conan-kun-icon] |
|
| ![][mirro-san-icon] | ![][Conan-kun-icon] | ![][m4sk1n-icon] |
|
||||||
|:-:|:-:|
|
|:-:|:-:|:-:|
|
||||||
| [Mirro][mirro-san-link]<br>English, French | [Asriel][Conan-kun-link]<br>English, French |
|
| [Mirro][mirro-san-link]<br>English, French | [Asriel][Conan-kun-link]<br>English, French | [Marcin Mikołajczak][m4sk1n-link]<br>Polish |
|
||||||
|
|
||||||
:four_leaf_clover: Copyright
|
:four_leaf_clover: Copyright
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
@ -100,4 +100,5 @@ Misskey is an open-source software licensed under [GNU AGPLv3](LICENSE).
|
|||||||
[mirro-san-icon]: https://avatars1.githubusercontent.com/u/17948612?s=70&v=4
|
[mirro-san-icon]: https://avatars1.githubusercontent.com/u/17948612?s=70&v=4
|
||||||
[Conan-kun-link]: https://github.com/Conan-kun
|
[Conan-kun-link]: https://github.com/Conan-kun
|
||||||
[Conan-kun-icon]: https://avatars3.githubusercontent.com/u/30003708?s=70&v=4
|
[Conan-kun-icon]: https://avatars3.githubusercontent.com/u/30003708?s=70&v=4
|
||||||
|
[m4sk1n-link]: https://github.com/m4sk1n
|
||||||
|
[m4sk1n-icon]: https://avatars3.githubusercontent.com/u/21127288?s=70&v=4
|
||||||
|
@ -59,9 +59,15 @@ gulp.task('build:ts', () => {
|
|||||||
.pipe(gulp.dest('./built/'));
|
.pipe(gulp.dest('./built/'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build:copy', () =>
|
gulp.task('build:copy:views', () =>
|
||||||
|
gulp.src('./src/server/web/views/**/*').pipe(gulp.dest('./built/server/web/views'))
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task('build:copy', ['build:copy:views'], () =>
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'./build/Release/crypto_key.node',
|
'./build/Release/crypto_key.node',
|
||||||
|
'./src/const.json',
|
||||||
|
'./src/server/web/views/**/*',
|
||||||
'./src/**/assets/**/*',
|
'./src/**/assets/**/*',
|
||||||
'!./src/client/app/**/assets/**/*'
|
'!./src/client/app/**/assets/**/*'
|
||||||
]).pipe(gulp.dest('./built/'))
|
]).pipe(gulp.dest('./built/'))
|
||||||
|
@ -95,7 +95,7 @@ common/views/components/nav.vue:
|
|||||||
donors: "Sponsorzy"
|
donors: "Sponsorzy"
|
||||||
repository: "Repozytorium"
|
repository: "Repozytorium"
|
||||||
develop: "Autorzy"
|
develop: "Autorzy"
|
||||||
feedback: "Opinie"
|
feedback: "Podziel się opinią"
|
||||||
|
|
||||||
common/views/components/note-menu.vue:
|
common/views/components/note-menu.vue:
|
||||||
favorite: "Dodaj do ulubionych"
|
favorite: "Dodaj do ulubionych"
|
||||||
@ -232,7 +232,7 @@ desktop/views/components/drive.nav-folder.vue:
|
|||||||
desktop/views/components/drive.vue:
|
desktop/views/components/drive.vue:
|
||||||
search: "Szukaj"
|
search: "Szukaj"
|
||||||
load-more: "Załaduj więcej"
|
load-more: "Załaduj więcej"
|
||||||
empty-drive: "Twój dysk jest posty"
|
empty-drive: "Twój dysk jest pusty"
|
||||||
empty-drive-description: "Możesz wysłać plik klikając prawym przyciskiem myszy i wybierając \"Wyślij plik\" lub przeciągnąć plik i upuścić w tym oknie."
|
empty-drive-description: "Możesz wysłać plik klikając prawym przyciskiem myszy i wybierając \"Wyślij plik\" lub przeciągnąć plik i upuścić w tym oknie."
|
||||||
empty-folder: "Ten katalog jest posty"
|
empty-folder: "Ten katalog jest posty"
|
||||||
unable-to-process: "Nie udało się dokończyć działania."
|
unable-to-process: "Nie udało się dokończyć działania."
|
||||||
@ -240,6 +240,7 @@ desktop/views/components/drive.vue:
|
|||||||
unhandled-error: "Nieznany błąd"
|
unhandled-error: "Nieznany błąd"
|
||||||
url-upload: "Wyślij z adresu"
|
url-upload: "Wyślij z adresu"
|
||||||
url-of-file: "Adres URL pliku, który chcesz wysłać"
|
url-of-file: "Adres URL pliku, który chcesz wysłać"
|
||||||
|
url-upload-requested: "Zaplanowano wysyłanie"
|
||||||
may-take-time: "Może trochę potrwać, zanim wysyłanie zostanie ukończone."
|
may-take-time: "Może trochę potrwać, zanim wysyłanie zostanie ukończone."
|
||||||
create-folder: "Utwórz katalog"
|
create-folder: "Utwórz katalog"
|
||||||
folder-name: "Nazwa katalogu"
|
folder-name: "Nazwa katalogu"
|
||||||
@ -254,6 +255,7 @@ desktop/views/components/messaging-window.vue:
|
|||||||
desktop/views/components/notes.note.vue:
|
desktop/views/components/notes.note.vue:
|
||||||
reposted-by: "Udostępniono przez {}"
|
reposted-by: "Udostępniono przez {}"
|
||||||
reply: "Odpowiedz"
|
reply: "Odpowiedz"
|
||||||
|
renote: "Przeredaguj"
|
||||||
add-reaction: "Dodaj reakcję"
|
add-reaction: "Dodaj reakcję"
|
||||||
detail: "Pokaż szczegóły"
|
detail: "Pokaż szczegóły"
|
||||||
|
|
||||||
@ -267,11 +269,13 @@ desktop/views/components/post-form.vue:
|
|||||||
quote-placeholder: "Zacytuj ten wpis…"
|
quote-placeholder: "Zacytuj ten wpis…"
|
||||||
note: "Wyślij"
|
note: "Wyślij"
|
||||||
reply: "Odpowiedz"
|
reply: "Odpowiedz"
|
||||||
posted: "Posted!"
|
renote: "Przeredaguj"
|
||||||
|
posted: "Opublikowano!"
|
||||||
replied: "Odpowiedziano!"
|
replied: "Odpowiedziano!"
|
||||||
reposted: "Udostępniono!"
|
reposted: "Udostępniono!"
|
||||||
note-failed: "Nie udało się wysłać"
|
note-failed: "Nie udało się wysłać"
|
||||||
reply-failed: "Nie udało się odpowiedzieć"
|
reply-failed: "Nie udało się odpowiedzieć"
|
||||||
|
renote-failed: "Nie udało się przeredagować"
|
||||||
posting: "Wysyłanie"
|
posting: "Wysyłanie"
|
||||||
attach-media-from-local: "Załącz zawartość multimedialną z komputera"
|
attach-media-from-local: "Załącz zawartość multimedialną z komputera"
|
||||||
attach-media-from-drive: "Załącz zawartość multimedialną z dysku"
|
attach-media-from-drive: "Załącz zawartość multimedialną z dysku"
|
||||||
@ -289,14 +293,19 @@ desktop/views/components/post-form-window.vue:
|
|||||||
desktop/views/components/renote-form.vue:
|
desktop/views/components/renote-form.vue:
|
||||||
quote: "Cytuj…"
|
quote: "Cytuj…"
|
||||||
cancel: "Anuluj"
|
cancel: "Anuluj"
|
||||||
|
renote: "Przeredaguj"
|
||||||
reposting: "Udostępnianie…"
|
reposting: "Udostępnianie…"
|
||||||
success: "Udostępniono!"
|
success: "Udostępniono!"
|
||||||
|
failure: "Nie udało się przeredagować"
|
||||||
|
|
||||||
|
desktop/views/components/renote-form-window.vue:
|
||||||
|
title: "Czy na pewno chcesz przeredagować ten wpis?"
|
||||||
|
|
||||||
desktop/views/components/settings.vue:
|
desktop/views/components/settings.vue:
|
||||||
profile: "Profil"
|
profile: "Profil"
|
||||||
notification: "Powiadomienie"
|
notification: "Powiadomienia"
|
||||||
apps: "Aplikacje"
|
apps: "Aplikacje"
|
||||||
mute: "Wycisz"
|
mute: "Wyciszanie"
|
||||||
drive: "Dysk"
|
drive: "Dysk"
|
||||||
security: "Bezpieczeństwo"
|
security: "Bezpieczeństwo"
|
||||||
password: "Hasło"
|
password: "Hasło"
|
||||||
@ -392,7 +401,7 @@ desktop/views/pages/user/user.followers-you-know.vue:
|
|||||||
no-users: "Brak użytkowników"
|
no-users: "Brak użytkowników"
|
||||||
|
|
||||||
desktop/views/pages/user/user.friends.vue:
|
desktop/views/pages/user/user.friends.vue:
|
||||||
title: "Najczęściej odpisujący"
|
title: "Najbardziej aktywni"
|
||||||
loading: "Ładowanie"
|
loading: "Ładowanie"
|
||||||
no-users: "Brak użytkowników"
|
no-users: "Brak użytkowników"
|
||||||
|
|
||||||
|
69
migration/2.4.0.js
Normal file
69
migration/2.4.0.js
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// for Node.js interpret
|
||||||
|
|
||||||
|
const chalk = require('chalk');
|
||||||
|
const sequential = require('promise-sequential');
|
||||||
|
|
||||||
|
const { default: User } = require('../built/models/user');
|
||||||
|
const { default: DriveFile } = require('../built/models/drive-file');
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const promiseGens = [];
|
||||||
|
|
||||||
|
const count = await User.count({});
|
||||||
|
|
||||||
|
let prev;
|
||||||
|
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
promiseGens.push(() => {
|
||||||
|
const promise = new Promise(async (res, rej) => {
|
||||||
|
const user = await User.findOne(prev ? {
|
||||||
|
_id: { $gt: prev._id }
|
||||||
|
} : {}, {
|
||||||
|
sort: {
|
||||||
|
_id: 1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
prev = user;
|
||||||
|
|
||||||
|
const set = {};
|
||||||
|
|
||||||
|
if (user.avatarId != null) {
|
||||||
|
const file = await DriveFile.findOne({ _id: user.avatarId });
|
||||||
|
|
||||||
|
if (file && file.metadata.properties.avgColor) {
|
||||||
|
set.avatarColor = file.metadata.properties.avgColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.bannerId != null) {
|
||||||
|
const file = await DriveFile.findOne({ _id: user.bannerId });
|
||||||
|
|
||||||
|
if (file && file.metadata.properties.avgColor) {
|
||||||
|
set.bannerColor = file.metadata.properties.avgColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
User.update({
|
||||||
|
_id: user._id
|
||||||
|
}, {
|
||||||
|
$set: set
|
||||||
|
}).then(() => {
|
||||||
|
res([i, user]);
|
||||||
|
}).catch(rej);
|
||||||
|
});
|
||||||
|
|
||||||
|
promise.then(([i, user]) => {
|
||||||
|
console.log(chalk`{gray ${i}} {green done: {bold ${user._id}} @${user.username}}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return await sequential(promiseGens);
|
||||||
|
}
|
||||||
|
|
||||||
|
main().then(() => {
|
||||||
|
console.log('ALL DONE');
|
||||||
|
}).catch(console.error);
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "2.1.4",
|
"version": "2.4.0",
|
||||||
"clientVersion": "1.0.5193",
|
"clientVersion": "1.0.5215",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
@ -58,6 +58,7 @@
|
|||||||
"@types/koa-multer": "1.0.0",
|
"@types/koa-multer": "1.0.0",
|
||||||
"@types/koa-router": "7.0.28",
|
"@types/koa-router": "7.0.28",
|
||||||
"@types/koa-send": "4.1.1",
|
"@types/koa-send": "4.1.1",
|
||||||
|
"@types/koa-views": "^2.0.3",
|
||||||
"@types/koa__cors": "2.2.2",
|
"@types/koa__cors": "2.2.2",
|
||||||
"@types/kue": "0.11.8",
|
"@types/kue": "0.11.8",
|
||||||
"@types/license-checker": "15.0.0",
|
"@types/license-checker": "15.0.0",
|
||||||
@ -146,6 +147,7 @@
|
|||||||
"koa-router": "7.4.0",
|
"koa-router": "7.4.0",
|
||||||
"koa-send": "4.1.3",
|
"koa-send": "4.1.3",
|
||||||
"koa-slow": "2.1.0",
|
"koa-slow": "2.1.0",
|
||||||
|
"koa-views": "^6.1.4",
|
||||||
"kue": "0.11.6",
|
"kue": "0.11.6",
|
||||||
"license-checker": "18.0.0",
|
"license-checker": "18.0.0",
|
||||||
"loader-utils": "1.1.0",
|
"loader-utils": "1.1.0",
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
block vars
|
||||||
|
|
||||||
doctype html
|
doctype html
|
||||||
|
|
||||||
!= '\n<!-- Thank you for using Misskey! @syuilo -->\n'
|
!= '\n<!-- Thank you for using Misskey! @syuilo -->\n'
|
||||||
@ -9,9 +11,17 @@ html
|
|||||||
meta(name='application-name' content='Misskey')
|
meta(name='application-name' content='Misskey')
|
||||||
meta(name='theme-color' content=themeColor)
|
meta(name='theme-color' content=themeColor)
|
||||||
meta(name='referrer' content='origin')
|
meta(name='referrer' content='origin')
|
||||||
|
meta(property='og:site_name' content='Misskey')
|
||||||
link(rel='manifest' href='/manifest.json')
|
link(rel='manifest' href='/manifest.json')
|
||||||
|
|
||||||
title Misskey
|
title
|
||||||
|
block title
|
||||||
|
| Misskey
|
||||||
|
|
||||||
|
block desc
|
||||||
|
meta(name='description' content='A SNS')
|
||||||
|
|
||||||
|
block meta
|
||||||
|
|
||||||
style
|
style
|
||||||
include ./../../../built/client/assets/init.css
|
include ./../../../built/client/assets/init.css
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-link class="mk-avatar" :to="user | userPage" :title="user | acct" :target="target" :style="{ borderRadius: clientSettings.circleIcons ? '100%' : null }">
|
<router-link class="mk-avatar" :to="user | userPage" :title="user | acct" :target="target" :style="style" v-if="disablePreview"></router-link>
|
||||||
<img v-if="disablePreview" :src="`${user.avatarUrl}?thumbnail&size=128`" alt=""/>
|
<router-link class="mk-avatar" :to="user | userPage" :title="user | acct" :target="target" :style="style" v-else v-user-preview="user.id"></router-link>
|
||||||
<img v-else :src="`${user.avatarUrl}?thumbnail&size=128`" alt="" v-user-preview="user.id"/>
|
|
||||||
</router-link>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@ -10,6 +8,7 @@ import Vue from 'vue';
|
|||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
user: {
|
user: {
|
||||||
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
target: {
|
target: {
|
||||||
@ -20,6 +19,15 @@ export default Vue.extend({
|
|||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
style(): any {
|
||||||
|
return {
|
||||||
|
backgroundColor: this.user.avatarColor ? `rgb(${ this.user.avatarColor.join(',') })` : null,
|
||||||
|
backgroundImage: `url(${ this.user.avatarUrl }?thumbnail)`,
|
||||||
|
borderRadius: (this as any).clientSettings.circleIcons ? '100%' : null
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -27,13 +35,7 @@ export default Vue.extend({
|
|||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.mk-avatar
|
.mk-avatar
|
||||||
display inline-block
|
display inline-block
|
||||||
|
background-size cover
|
||||||
> img
|
background-position center center
|
||||||
display inline-block
|
transition border-radius 1s ease
|
||||||
width 100%
|
|
||||||
height 100%
|
|
||||||
margin 0
|
|
||||||
border-radius inherit
|
|
||||||
vertical-align bottom
|
|
||||||
transition border-radius 1s ease
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -31,6 +31,12 @@ export default Vue.extend({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
if ((this as any).os.i.followingCount == 0) {
|
||||||
|
this.src = 'local';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
(this.$refs.tl as any).$once('loaded', () => {
|
(this.$refs.tl as any).$once('loaded', () => {
|
||||||
this.$emit('loaded');
|
this.$emit('loaded');
|
||||||
|
@ -75,6 +75,12 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
if ((this as any).os.i.followingCount == 0) {
|
||||||
|
this.src = 'local';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey';
|
document.title = 'Misskey';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<a class="avatar">
|
<a class="avatar">
|
||||||
<img :src="`${user.avatarUrl}?thumbnail&size=200`" alt="avatar"/>
|
<img :src="user.avatarUrl" alt="avatar"/>
|
||||||
</a>
|
</a>
|
||||||
<mk-follow-button v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
|
<mk-follow-button v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"copyright": "Copyright (c) 2014-2018 syuilo",
|
"copyright": "Copyright (c) 2014-2018 syuilo",
|
||||||
"themeColor": "#5cbb2d",
|
"themeColor": "#f66e4f",
|
||||||
"themeColorForeground": "#fff"
|
"themeColorForeground": "#fff"
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ export type IMetadata = {
|
|||||||
_user: any;
|
_user: any;
|
||||||
folderId: mongo.ObjectID;
|
folderId: mongo.ObjectID;
|
||||||
comment: string;
|
comment: string;
|
||||||
uri: string;
|
uri?: string;
|
||||||
|
url?: string;
|
||||||
deletedAt?: Date;
|
deletedAt?: Date;
|
||||||
isExpired?: boolean;
|
isExpired?: boolean;
|
||||||
};
|
};
|
||||||
|
@ -286,7 +286,7 @@ export const pack = async (
|
|||||||
_id: -1
|
_id: -1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return prev ? prev._id : null;
|
return prev ? prev._id.toHexString() : null;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Get next note info
|
// Get next note info
|
||||||
@ -304,7 +304,7 @@ export const pack = async (
|
|||||||
_id: 1
|
_id: 1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return next ? next._id : null;
|
return next ? next._id.toHexString() : null;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
if (_note.replyId) {
|
if (_note.replyId) {
|
||||||
|
@ -24,7 +24,7 @@ export async function createImage(actor: IRemoteUser, value): Promise<IDriveFile
|
|||||||
|
|
||||||
log(`Creating the Image: ${image.url}`);
|
log(`Creating the Image: ${image.url}`);
|
||||||
|
|
||||||
return await uploadFromUrl(image.url, actor);
|
return await uploadFromUrl(image.url, actor, null, image.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* 投稿を表す文字列を取得します。
|
* 投稿を表す文字列を取得します。
|
||||||
* @param {*} note 投稿
|
* @param {*} note (packされた)投稿
|
||||||
*/
|
*/
|
||||||
const summarize = (note: any): string => {
|
const summarize = (note: any): string => {
|
||||||
if (note.isHidden) {
|
if (note.isHidden) {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
|
import $ from 'cafy'; import ID from '../../../../cafy-id';
|
||||||
import User, { isValidName, isValidDescription, isValidLocation, isValidBirthday, pack } from '../../../../models/user';
|
import User, { isValidName, isValidDescription, isValidLocation, isValidBirthday, pack } from '../../../../models/user';
|
||||||
import event from '../../../../publishers/stream';
|
import event from '../../../../publishers/stream';
|
||||||
|
import DriveFile from '../../../../models/drive-file';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update myself
|
* Update myself
|
||||||
@ -51,12 +52,34 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
|
|||||||
if (autoWatchErr) return rej('invalid autoWatch param');
|
if (autoWatchErr) return rej('invalid autoWatch param');
|
||||||
if (autoWatch != null) user.settings.autoWatch = autoWatch;
|
if (autoWatch != null) user.settings.autoWatch = autoWatch;
|
||||||
|
|
||||||
|
if (avatarId) {
|
||||||
|
const avatar = await DriveFile.findOne({
|
||||||
|
_id: avatarId
|
||||||
|
});
|
||||||
|
|
||||||
|
if (avatar != null && avatar.metadata.properties.avgColor) {
|
||||||
|
user.avatarColor = avatar.metadata.properties.avgColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bannerId) {
|
||||||
|
const banner = await DriveFile.findOne({
|
||||||
|
_id: bannerId
|
||||||
|
});
|
||||||
|
|
||||||
|
if (banner != null && banner.metadata.properties.avgColor) {
|
||||||
|
user.bannerColor = banner.metadata.properties.avgColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await User.update(user._id, {
|
await User.update(user._id, {
|
||||||
$set: {
|
$set: {
|
||||||
name: user.name,
|
name: user.name,
|
||||||
description: user.description,
|
description: user.description,
|
||||||
avatarId: user.avatarId,
|
avatarId: user.avatarId,
|
||||||
|
avatarColor: user.avatarColor,
|
||||||
bannerId: user.bannerId,
|
bannerId: user.bannerId,
|
||||||
|
bannerColor: user.bannerColor,
|
||||||
profile: user.profile,
|
profile: user.profile,
|
||||||
isBot: user.isBot,
|
isBot: user.isBot,
|
||||||
settings: user.settings
|
settings: user.settings
|
||||||
|
@ -7,14 +7,32 @@ import * as Koa from 'koa';
|
|||||||
import * as Router from 'koa-router';
|
import * as Router from 'koa-router';
|
||||||
import * as send from 'koa-send';
|
import * as send from 'koa-send';
|
||||||
import * as favicon from 'koa-favicon';
|
import * as favicon from 'koa-favicon';
|
||||||
|
import * as views from 'koa-views';
|
||||||
|
|
||||||
import docs from './docs';
|
import docs from './docs';
|
||||||
|
import User from '../../models/user';
|
||||||
|
import parseAcct from '../../acct/parse';
|
||||||
|
import { fa } from '../../build/fa';
|
||||||
|
import config from '../../config';
|
||||||
|
import Note, { pack as packNote } from '../../models/note';
|
||||||
|
import getNoteSummary from '../../renderers/get-note-summary';
|
||||||
|
const consts = require('../../const.json');
|
||||||
|
|
||||||
const client = `${__dirname}/../../client/`;
|
const client = `${__dirname}/../../client/`;
|
||||||
|
|
||||||
// Init app
|
// Init app
|
||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
|
|
||||||
|
// Init renderer
|
||||||
|
app.use(views(__dirname + '/views', {
|
||||||
|
extension: 'pug',
|
||||||
|
options: {
|
||||||
|
config,
|
||||||
|
themeColor: consts.themeColor,
|
||||||
|
facss: fa.dom.css()
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
// Serve favicon
|
// Serve favicon
|
||||||
app.use(favicon(`${client}/assets/favicon.ico`));
|
app.use(favicon(`${client}/assets/favicon.ico`));
|
||||||
|
|
||||||
@ -67,6 +85,38 @@ router.use('/docs', docs.routes());
|
|||||||
// URL preview endpoint
|
// URL preview endpoint
|
||||||
router.get('/url', require('./url-preview'));
|
router.get('/url', require('./url-preview'));
|
||||||
|
|
||||||
|
//#region for crawlers
|
||||||
|
// User
|
||||||
|
router.get('/@:user', async ctx => {
|
||||||
|
const { username, host } = parseAcct(ctx.params.user);
|
||||||
|
const user = await User.findOne({
|
||||||
|
usernameLower: username.toLowerCase(),
|
||||||
|
host
|
||||||
|
});
|
||||||
|
|
||||||
|
if (user != null) {
|
||||||
|
await ctx.render('user', { user });
|
||||||
|
} else {
|
||||||
|
ctx.status = 404;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Note
|
||||||
|
router.get('/notes/:note', async ctx => {
|
||||||
|
const note = await Note.findOne({ _id: ctx.params.note });
|
||||||
|
|
||||||
|
if (note != null) {
|
||||||
|
const _note = await packNote(note);
|
||||||
|
await ctx.render('note', {
|
||||||
|
note: _note,
|
||||||
|
summary: getNoteSummary(_note)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ctx.status = 404;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//#endregion
|
||||||
|
|
||||||
// Render base html for all requests
|
// Render base html for all requests
|
||||||
router.get('*', async ctx => {
|
router.get('*', async ctx => {
|
||||||
await send(ctx, `app/base.html`, {
|
await send(ctx, `app/base.html`, {
|
||||||
|
@ -14,6 +14,8 @@ module.exports = async (ctx: Koa.Context) => {
|
|||||||
|
|
||||||
function wrap(url: string): string {
|
function wrap(url: string): string {
|
||||||
return url != null
|
return url != null
|
||||||
? `https://images.weserv.nl/?url=${url.replace(/^https?:\/\//, '')}`
|
? url.startsWith('https://')
|
||||||
|
? url
|
||||||
|
: `https://images.weserv.nl/?url=${url.replace(/^http:\/\//, '')}`
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
25
src/server/web/views/note.pug
Normal file
25
src/server/web/views/note.pug
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
extends ../../../../src/client/app/base
|
||||||
|
|
||||||
|
block vars
|
||||||
|
- const user = note.user;
|
||||||
|
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`;
|
||||||
|
- const url = `${config.url}/notes/${note.id}`;
|
||||||
|
|
||||||
|
block title
|
||||||
|
= `${title} | Misskey`
|
||||||
|
|
||||||
|
block desc
|
||||||
|
meta(name='description' content= summary)
|
||||||
|
|
||||||
|
block meta
|
||||||
|
meta(name='twitter:card' content='summary')
|
||||||
|
meta(property='og:type' content='article')
|
||||||
|
meta(property='og:title' content= title)
|
||||||
|
meta(property='og:description' content= summary)
|
||||||
|
meta(property='og:url' content= url)
|
||||||
|
meta(property='og:image' content= user.avatarUrl)
|
||||||
|
|
||||||
|
if note.prev
|
||||||
|
link(rel='prev' href=`${config.url}/notes/${note.prev}`)
|
||||||
|
if note.next
|
||||||
|
link(rel='next' href=`${config.url}/notes/${note.next}`)
|
20
src/server/web/views/user.pug
Normal file
20
src/server/web/views/user.pug
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
extends ../../../../src/client/app/base
|
||||||
|
|
||||||
|
block vars
|
||||||
|
- const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`;
|
||||||
|
- const url = config.url + '/@' + (user.host ? `${user.username}@${user.host}` : user.username);
|
||||||
|
- const img = user.avatarId ? `${config.drive_url}/${user.avatarId}` : null;
|
||||||
|
|
||||||
|
block title
|
||||||
|
= `${title} | Misskey`
|
||||||
|
|
||||||
|
block desc
|
||||||
|
meta(name='description' content= user.description)
|
||||||
|
|
||||||
|
block meta
|
||||||
|
meta(name='twitter:card' content='summary')
|
||||||
|
meta(property='og:type' content='blog')
|
||||||
|
meta(property='og:title' content= title)
|
||||||
|
meta(property='og:description' content= user.description)
|
||||||
|
meta(property='og:url' content= url)
|
||||||
|
meta(property='og:image' content= img)
|
@ -62,6 +62,7 @@ const addFile = async (
|
|||||||
comment: string = null,
|
comment: string = null,
|
||||||
folderId: mongodb.ObjectID = null,
|
folderId: mongodb.ObjectID = null,
|
||||||
force: boolean = false,
|
force: boolean = false,
|
||||||
|
url: string = null,
|
||||||
uri: string = null
|
uri: string = null
|
||||||
): Promise<IDriveFile> => {
|
): Promise<IDriveFile> => {
|
||||||
log(`registering ${name} (user: ${getAcct(user)}, path: ${path})`);
|
log(`registering ${name} (user: ${getAcct(user)}, path: ${path})`);
|
||||||
@ -296,6 +297,10 @@ const addFile = async (
|
|||||||
properties: properties
|
properties: properties
|
||||||
} as IMetadata;
|
} as IMetadata;
|
||||||
|
|
||||||
|
if (url !== null) {
|
||||||
|
metadata.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
if (uri !== null) {
|
if (uri !== null) {
|
||||||
metadata.uri = uri;
|
metadata.uri = uri;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ export default async (url, user, folderId = null, uri = null): Promise<IDriveFil
|
|||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
driveFile = await create(user, path, name, null, folderId, false, uri);
|
driveFile = await create(user, path, name, null, folderId, false, url, uri);
|
||||||
log(`created: ${driveFile._id}`);
|
log(`created: ${driveFile._id}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
||||||
|
Reference in New Issue
Block a user