Some general updates
This commit is contained in:
parent
2ed8883626
commit
4377d92c7e
@ -75,6 +75,10 @@ export namespace ui {
|
||||
}
|
||||
|
||||
function spawn_gui() {
|
||||
if(gui) {
|
||||
gui.focus();
|
||||
return;
|
||||
}
|
||||
console.log("Spawn window!");
|
||||
let dev_tools = false;
|
||||
|
||||
|
@ -15,7 +15,7 @@ import * as electron from "electron";
|
||||
import MessageBoxOptions = Electron.MessageBoxOptions;
|
||||
import {current_version, execute_graphical} from "../app-updater";
|
||||
|
||||
const TIMEOUT = 10000;
|
||||
const TIMEOUT = 30000;
|
||||
let local_path = undefined;
|
||||
|
||||
interface RemoteURL {
|
||||
@ -77,7 +77,7 @@ function get_raw_app_files() : Promise<VersionedFile[]> {
|
||||
|
||||
if(error) { reject(error); return; }
|
||||
if(response.statusCode != 200) { setImmediate(reject, "invalid status code " + response.statusCode + " for " + url); return; }
|
||||
if(response.headers["info-version"] != 1) { setImmediate(reject, "Invalid response version (" + response.headers["info-version"] + "). Update your app manually!"); return; }
|
||||
if(response.headers["info-version"] != 1 && !process_args.has_flag(Arguments.UPDATER_UI_IGNORE_VERSION)) { setImmediate(reject, "Invalid response version (" + response.headers["info-version"] + "). Update your app manually!"); return; }
|
||||
if(!body) {
|
||||
setImmediate(reject, "invalid body. (Missing)");
|
||||
return;
|
||||
@ -489,27 +489,33 @@ export async function load_files(channel: string, static_cb: (message: string, i
|
||||
}
|
||||
console.log("Get raw files:");
|
||||
let futures: Promise<void>[] = [];
|
||||
let finish_count = 0;
|
||||
let finish_count = files.length;
|
||||
static_cb("Downloading files", 0);
|
||||
|
||||
for(const file of files) {
|
||||
console.log("Start downloading %s (%s)", file.name, file.path);
|
||||
const chunk_size = 5;
|
||||
let left = [...files];
|
||||
while(left.length > 0) {
|
||||
const queue = left.slice(0, chunk_size);
|
||||
left = left.slice(chunk_size);
|
||||
|
||||
const start = Date.now();
|
||||
futures.push(file.local_url().then(data => {
|
||||
finish_count++;
|
||||
console.log("Downloaded %s (%s) (%ims)", file.name, file.path, Date.now() - start);
|
||||
static_cb("Downloading files", finish_count / files.length);
|
||||
}));
|
||||
futures = [];
|
||||
for(const file of queue) {
|
||||
console.log("Start downloading %s (%s)", file.name, file.path);
|
||||
|
||||
//await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
const start = Date.now();
|
||||
futures.push(file.local_url().then(data => {
|
||||
console.log("Downloaded %s (%s) (%ims)", file.name, file.path, Date.now() - start);
|
||||
static_cb("Downloading files", finish_count / files.length);
|
||||
}));
|
||||
}
|
||||
|
||||
try {
|
||||
await Promise.all(futures);
|
||||
} catch (error) {
|
||||
throw "Failed to download files: " + error;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await Promise.all(futures);
|
||||
} catch (error) {
|
||||
throw "Failed to download files: " + error;
|
||||
}
|
||||
return await generate_tmp() + "index.html"; /* entry point */
|
||||
}
|
||||
}
|
@ -6,8 +6,6 @@ import * as electron from "electron";
|
||||
const remote = electron.remote;
|
||||
const {Menu, MenuItem} = remote;
|
||||
|
||||
import {isFunction} from "util";
|
||||
|
||||
class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
||||
private _close_listeners: (() => any)[] = [];
|
||||
private _current_menu: electron.Menu;
|
||||
@ -53,7 +51,7 @@ class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
||||
if(entry.type == contextmenu.MenuEntryType.ENTRY) {
|
||||
return new MenuItem({
|
||||
id: _id,
|
||||
label: (isFunction(entry.name) ? (entry.name as (() => string))() : entry.name) as string,
|
||||
label: (typeof entry.name === "function" ? (entry.name as (() => string))() : entry.name) as string,
|
||||
type: "normal",
|
||||
click: click_callback,
|
||||
icon: class_to_image(entry.icon_class),
|
||||
@ -73,7 +71,7 @@ class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
||||
} else if(entry.type == contextmenu.MenuEntryType.CHECKBOX) {
|
||||
return new MenuItem({
|
||||
id: _id,
|
||||
label: (isFunction(entry.name) ? (entry.name as (() => string))() : entry.name) as string,
|
||||
label: (typeof entry.name === "function" ? (entry.name as (() => string))() : entry.name) as string,
|
||||
type: "checkbox",
|
||||
checked: !!entry.checkbox_checked,
|
||||
click: click_callback,
|
||||
@ -91,7 +89,7 @@ class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
||||
}
|
||||
return new MenuItem({
|
||||
id: _id,
|
||||
label: (isFunction(entry.name) ? (entry.name as (() => string))() : entry.name) as string,
|
||||
label: (typeof entry.name === "function" ? (entry.name as (() => string))() : entry.name) as string,
|
||||
type: "submenu",
|
||||
submenu: sub_menu,
|
||||
click: click_callback,
|
||||
|
@ -101,7 +101,7 @@ namespace _ppt {
|
||||
new_hooks.push(hook);
|
||||
if(!old_hooks.remove(hook) && hook.callback_press) {
|
||||
hook.callback_press();
|
||||
console.debug("Trigger key press for %o!", hook);
|
||||
//console.debug("Trigger key press for %o!", hook);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ namespace _ppt {
|
||||
for(const hook of old_hooks)
|
||||
if(hook.callback_release) {
|
||||
hook.callback_release();
|
||||
console.debug("Trigger key release for %o!", hook);
|
||||
//console.debug("Trigger key release for %o!", hook);
|
||||
}
|
||||
key_hooks_active = new_hooks;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ export class Arguments {
|
||||
static readonly UPDATER_LOCAL_VERSION = ["updater-local-version"];
|
||||
static readonly UPDATER_UI_LOAD_TYPE = ["updater-ui-loader_type"];
|
||||
static readonly UPDATER_UI_NO_CACHE = ["updater-ui-no-cache"];
|
||||
static readonly UPDATER_UI_IGNORE_VERSION = ["updater-ui-ignore-version"];
|
||||
static readonly DISABLE_HARDWARE_ACCELERATION = ["disable-hardware-acceleration"];
|
||||
static readonly NO_SINGLE_INSTANCE = ["no-single-instance"];
|
||||
static readonly DUMMY_CRASH_MAIN = ["dummy-crash-main"];
|
||||
|
@ -188,9 +188,5 @@ bool KeyboardHook::mouse_hook_callback(int nCode, WPARAM event, LPARAM ptr_mouse
|
||||
auto x_index = GET_XBUTTON_WPARAM(mouse->mouseData);
|
||||
this->trigger_key_event(event == WM_XBUTTONDOWN ? KeyEvent::PRESS : KeyEvent::RELEASE, "MOUSEX" + std::to_string(x_index));
|
||||
}
|
||||
else if(event == WM_MOUSEMOVE)
|
||||
;
|
||||
else
|
||||
cout << "Unknown event: " << event << endl;
|
||||
return false;
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
"start-d1": "electron . --disable-hardware-acceleration --debug -t --gdb -s -u=http://clientapi.teaspeak.dev/ --updater-ui-loader_type=0",
|
||||
"start-n": "electron . -t --disable-hardware-acceleration --no-single-instance -u=https://clientapi.teaspeak.de/ -d --updater-ui-loader_type=0",
|
||||
"start-01": "electron . --updater-channel=test -u=http://dev.clientapi.teaspeak.de/ -d --updater-ui-loader_type=0 --updater-local-version=1.0.1",
|
||||
"start-s": "electron . --disable-hardware-acceleration --debug -t -u http://localhost:8081/",
|
||||
"start-s": "electron . --disable-hardware-acceleration --debug --updater-ui-ignore-version -t -u http://localhost:8081/",
|
||||
"dtest": "electron . dtest",
|
||||
"compile-sass": "sass --update .:.",
|
||||
"compile-tsc": "tsc",
|
||||
|
Loading…
Reference in New Issue
Block a user