aboutsummaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/Main.hx6
-rw-r--r--src/client/Utils.hx19
2 files changed, 25 insertions, 0 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx
index eae0fc8..96d9ad0 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -534,6 +534,9 @@ class Main {
case TogglePlaylistLock:
setPlaylistLock(data.togglePlaylistLock.isOpen);
+
+ case Dump:
+ Utils.saveFile("dump.json", ApplicationJson, data.dump.data);
}
}
@@ -879,6 +882,9 @@ class Main {
case "flashback", "fb":
send({type: Flashback});
return false;
+ case "dump":
+ send({type: Dump});
+ return true;
}
if (matchSimpleDate.match(command)) {
send({
diff --git a/src/client/Utils.hx b/src/client/Utils.hx
index 818dfdf..2c887ba 100644
--- a/src/client/Utils.hx
+++ b/src/client/Utils.hx
@@ -1,5 +1,6 @@
package client;
+import haxe.io.Mime;
import js.Browser.document;
import js.Browser.navigator;
import js.Browser.window;
@@ -126,4 +127,22 @@ class Utils {
document.body.appendChild(input);
input.click();
}
+
+ public static function saveFile(name:String, mime:Mime, data:String):Void {
+ final blob = new js.html.Blob([data], {
+ type: mime
+ });
+ final url = URL.createObjectURL(blob);
+ final a = document.createElement("a");
+ untyped a.download = name;
+ untyped a.href = url;
+ a.onclick = function(e) {
+ e.cancelBubble = true;
+ e.stopPropagation();
+ }
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+ }
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage