From 9afe56a0387414899c3bb2b72066b05c8239f8ae Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Tue, 22 Jan 2019 22:18:43 +0200 Subject: [PATCH] typescript(translucid): added sendFiles option to json Signed-off-by: prescientmoon --- typescript/translucid/Translucid.js | 9 +++++---- typescript/translucid/Translucid.ts | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/typescript/translucid/Translucid.js b/typescript/translucid/Translucid.js index 85d6479..1bb5750 100644 --- a/typescript/translucid/Translucid.js +++ b/typescript/translucid/Translucid.js @@ -25,12 +25,13 @@ class Translucid { const object = JSON.parse(json); for (let i in object) { const classes = object[i].classes || []; - this.bind(i, object[i].file, classes); - //gotta comment this later - // console.log(`Binded room with name ${i} and path ${object[i].file} with classes ${classes}`) + const sendAsFiles = object[i].sendFiles; + if (sendFiles != false) + sendFiles = true; + this.bind(i, object[i].file, classes, sendFiles); } } - bind(path = "/", filepath = "", classes = [], sendFiles = false) { + bind(path = "/", filepath = "", classes = [], sendFiles = true) { this.app.get(path, async (req, res) => { const readResults = await read_1.read(filepath); const toRun = []; diff --git a/typescript/translucid/Translucid.ts b/typescript/translucid/Translucid.ts index de706fd..3fee2a9 100644 --- a/typescript/translucid/Translucid.ts +++ b/typescript/translucid/Translucid.ts @@ -30,12 +30,12 @@ class Translucid { for (let i in object){ const classes = object[i].classes || []; - this.bind(i,object[i].file,classes); - //gotta comment this later - // console.log(`Binded room with name ${i} and path ${object[i].file} with classes ${classes}`) + const sendAsFiles = object[i].sendFiles; + if (sendFiles != false) sendFiles = true; + this.bind(i,object[i].file,classes,sendFiles); } } - bind(path:string = "/", filepath:string = "", classes:Array = [],sendFiles:boolean=false):void{ + bind(path:string = "/", filepath:string = "", classes:Array = [],sendFiles:boolean=true):void{ this.app.get(path, async (req, res)=> { const readResults = await read(filepath); const toRun:Array = [];