typescript(translucid): added sendFiles option to json
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
53351b93c9
commit
9afe56a038
|
@ -25,12 +25,13 @@ class Translucid {
|
||||||
const object = JSON.parse(json);
|
const object = JSON.parse(json);
|
||||||
for (let i in object) {
|
for (let i in object) {
|
||||||
const classes = object[i].classes || [];
|
const classes = object[i].classes || [];
|
||||||
this.bind(i, object[i].file, classes);
|
const sendAsFiles = object[i].sendFiles;
|
||||||
//gotta comment this later
|
if (sendFiles != false)
|
||||||
// console.log(`Binded room with name ${i} and path ${object[i].file} with classes ${classes}`)
|
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) => {
|
this.app.get(path, async (req, res) => {
|
||||||
const readResults = await read_1.read(filepath);
|
const readResults = await read_1.read(filepath);
|
||||||
const toRun = [];
|
const toRun = [];
|
||||||
|
|
|
@ -30,12 +30,12 @@ class Translucid {
|
||||||
|
|
||||||
for (let i in object){
|
for (let i in object){
|
||||||
const classes = object[i].classes || [];
|
const classes = object[i].classes || [];
|
||||||
this.bind(i,object[i].file,classes);
|
const sendAsFiles = object[i].sendFiles;
|
||||||
//gotta comment this later
|
if (sendFiles != false) sendFiles = true;
|
||||||
// console.log(`Binded room with name ${i} and path ${object[i].file} with classes ${classes}`)
|
this.bind(i,object[i].file,classes,sendFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bind(path:string = "/", filepath:string = "", classes:Array<string> = [],sendFiles:boolean=false):void{
|
bind(path:string = "/", filepath:string = "", classes:Array<string> = [],sendFiles:boolean=true):void{
|
||||||
this.app.get(path, async (req, res)=> {
|
this.app.get(path, async (req, res)=> {
|
||||||
const readResults = await read(filepath);
|
const readResults = await read(filepath);
|
||||||
const toRun:Array<Function> = [];
|
const toRun:Array<Function> = [];
|
||||||
|
|
Loading…
Reference in a new issue