This commit is contained in:
syuilo 2019-02-07 21:02:33 +09:00
parent 27768081e2
commit 5448c22031
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
19 changed files with 125 additions and 194 deletions

View file

@ -46,7 +46,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
description: instance.description,
langs: instance.langs,
secure: config.https.isJust(),
secure: config.https != null,
machine: os.hostname(),
os: os.platform(),
node: process.version,
@ -83,9 +83,9 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
registration: !instance.disableRegistration,
localTimeLine: !instance.disableLocalTimeline,
globalTimeLine: !instance.disableGlobalTimeline,
elasticsearch: config.elasticsearch.isJust(),
elasticsearch: config.elasticsearch ? true : false,
recaptcha: instance.enableRecaptcha,
objectStorage: config.drive.storage === 'minio',
objectStorage: config.drive && config.drive.storage === 'minio',
twitter: instance.enableTwitterIntegration,
github: instance.enableGithubIntegration,
discord: instance.enableDiscordIntegration,

View file

@ -50,7 +50,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
request({
url: url,
proxy: config.proxy.getOrElse(null),
proxy: config.proxy,
timeout: timeout,
json: true,
followRedirect: true,

View file

@ -23,10 +23,10 @@ module.exports = (server: http.Server) => {
let ev: EventEmitter;
if (config.redis.isJust()) {
if (config.redis) {
// Connect to Redis
const subscriber = redis.createClient(
config.redis.get().port, config.redis.get().host);
config.redis.port, config.redis.host);
subscriber.subscribe('misskey');

View file

@ -96,14 +96,13 @@ app.use(router.routes());
app.use(mount(require('./web')));
function createServer() {
if (config.https.isJust()) {
const opts = {
key: fs.readFileSync(config.https.get().key),
cert: fs.readFileSync(config.https.get().cert),
...config.https.get().ca.map<any>(path => ({ ca: fs.readFileSync(path) })).getOrElse({}),
allowHTTP1: true
};
return http2.createSecureServer(opts, app.callback()) as https.Server;
if (config.https) {
const certs: any = {};
for (const k of Object.keys(config.https)) {
certs[k] = fs.readFileSync(config.https[k]);
}
certs['allowHTTP1'] = true;
return http2.createSecureServer(certs, app.callback()) as https.Server;
} else {
return http.createServer(app.callback());
}

View file

@ -69,7 +69,7 @@ async function fetch(url: string, path: string) {
const req = request({
url: requestUrl,
proxy: config.proxy.getOrElse(null),
proxy: config.proxy,
timeout: 10 * 1000,
headers: {
'User-Agent': config.user_agent

View file

@ -31,9 +31,7 @@ const app = new Koa();
app.use(views(__dirname + '/views', {
extension: 'pug',
options: {
config: {
url: config.url
}
config
}
}));