@aptre/bldr-saucer 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/src/main.cpp +12 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptre/bldr-saucer",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Native webview bridge for Bldr using Saucer",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -33,11 +33,11 @@
33
33
  "release:publish": "git push && git push --tags"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@aptre/bldr-saucer-darwin-arm64": "0.2.0",
37
- "@aptre/bldr-saucer-darwin-x64": "0.2.0",
38
- "@aptre/bldr-saucer-linux-x64": "0.2.0",
39
- "@aptre/bldr-saucer-linux-arm64": "0.2.0",
40
- "@aptre/bldr-saucer-win32-x64": "0.2.0"
36
+ "@aptre/bldr-saucer-darwin-arm64": "0.2.2",
37
+ "@aptre/bldr-saucer-darwin-x64": "0.2.2",
38
+ "@aptre/bldr-saucer-linux-x64": "0.2.2",
39
+ "@aptre/bldr-saucer-linux-arm64": "0.2.2",
40
+ "@aptre/bldr-saucer-win32-x64": "0.2.2"
41
41
  },
42
42
  "files": [
43
43
  "index.js",
package/src/main.cpp CHANGED
@@ -65,8 +65,18 @@ coco::stray start(saucer::application* app) {
65
65
  }).detach();
66
66
  });
67
67
 
68
- // Navigate to the bootstrap HTML served by Go.
69
- webview->set_url(saucer::url::make({.scheme = "bldr", .host = "localhost", .path = "/"}));
68
+ // Use set_html with JavaScript redirect to work around WebKit's
69
+ // loadFileURL being called incorrectly for custom schemes.
70
+ std::string nav_url = "bldr:///index.html";
71
+ const char* doc_id_env = std::getenv("BLDR_WEB_DOCUMENT_ID");
72
+ if (doc_id_env && doc_id_env[0] != '\0') {
73
+ nav_url += "?webDocumentId=" + std::string(doc_id_env);
74
+ }
75
+ std::string redirect_html =
76
+ "<!DOCTYPE html><html><head><meta charset=\"utf-8\">"
77
+ "<script>window.location.replace('" + nav_url + "');</script>"
78
+ "</head><body></body></html>";
79
+ webview->set_html(redirect_html);
70
80
 
71
81
  if (saucer_init.dev_tools) {
72
82
  webview->set_dev_tools(true);