Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
a64817cea1 | |||
c32c3c1370 | |||
29ad7ab0cf | |||
11716fa9d3 | |||
210f11ffd8 | |||
814751d76a | |||
440cf139bb | |||
276d8ffc66 |
@ -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/'))
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "2.2.0",
|
"version": "2.3.0",
|
||||||
"clientVersion": "1.0.5193",
|
"clientVersion": "1.0.5207",
|
||||||
"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,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"copyright": "Copyright (c) 2014-2018 syuilo",
|
"copyright": "Copyright (c) 2014-2018 syuilo",
|
||||||
"themeColor": "#5cbb2d",
|
"themeColor": "#f66e4f",
|
||||||
"themeColorForeground": "#fff"
|
"themeColorForeground": "#fff"
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -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) {
|
||||||
|
@ -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`, {
|
||||||
|
26
src/server/web/views/note.pug
Normal file
26
src/server/web/views/note.pug
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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}`;
|
||||||
|
- const img = user.avatarId ? `${config.drive_url}/${user.avatarId}` : null;
|
||||||
|
|
||||||
|
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= img)
|
||||||
|
|
||||||
|
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)
|
Reference in New Issue
Block a user