mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 10:04:33 +02:00
commit
cd1a37ddbe
|
@ -2,7 +2,7 @@
|
|||
"name": "FreeDATA",
|
||||
"description": "FreeDATA",
|
||||
"private": true,
|
||||
"version": "0.12.0-alpha",
|
||||
"version": "0.12.1-alpha",
|
||||
"main": "dist-electron/main/index.js",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
|
|
|
@ -14,6 +14,7 @@ import { useStateStore } from "../store/stateStore.js";
|
|||
const state = useStateStore(pinia);
|
||||
|
||||
import { settingsStore as settings } from "../store/settingsStore.js";
|
||||
import { getAppDataPath } from "../js/freedata";
|
||||
|
||||
import { displayToast } from "./popupHandler.js";
|
||||
|
||||
|
@ -99,34 +100,8 @@ PouchDB.plugin(require("pouchdb-find"));
|
|||
//PouchDB.plugin(require('pouchdb-replication'));
|
||||
PouchDB.plugin(require("pouchdb-upsert"));
|
||||
|
||||
// https://stackoverflow.com/a/26227660
|
||||
if (typeof process.env["APPDATA"] !== "undefined") {
|
||||
var appDataFolder = process.env["APPDATA"];
|
||||
console.log(appDataFolder);
|
||||
} else {
|
||||
var appDataFolder: string;
|
||||
|
||||
switch (process.platform) {
|
||||
case "darwin":
|
||||
appDataFolder = process.env["HOME"] + "/Library/Application Support";
|
||||
console.log(appDataFolder);
|
||||
break;
|
||||
case "linux":
|
||||
appDataFolder = process.env["HOME"] + "/.config";
|
||||
console.log(appDataFolder);
|
||||
break;
|
||||
case "win32":
|
||||
appDataFolder = "undefined";
|
||||
break;
|
||||
default:
|
||||
appDataFolder = "undefined";
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log("loading chat database...");
|
||||
console.log("appdata folder:" + appDataFolder);
|
||||
var configFolder = path.join(appDataFolder, "FreeDATA");
|
||||
console.log("config folder:" + configFolder);
|
||||
var appDataPath = getAppDataPath();
|
||||
var configFolder = path.join(appDataPath, "FreeDATA");
|
||||
|
||||
var chatDB = path.join(configFolder, "chatDB");
|
||||
console.log("database path:" + chatDB);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
const os = require("os");
|
||||
const path = require("path");
|
||||
|
||||
/**
|
||||
* Binary to ASCII replacement
|
||||
* @param {string} data in normal/usual utf-8 format
|
||||
|
@ -97,3 +100,25 @@ export function validateCallsignWithoutSSID(callsign: string) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function getAppDataPath() {
|
||||
const platform = os.platform();
|
||||
let appDataPath;
|
||||
|
||||
switch (platform) {
|
||||
case "darwin": // macOS
|
||||
appDataPath = path.join(os.homedir(), "Library", "Application Support");
|
||||
break;
|
||||
case "win32": // Windows
|
||||
appDataPath =
|
||||
process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
|
||||
break;
|
||||
case "linux": // Linux
|
||||
appDataPath = path.join(os.homedir(), ".config");
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unsupported platform");
|
||||
}
|
||||
|
||||
return appDataPath;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
import { reactive, ref, watch } from "vue";
|
||||
|
||||
import { getConfig, setConfig } from "../js/api";
|
||||
import { getAppDataPath } from "../js/freedata";
|
||||
import fs from "fs";
|
||||
const path = require("path");
|
||||
const nconf = require("nconf");
|
||||
|
||||
var nconf = require("nconf");
|
||||
nconf.file({ file: "config/config.json" });
|
||||
var appDataPath = getAppDataPath();
|
||||
var configFolder = path.join(appDataPath, "FreeDATA");
|
||||
var configPath = path.join(configFolder, "config.json");
|
||||
|
||||
console.log("AppData Path:", appDataPath);
|
||||
console.log(configFolder);
|
||||
console.log(configPath);
|
||||
|
||||
nconf.file({ file: configPath });
|
||||
|
||||
// +++
|
||||
//GUI DEFAULT SETTINGS........
|
||||
|
|
|
@ -190,7 +190,6 @@ class radio:
|
|||
try:
|
||||
mode, bandwidth = response.split('\n', 1) # Split the response into mode and bandwidth
|
||||
except ValueError:
|
||||
print(response)
|
||||
mode = 'err'
|
||||
bandwidth = 'err'
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ app = Flask(__name__)
|
|||
CORS(app)
|
||||
CORS(app, resources={r"/*": {"origins": "*"}})
|
||||
sock = Sock(app)
|
||||
MODEM_VERSION = "0.12.0-alpha"
|
||||
MODEM_VERSION = "0.12.1-alpha"
|
||||
|
||||
# set config file to use
|
||||
def set_config():
|
||||
|
|
Loading…
Reference in a new issue