This commit is contained in:
Xeltica 2020-07-25 00:12:11 +09:00
parent d4163b3644
commit 6dc760f11b
7 changed files with 20 additions and 10 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules
built
yarn-error.log
yarn-error.log
config.json

3
config.example.json Normal file
View File

@ -0,0 +1,3 @@
{
"port": 4000
}

View File

@ -1,18 +1,23 @@
import Koa from 'koa';
import { router } from './router';
import config from './config';
import bodyParser from 'koa-bodyparser';
import { render } from './render';
import { router } from './router';
import constant from './const';
import { render } from './render';
import fs from 'fs';
const conf = JSON.parse(fs.readFileSync(__dirname + '/../config.json', 'utf-8'));
const app = new Koa();
console.log('Simpkey v' + config.version);
console.log('Simpkey v' + constant.version);
app.use(bodyParser());
app.use(render);
app.use(router.routes());
console.log(`listening port ${conf.port}...`);
console.log('App launched!');
app.listen(3000);
app.listen(conf.port || 3000);

View File

@ -3,13 +3,13 @@ import { parse, toHtml } from 'mfmf';
import { parsePlain } from 'mfmf/dist/script/mfm/parse';
import config from './config';
import constant from './const';
import { User } from './models/User';
import { Note } from './models/Note';
export const render = views(__dirname + '/views', {
extension: 'pug', options: {
...config,
...constant,
mfmToHtml: (text: string, plain = false) => {
return toHtml(plain ? parsePlain(text) : parse(text), [], {
url: '',

View File

@ -147,8 +147,8 @@ mixin user-header(user, detail = false)
.sex 性別: #{user.sex}
dl
each field in user.fields
dt= mfmToHtml(field.name)
dd= mfmToHtml(field.value)
dt !{mfmToHtml(field.name)}
dd !{mfmToHtml(field.value)}
.count
a.notes(href="/" + getAcct(user)) #{user.notesCount} ノート

View File

@ -2,6 +2,7 @@ extends _base
block content
p Simpkey は、JavaScript のいらない Misskey クライアントです。
p: a(href="https://github.com/xeltica/simpkey", target="_blank", rel="noopener noreferrer") リポジトリを見る
h2 バージョン #{version}
ul
each val in changelog