Skip to content

Commit

Permalink
cors fix and a letheand.conf default settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Snider committed Mar 29, 2022
1 parent 9351a06 commit 495c24b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/routes/daemon/chain/start.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Command } from "https://deno.land/x/cliffy/command/mod.ts";
import { StringResponse } from "../../../interfaces/string-response.ts";
import { ProcessManager } from "../../../services/process/process.service.ts";
import { ProcessManagerRequest } from "../../../services/process/processManagerRequest.ts";
import { ConfigFileService } from "../../../services/config/file.service.ts";
import { FilesystemService } from "../../../services/filesystem.service.ts";
import { IniService } from "../../../services/config/ini.service.ts";

Expand Down Expand Up @@ -193,7 +192,7 @@ export class RouteDaemonChainStart {
//console.error(`Config file ${args['configFile']} not found`);
FilesystemService.ensureDir(path.join(Deno.cwd(), 'conf'))
FilesystemService.write(args['configFile'], new IniService().stringify({
"config-file": args['configFile'],
"log-file": args['logFile'],
"data-dir": args['dataDir'],
}));
}
Expand Down
6 changes: 2 additions & 4 deletions src/services/config/ini.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,14 @@ export class IniService {

stringify(obj: INIObject): string {
let str = "";
for (let i in obj) {
//str += `[${i}]\n`;
for (let j in obj[i]) {
let variable = [j, obj[i][j]];
for (let j in obj) {
let variable = [j, obj[j]];
if (typeof variable[1] === "string") {
str += `${variable[0]}="${variable[1]}"\n`;
} else {
str += `${variable[0]}=${variable[1]}\n`;
}
}
}
return str;
}
Expand Down
12 changes: 8 additions & 4 deletions src/services/server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ export class ServerService {
context.response.headers = new Headers({
"content-type":
"application/x-www-form-urlencoded, text/plain, application/json",
"Access-Control-Allow-Origin": "*"
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "*"
});

if ((error.message as string).startsWith("http")) {
Expand All @@ -211,7 +212,8 @@ export class ServerService {
context.response.headers = new Headers({
"Content-Type":
"application/x-www-form-urlencoded, text/plain, application/json",
"Access-Control-Allow-Origin": "*"
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "*"
});
});
}
Expand All @@ -225,7 +227,8 @@ export class ServerService {

this.router.get("/app/desktop/(.*)", async (context) => {
context.response.headers = new Headers({
"Access-Control-Allow-Origin": "*"
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "*"
});
try {
await context.send({
Expand All @@ -242,7 +245,8 @@ export class ServerService {
this.router.get("(.*)", async (context) => {
// context.response.status = 200;
context.response.headers = new Headers({
"Access-Control-Allow-Origin": "*"
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "*"
});
try {
await context.send({
Expand Down

0 comments on commit 495c24b

Please sign in to comment.