Some general updates
This commit is contained in:
parent
2ed8883626
commit
4377d92c7e
@ -75,6 +75,10 @@ export namespace ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function spawn_gui() {
|
function spawn_gui() {
|
||||||
|
if(gui) {
|
||||||
|
gui.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log("Spawn window!");
|
console.log("Spawn window!");
|
||||||
let dev_tools = false;
|
let dev_tools = false;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import * as electron from "electron";
|
|||||||
import MessageBoxOptions = Electron.MessageBoxOptions;
|
import MessageBoxOptions = Electron.MessageBoxOptions;
|
||||||
import {current_version, execute_graphical} from "../app-updater";
|
import {current_version, execute_graphical} from "../app-updater";
|
||||||
|
|
||||||
const TIMEOUT = 10000;
|
const TIMEOUT = 30000;
|
||||||
let local_path = undefined;
|
let local_path = undefined;
|
||||||
|
|
||||||
interface RemoteURL {
|
interface RemoteURL {
|
||||||
@ -77,7 +77,7 @@ function get_raw_app_files() : Promise<VersionedFile[]> {
|
|||||||
|
|
||||||
if(error) { reject(error); return; }
|
if(error) { reject(error); return; }
|
||||||
if(response.statusCode != 200) { setImmediate(reject, "invalid status code " + response.statusCode + " for " + url); 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) {
|
if(!body) {
|
||||||
setImmediate(reject, "invalid body. (Missing)");
|
setImmediate(reject, "invalid body. (Missing)");
|
||||||
return;
|
return;
|
||||||
@ -489,27 +489,33 @@ export async function load_files(channel: string, static_cb: (message: string, i
|
|||||||
}
|
}
|
||||||
console.log("Get raw files:");
|
console.log("Get raw files:");
|
||||||
let futures: Promise<void>[] = [];
|
let futures: Promise<void>[] = [];
|
||||||
let finish_count = 0;
|
let finish_count = files.length;
|
||||||
static_cb("Downloading files", 0);
|
static_cb("Downloading files", 0);
|
||||||
|
|
||||||
for(const file of files) {
|
const chunk_size = 5;
|
||||||
console.log("Start downloading %s (%s)", file.name, file.path);
|
let left = [...files];
|
||||||
|
while(left.length > 0) {
|
||||||
|
const queue = left.slice(0, chunk_size);
|
||||||
|
left = left.slice(chunk_size);
|
||||||
|
|
||||||
const start = Date.now();
|
futures = [];
|
||||||
futures.push(file.local_url().then(data => {
|
for(const file of queue) {
|
||||||
finish_count++;
|
console.log("Start downloading %s (%s)", file.name, file.path);
|
||||||
console.log("Downloaded %s (%s) (%ims)", file.name, file.path, Date.now() - start);
|
|
||||||
static_cb("Downloading files", finish_count / files.length);
|
|
||||||
}));
|
|
||||||
|
|
||||||
//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 */
|
return await generate_tmp() + "index.html"; /* entry point */
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,8 +6,6 @@ import * as electron from "electron";
|
|||||||
const remote = electron.remote;
|
const remote = electron.remote;
|
||||||
const {Menu, MenuItem} = remote;
|
const {Menu, MenuItem} = remote;
|
||||||
|
|
||||||
import {isFunction} from "util";
|
|
||||||
|
|
||||||
class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
||||||
private _close_listeners: (() => any)[] = [];
|
private _close_listeners: (() => any)[] = [];
|
||||||
private _current_menu: electron.Menu;
|
private _current_menu: electron.Menu;
|
||||||
@ -53,7 +51,7 @@ class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
|||||||
if(entry.type == contextmenu.MenuEntryType.ENTRY) {
|
if(entry.type == contextmenu.MenuEntryType.ENTRY) {
|
||||||
return new MenuItem({
|
return new MenuItem({
|
||||||
id: _id,
|
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",
|
type: "normal",
|
||||||
click: click_callback,
|
click: click_callback,
|
||||||
icon: class_to_image(entry.icon_class),
|
icon: class_to_image(entry.icon_class),
|
||||||
@ -73,7 +71,7 @@ class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
|||||||
} else if(entry.type == contextmenu.MenuEntryType.CHECKBOX) {
|
} else if(entry.type == contextmenu.MenuEntryType.CHECKBOX) {
|
||||||
return new MenuItem({
|
return new MenuItem({
|
||||||
id: _id,
|
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",
|
type: "checkbox",
|
||||||
checked: !!entry.checkbox_checked,
|
checked: !!entry.checkbox_checked,
|
||||||
click: click_callback,
|
click: click_callback,
|
||||||
@ -91,7 +89,7 @@ class ElectronContextMenu implements contextmenu.ContextMenuProvider {
|
|||||||
}
|
}
|
||||||
return new MenuItem({
|
return new MenuItem({
|
||||||
id: _id,
|
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",
|
type: "submenu",
|
||||||
submenu: sub_menu,
|
submenu: sub_menu,
|
||||||
click: click_callback,
|
click: click_callback,
|
||||||
|
@ -101,7 +101,7 @@ namespace _ppt {
|
|||||||
new_hooks.push(hook);
|
new_hooks.push(hook);
|
||||||
if(!old_hooks.remove(hook) && hook.callback_press) {
|
if(!old_hooks.remove(hook) && hook.callback_press) {
|
||||||
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)
|
for(const hook of old_hooks)
|
||||||
if(hook.callback_release) {
|
if(hook.callback_release) {
|
||||||
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;
|
key_hooks_active = new_hooks;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ export class Arguments {
|
|||||||
static readonly UPDATER_LOCAL_VERSION = ["updater-local-version"];
|
static readonly UPDATER_LOCAL_VERSION = ["updater-local-version"];
|
||||||
static readonly UPDATER_UI_LOAD_TYPE = ["updater-ui-loader_type"];
|
static readonly UPDATER_UI_LOAD_TYPE = ["updater-ui-loader_type"];
|
||||||
static readonly UPDATER_UI_NO_CACHE = ["updater-ui-no-cache"];
|
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 DISABLE_HARDWARE_ACCELERATION = ["disable-hardware-acceleration"];
|
||||||
static readonly NO_SINGLE_INSTANCE = ["no-single-instance"];
|
static readonly NO_SINGLE_INSTANCE = ["no-single-instance"];
|
||||||
static readonly DUMMY_CRASH_MAIN = ["dummy-crash-main"];
|
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);
|
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));
|
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;
|
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-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-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-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",
|
"dtest": "electron . dtest",
|
||||||
"compile-sass": "sass --update .:.",
|
"compile-sass": "sass --update .:.",
|
||||||
"compile-tsc": "tsc",
|
"compile-tsc": "tsc",
|
||||||
|
Loading…
Reference in New Issue
Block a user