summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-02-07 21:02:33 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-02-07 21:02:33 +0900
commit5448c22031d66cc020323bf4c4d1701889a46485 (patch)
treee14772d48d982c6a7d9cebeed497c16373e2e303 /src/server
parentFix #4179 (diff)
downloadmisskey-5448c22031d66cc020323bf4c4d1701889a46485.tar.gz
misskey-5448c22031d66cc020323bf4c4d1701889a46485.tar.bz2
misskey-5448c22031d66cc020323bf4c4d1701889a46485.zip
Revert 96bc17aa1014983d5e6bf8b4c05d898156995a0d
Diffstat (limited to 'src/server')
-rw-r--r--src/server/api/endpoints/meta.ts6
-rw-r--r--src/server/api/endpoints/users/recommendation.ts2
-rw-r--r--src/server/api/streaming.ts4
-rw-r--r--src/server/index.ts15
-rw-r--r--src/server/proxy/proxy-media.ts2
-rw-r--r--src/server/web/index.ts4
6 files changed, 15 insertions, 18 deletions
diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts
index d08d0b0734..91cb095c92 100644
--- a/src/server/api/endpoints/meta.ts
+++ b/src/server/api/endpoints/meta.ts
@@ -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,
diff --git a/src/server/api/endpoints/users/recommendation.ts b/src/server/api/endpoints/users/recommendation.ts
index d07c4b08f0..e3a03888b6 100644
--- a/src/server/api/endpoints/users/recommendation.ts
+++ b/src/server/api/endpoints/users/recommendation.ts
@@ -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,
diff --git a/src/server/api/streaming.ts b/src/server/api/streaming.ts
index d70cec03dc..f8f3c0ff4a 100644
--- a/src/server/api/streaming.ts
+++ b/src/server/api/streaming.ts
@@ -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');
diff --git a/src/server/index.ts b/src/server/index.ts
index df252a3575..0e1c701050 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -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());
}
diff --git a/src/server/proxy/proxy-media.ts b/src/server/proxy/proxy-media.ts
index 95491b6141..3f234a727d 100644
--- a/src/server/proxy/proxy-media.ts
+++ b/src/server/proxy/proxy-media.ts
@@ -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
diff --git a/src/server/web/index.ts b/src/server/web/index.ts
index d8a8d75c7a..3f2e1ed19f 100644
--- a/src/server/web/index.ts
+++ b/src/server/web/index.ts
@@ -31,9 +31,7 @@ const app = new Koa();
app.use(views(__dirname + '/views', {
extension: 'pug',
options: {
- config: {
- url: config.url
- }
+ config
}
}));