sparkbun 0.1.4 → 0.1.6
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.
- package/dist-linux-arm64/libNativeWrapper.so +0 -0
- package/dist-linux-arm64/{libElectrobunCore.so → libSparkBunCore.so} +0 -0
- package/dist-linux-x64/libNativeWrapper.so +0 -0
- package/dist-linux-x64/{libElectrobunCore.so → libSparkBunCore.so} +0 -0
- package/dist-macos-arm64/libNativeWrapper.dylib +0 -0
- package/dist-macos-arm64/libSparkBunCore.dylib +0 -0
- package/dist-macos-x64/libNativeWrapper.dylib +0 -0
- package/dist-macos-x64/libSparkBunCore.dylib +0 -0
- package/dist-macos-x64/libasar.dylib +0 -0
- package/dist-macos-x64/libwebgpu_dawn.dylib +0 -0
- package/dist-macos-x64/process_helper +0 -0
- package/dist-win-arm64/SparkBunCore.dll +0 -0
- package/dist-win-arm64/WebView2Loader.dll +0 -0
- package/dist-win-arm64/libNativeWrapper.dll +0 -0
- package/dist-win-arm64/zig-asar/arm64/libasar.dll +0 -0
- package/dist-win-arm64/zig-asar/x64/libasar.dll +0 -0
- package/dist-win-x64/SparkBunCore.dll +0 -0
- package/package.json +1 -1
- package/scripts/setup-win-arm64.ps1 +19 -0
- package/src/browser/global.d.ts +11 -11
- package/src/browser/index.ts +10 -10
- package/src/bun/core/BrowserView.ts +2 -2
- package/src/bun/core/Updater.ts +6 -56
- package/src/bun/preload/.generated/compiled.ts +2 -2
- package/src/bun/preload/dragRegions.ts +2 -2
- package/src/bun/preload/encryption.ts +4 -4
- package/src/bun/preload/events.ts +4 -4
- package/src/bun/preload/globals.d.ts +14 -14
- package/src/bun/preload/index-sandboxed.ts +3 -3
- package/src/bun/preload/index.ts +19 -19
- package/src/bun/preload/internalRpc.ts +3 -3
- package/src/bun/preload/webviewTag.ts +2 -2
- package/src/bun/preload/wgpuTag.ts +1 -1
- package/src/bun/proc/native.ts +6 -6
- package/src/cli/index.ts +47 -83
- package/src/core/build.zig +1 -1
- package/src/core/main.zig +25 -24
- package/src/installer/installer-template.ts +1 -1
- package/src/launcher/main.ts +10 -10
- package/src/native/linux/cef_process_helper_linux.cpp +4 -4
- package/src/native/linux/nativeWrapper.cpp +230 -230
- package/src/native/macos/cef_process_helper_mac.cc +4 -4
- package/src/native/macos/nativeWrapper.mm +100 -100
- package/src/native/shared/accelerator_parser.h +5 -5
- package/src/native/shared/app_paths.h +7 -7
- package/src/native/shared/asar.h +5 -5
- package/src/native/shared/cache_migration.h +14 -14
- package/src/native/shared/callbacks.h +5 -5
- package/src/native/shared/cef_response_filter.h +18 -18
- package/src/native/shared/chromium_flags.h +6 -6
- package/src/native/shared/config.h +5 -5
- package/src/native/shared/download_event.h +5 -5
- package/src/native/shared/ffi_helpers.h +6 -6
- package/src/native/shared/glob_match.h +5 -5
- package/src/native/shared/json_menu_parser.h +5 -5
- package/src/native/shared/mime_types.h +5 -5
- package/src/native/shared/navigation_rules.h +5 -5
- package/src/native/shared/partition_context.h +5 -5
- package/src/native/shared/permissions.h +5 -5
- package/src/native/shared/permissions_cef.h +5 -5
- package/src/native/shared/preload_script.h +5 -5
- package/src/native/shared/shutdown_guard.h +5 -5
- package/src/native/shared/thread_safe_map.h +5 -5
- package/src/native/shared/webview_storage.h +5 -5
- package/src/native/win/cef_process_helper_win.cpp +4 -4
- package/src/native/win/dcomp_compositor.h +1 -1
- package/src/native/win/nativeWrapper.cpp +288 -288
- package/src/shared/bsdiff.ts +236 -0
- package/src/shared/bspatch.ts +98 -0
- package/dist-linux-arm64/bsdiff +0 -0
- package/dist-linux-arm64/bspatch +0 -0
- package/dist-linux-x64/bsdiff +0 -0
- package/dist-linux-x64/bspatch +0 -0
- package/dist-macos-arm64/bsdiff +0 -0
- package/dist-macos-arm64/bspatch +0 -0
- package/dist-macos-arm64/libElectrobunCore.dylib +0 -0
- package/dist-macos-arm64/preload-full.js +0 -885
- package/dist-macos-arm64/preload-sandboxed.js +0 -111
- package/dist-win-x64/ElectrobunCore.dll +0 -0
- package/dist-win-x64/bsdiff.exe +0 -0
- package/dist-win-x64/bspatch.exe +0 -0
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Parses strings like "CommandOrControl+Shift+T" into modifier flags and a key.
|
|
3
3
|
// Header-only to match the pattern of json_menu_parser.h.
|
|
4
4
|
|
|
5
|
-
#ifndef
|
|
6
|
-
#define
|
|
5
|
+
#ifndef SPARKBUN_ACCELERATOR_PARSER_H
|
|
6
|
+
#define SPARKBUN_ACCELERATOR_PARSER_H
|
|
7
7
|
|
|
8
8
|
#include <string>
|
|
9
9
|
#include <vector>
|
|
10
10
|
#include <algorithm>
|
|
11
11
|
|
|
12
|
-
namespace
|
|
12
|
+
namespace sparkbun {
|
|
13
13
|
|
|
14
14
|
struct AcceleratorParts {
|
|
15
15
|
std::string key; // The key, lowercased (e.g. "t", "f1", "space")
|
|
@@ -67,6 +67,6 @@ inline AcceleratorParts parseAccelerator(const std::string& accelerator) {
|
|
|
67
67
|
return result;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
} // namespace
|
|
70
|
+
} // namespace sparkbun
|
|
71
71
|
|
|
72
|
-
#endif //
|
|
72
|
+
#endif // SPARKBUN_ACCELERATOR_PARSER_H
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#ifndef
|
|
2
|
-
#define
|
|
1
|
+
#ifndef SPARKBUN_APP_PATHS_H
|
|
2
|
+
#define SPARKBUN_APP_PATHS_H
|
|
3
3
|
|
|
4
4
|
#include <string>
|
|
5
5
|
|
|
6
|
-
namespace
|
|
6
|
+
namespace sparkbun {
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Build the app data path using identifier/channel structure.
|
|
@@ -11,7 +11,7 @@ namespace electrobun {
|
|
|
11
11
|
* the CLI and updater conventions.
|
|
12
12
|
*
|
|
13
13
|
* @param basePath The base application support/data path (e.g., ~/Library/Application Support)
|
|
14
|
-
* @param identifier The app identifier (e.g., "sh.
|
|
14
|
+
* @param identifier The app identifier (e.g., "sh.sparkbun-kitchen")
|
|
15
15
|
* @param channel The release channel (e.g., "dev", "canary", "stable")
|
|
16
16
|
* @param suffix Optional suffix to append (e.g., "CEF", "WebView2")
|
|
17
17
|
* @param pathSeparator The path separator to use ('/' for Unix, '\\' for Windows)
|
|
@@ -24,7 +24,7 @@ inline std::string buildAppDataPath(
|
|
|
24
24
|
const std::string& suffix = "",
|
|
25
25
|
char pathSeparator = '/'
|
|
26
26
|
) {
|
|
27
|
-
std::string appId = !identifier.empty() ? identifier : "
|
|
27
|
+
std::string appId = !identifier.empty() ? identifier : "SparkBun";
|
|
28
28
|
std::string channelPath = !channel.empty() ? channel : "default";
|
|
29
29
|
|
|
30
30
|
std::string result = basePath;
|
|
@@ -105,6 +105,6 @@ inline std::string buildCEFPartitionPath(
|
|
|
105
105
|
return base;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
} // namespace
|
|
108
|
+
} // namespace sparkbun
|
|
109
109
|
|
|
110
|
-
#endif //
|
|
110
|
+
#endif // SPARKBUN_APP_PATHS_H
|
package/src/native/shared/asar.h
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// - libasar library (macOS, Linux)
|
|
6
6
|
// - Built-in AsarArchive class (Windows)
|
|
7
7
|
|
|
8
|
-
#ifndef
|
|
9
|
-
#define
|
|
8
|
+
#ifndef SPARKBUN_ASAR_H
|
|
9
|
+
#define SPARKBUN_ASAR_H
|
|
10
10
|
|
|
11
11
|
#include <cstdint>
|
|
12
12
|
#include <cstddef>
|
|
@@ -23,13 +23,13 @@ extern "C" {
|
|
|
23
23
|
void asar_free_buffer(const uint8_t* buffer, size_t size);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
namespace
|
|
26
|
+
namespace sparkbun {
|
|
27
27
|
|
|
28
28
|
// Global ASAR archive handle (lazy-loaded) with thread-safe initialization
|
|
29
29
|
// Each platform should define these in their nativeWrapper implementation
|
|
30
30
|
// as: static AsarArchive* g_asarArchive = nullptr;
|
|
31
31
|
// static std::once_flag g_asarArchiveInitFlag;
|
|
32
32
|
|
|
33
|
-
} // namespace
|
|
33
|
+
} // namespace sparkbun
|
|
34
34
|
|
|
35
|
-
#endif //
|
|
35
|
+
#endif // SPARKBUN_ASAR_H
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// cache_migration.h - One-shot CEF cache folder wipe on
|
|
1
|
+
// cache_migration.h - One-shot CEF cache folder wipe on SparkBun upgrades.
|
|
2
2
|
//
|
|
3
|
-
// When
|
|
3
|
+
// When SparkBun ships a release whose CEF cache folder layout/contents are
|
|
4
4
|
// incompatible with prior releases (e.g. a CEF major bump that surfaces
|
|
5
|
-
// "Profile error" dialogs, or an
|
|
5
|
+
// "Profile error" dialogs, or an SparkBun-side change to partition layout),
|
|
6
6
|
// the simplest reliable recovery is to wipe the cache folder. End users will
|
|
7
7
|
// be logged out of sites they were logged into via the app, but the app
|
|
8
8
|
// starts cleanly with no dialogs.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// always require a wipe.
|
|
13
13
|
//
|
|
14
14
|
// Behavior:
|
|
15
|
-
// 1. Reads <cacheFolder>/.
|
|
15
|
+
// 1. Reads <cacheFolder>/.sparkbun_cef_cache_version on startup.
|
|
16
16
|
// 2. If the sentinel is missing OR its value != CEF_CACHE_FORMAT_VERSION,
|
|
17
17
|
// deletes everything inside cacheFolder (preserving the folder itself)
|
|
18
18
|
// and writes a fresh sentinel.
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
//
|
|
25
25
|
// Safety guards (any failure → no-op, never wipe):
|
|
26
26
|
// - empty / null / relative paths
|
|
27
|
-
// - paths whose final component isn't a known
|
|
27
|
+
// - paths whose final component isn't a known SparkBun cache name
|
|
28
28
|
// - paths shallower than 3 components below the filesystem root
|
|
29
29
|
// - any std::filesystem exception
|
|
30
30
|
//
|
|
31
31
|
// Callers must invoke this AFTER computing the cache path and BEFORE
|
|
32
32
|
// CefInitialize is called for that path. Multi-process locking is NOT
|
|
33
|
-
// implemented:
|
|
33
|
+
// implemented: SparkBun's app process starts before any windows open,
|
|
34
34
|
// so concurrent first-launch races aren't a concern in practice.
|
|
35
35
|
|
|
36
|
-
#ifndef
|
|
37
|
-
#define
|
|
36
|
+
#ifndef SPARKBUN_CACHE_MIGRATION_H
|
|
37
|
+
#define SPARKBUN_CACHE_MIGRATION_H
|
|
38
38
|
|
|
39
39
|
#include <cstdint>
|
|
40
40
|
#include <cstdio>
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
#include <string>
|
|
45
45
|
#include <system_error>
|
|
46
46
|
|
|
47
|
-
namespace
|
|
47
|
+
namespace sparkbun {
|
|
48
48
|
|
|
49
49
|
// MANUAL bump only. Increment when a release requires that end users'
|
|
50
50
|
// existing CEF cache folders be wiped on first launch after upgrade.
|
|
51
51
|
// Reasons that justify a bump:
|
|
52
52
|
// - CEF major-version jump that's known to surface profile-error dialogs
|
|
53
|
-
// -
|
|
53
|
+
// - SparkBun-side change to cache folder layout (e.g. partition path)
|
|
54
54
|
// - Any other situation where stale state would degrade the user experience
|
|
55
55
|
// in a way Chromium's own forward-migration can't handle.
|
|
56
56
|
// Bumping invalidates cookies/logins/site data for all users on first launch.
|
|
@@ -60,7 +60,7 @@ namespace electrobun {
|
|
|
60
60
|
constexpr uint32_t CEF_CACHE_FORMAT_VERSION = 2;
|
|
61
61
|
|
|
62
62
|
inline const char* cacheSentinelFilename() {
|
|
63
|
-
return ".
|
|
63
|
+
return ".sparkbun_cef_cache_version";
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
inline uint32_t readCacheSentinel(const std::filesystem::path& sentinelPath) {
|
|
@@ -102,7 +102,7 @@ inline void writeCacheSentinel(const std::filesystem::path& sentinelPath,
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// Refuses paths that look unsafe to wipe. Returns true only when the path
|
|
105
|
-
// is absolute, ends in a recognized
|
|
105
|
+
// is absolute, ends in a recognized SparkBun cache folder name, and is
|
|
106
106
|
// at least 3 components deep below the filesystem root.
|
|
107
107
|
inline bool isCachePathSafeToWipe(const std::filesystem::path& cachePath) {
|
|
108
108
|
if (cachePath.empty()) return false;
|
|
@@ -239,6 +239,6 @@ inline void migrateCacheFolderIfNeeded(const std::string& cacheFolderPath) {
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
} // namespace
|
|
242
|
+
} // namespace sparkbun
|
|
243
243
|
|
|
244
|
-
#endif //
|
|
244
|
+
#endif // SPARKBUN_CACHE_MIGRATION_H
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
// This is a header-only implementation to avoid build complexity.
|
|
5
5
|
|
|
6
|
-
#ifndef
|
|
7
|
-
#define
|
|
6
|
+
#ifndef SPARKBUN_CALLBACKS_H
|
|
7
|
+
#define SPARKBUN_CALLBACKS_H
|
|
8
8
|
|
|
9
9
|
#include <cstdint>
|
|
10
10
|
|
|
11
|
-
namespace
|
|
11
|
+
namespace sparkbun {
|
|
12
12
|
|
|
13
13
|
// Webview navigation and event callbacks
|
|
14
14
|
// NOTE: Bun's FFIType.true doesn't play well with Objective-C's YES/NO char booleans
|
|
@@ -52,6 +52,6 @@ typedef void (*QuitRequestedHandler)();
|
|
|
52
52
|
typedef const char* (*GetMimeType)(const char* filePath);
|
|
53
53
|
typedef const char* (*GetHTMLForWebviewSync)(uint32_t webviewId);
|
|
54
54
|
|
|
55
|
-
} // namespace
|
|
55
|
+
} // namespace sparkbun
|
|
56
56
|
|
|
57
|
-
#endif //
|
|
57
|
+
#endif // SPARKBUN_CALLBACKS_H
|
|
@@ -5,44 +5,44 @@
|
|
|
5
5
|
// This is a header-only implementation to avoid build complexity.
|
|
6
6
|
// Requires CEF headers to be included before this file.
|
|
7
7
|
|
|
8
|
-
#ifndef
|
|
9
|
-
#define
|
|
8
|
+
#ifndef SPARKBUN_CEF_RESPONSE_FILTER_H
|
|
9
|
+
#define SPARKBUN_CEF_RESPONSE_FILTER_H
|
|
10
10
|
|
|
11
11
|
#include <string>
|
|
12
12
|
#include <algorithm>
|
|
13
13
|
#include <cstring>
|
|
14
14
|
#include "preload_script.h"
|
|
15
15
|
|
|
16
|
-
namespace
|
|
16
|
+
namespace sparkbun {
|
|
17
17
|
|
|
18
18
|
// CEF Response Filter that injects preload scripts into HTML responses
|
|
19
19
|
// Injection happens right after <head> tag to ensure scripts run before page scripts
|
|
20
|
-
class
|
|
20
|
+
class SparkBunResponseFilter : public CefResponseFilter {
|
|
21
21
|
private:
|
|
22
22
|
std::string buffer_;
|
|
23
23
|
bool injected_;
|
|
24
|
-
PreloadScript
|
|
24
|
+
PreloadScript sparkbun_script_;
|
|
25
25
|
PreloadScript custom_script_;
|
|
26
26
|
|
|
27
27
|
public:
|
|
28
28
|
// Constructor with PreloadScript structs (preferred)
|
|
29
|
-
|
|
29
|
+
SparkBunResponseFilter(const PreloadScript& sparkbunScript,
|
|
30
30
|
const PreloadScript& customScript)
|
|
31
31
|
: injected_(false),
|
|
32
|
-
|
|
32
|
+
sparkbun_script_(sparkbunScript),
|
|
33
33
|
custom_script_(customScript) {}
|
|
34
34
|
|
|
35
35
|
// Constructor with raw strings (for compatibility)
|
|
36
|
-
|
|
36
|
+
SparkBunResponseFilter(const std::string& sparkbunScript,
|
|
37
37
|
const std::string& customScript = "")
|
|
38
38
|
: injected_(false),
|
|
39
|
-
|
|
39
|
+
sparkbun_script_(sparkbunScript),
|
|
40
40
|
custom_script_(customScript) {}
|
|
41
41
|
|
|
42
42
|
// Single script constructor (for simpler use cases)
|
|
43
|
-
explicit
|
|
43
|
+
explicit SparkBunResponseFilter(const std::string& script)
|
|
44
44
|
: injected_(false),
|
|
45
|
-
|
|
45
|
+
sparkbun_script_(script) {}
|
|
46
46
|
|
|
47
47
|
bool InitFilter() override {
|
|
48
48
|
buffer_.clear();
|
|
@@ -58,7 +58,7 @@ public:
|
|
|
58
58
|
size_t& data_out_written) override {
|
|
59
59
|
|
|
60
60
|
// If no scripts to inject, pass through directly
|
|
61
|
-
if (
|
|
61
|
+
if (sparkbun_script_.empty() && custom_script_.empty()) {
|
|
62
62
|
size_t copy_size = std::min(data_in_size, data_out_size);
|
|
63
63
|
std::memcpy(data_out, data_in, copy_size);
|
|
64
64
|
data_in_read = copy_size;
|
|
@@ -137,14 +137,14 @@ private:
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
std::string BuildScriptTag() const {
|
|
140
|
-
if (
|
|
140
|
+
if (sparkbun_script_.empty() && custom_script_.empty()) {
|
|
141
141
|
return "";
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
std::string result = "<script>\n";
|
|
145
145
|
|
|
146
|
-
if (!
|
|
147
|
-
result +=
|
|
146
|
+
if (!sparkbun_script_.empty()) {
|
|
147
|
+
result += sparkbun_script_.code;
|
|
148
148
|
result += "\n";
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -181,9 +181,9 @@ private:
|
|
|
181
181
|
return buffer_.empty() ? RESPONSE_FILTER_DONE : RESPONSE_FILTER_NEED_MORE_DATA;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
IMPLEMENT_REFCOUNTING(
|
|
184
|
+
IMPLEMENT_REFCOUNTING(SparkBunResponseFilter);
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
-
} // namespace
|
|
187
|
+
} // namespace sparkbun
|
|
188
188
|
|
|
189
|
-
#endif //
|
|
189
|
+
#endif // SPARKBUN_CEF_RESPONSE_FILTER_H
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
//
|
|
6
6
|
// This is a header-only implementation to avoid build complexity.
|
|
7
7
|
|
|
8
|
-
#ifndef
|
|
9
|
-
#define
|
|
8
|
+
#ifndef SPARKBUN_CHROMIUM_FLAGS_H
|
|
9
|
+
#define SPARKBUN_CHROMIUM_FLAGS_H
|
|
10
10
|
|
|
11
11
|
#include <string>
|
|
12
12
|
#include <vector>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// pulling in the full CEF headers (the call sites already include them).
|
|
19
19
|
#include "include/cef_command_line.h"
|
|
20
20
|
|
|
21
|
-
namespace
|
|
21
|
+
namespace sparkbun {
|
|
22
22
|
|
|
23
23
|
struct ChromiumFlag {
|
|
24
24
|
std::string name;
|
|
@@ -46,7 +46,7 @@ inline std::string readFileToString(const std::string& path) {
|
|
|
46
46
|
// Handles three value types:
|
|
47
47
|
// "flag-name": true -> add switch (hasValue = false)
|
|
48
48
|
// "flag-name": "value" -> add switch with value (hasValue = true)
|
|
49
|
-
// "flag-name": false -> skip a default flag set by
|
|
49
|
+
// "flag-name": false -> skip a default flag set by SparkBun
|
|
50
50
|
inline ChromiumFlagConfig parseChromiumFlags(const std::string& json) {
|
|
51
51
|
ChromiumFlagConfig config;
|
|
52
52
|
|
|
@@ -176,6 +176,6 @@ inline void applyChromiumFlags(const ChromiumFlagConfig& config,
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
} // namespace
|
|
179
|
+
} // namespace sparkbun
|
|
180
180
|
|
|
181
|
-
#endif //
|
|
181
|
+
#endif // SPARKBUN_CHROMIUM_FLAGS_H
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
//
|
|
5
5
|
// This is a header-only implementation to avoid build complexity.
|
|
6
6
|
|
|
7
|
-
#ifndef
|
|
8
|
-
#define
|
|
7
|
+
#ifndef SPARKBUN_CONFIG_H
|
|
8
|
+
#define SPARKBUN_CONFIG_H
|
|
9
9
|
|
|
10
10
|
#include <string>
|
|
11
11
|
#include <mutex>
|
|
12
12
|
|
|
13
|
-
namespace
|
|
13
|
+
namespace sparkbun {
|
|
14
14
|
|
|
15
15
|
// Thread-safe configuration singleton
|
|
16
16
|
class Config {
|
|
@@ -61,6 +61,6 @@ private:
|
|
|
61
61
|
std::string name_;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
} // namespace
|
|
64
|
+
} // namespace sparkbun
|
|
65
65
|
|
|
66
|
-
#endif //
|
|
66
|
+
#endif // SPARKBUN_CONFIG_H
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
//
|
|
5
5
|
// This is a header-only implementation to avoid build complexity.
|
|
6
6
|
|
|
7
|
-
#ifndef
|
|
8
|
-
#define
|
|
7
|
+
#ifndef SPARKBUN_DOWNLOAD_EVENT_H
|
|
8
|
+
#define SPARKBUN_DOWNLOAD_EVENT_H
|
|
9
9
|
|
|
10
10
|
#include <string>
|
|
11
11
|
#include <cstdint>
|
|
12
12
|
#include <sstream>
|
|
13
13
|
|
|
14
|
-
namespace
|
|
14
|
+
namespace sparkbun {
|
|
15
15
|
|
|
16
16
|
// Download event types
|
|
17
17
|
enum class DownloadEventType {
|
|
@@ -192,6 +192,6 @@ private:
|
|
|
192
192
|
DownloadEvent event_;
|
|
193
193
|
};
|
|
194
194
|
|
|
195
|
-
} // namespace
|
|
195
|
+
} // namespace sparkbun
|
|
196
196
|
|
|
197
|
-
#endif //
|
|
197
|
+
#endif // SPARKBUN_DOWNLOAD_EVENT_H
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
//
|
|
5
5
|
// This is a header-only implementation to avoid build complexity.
|
|
6
6
|
|
|
7
|
-
#ifndef
|
|
8
|
-
#define
|
|
7
|
+
#ifndef SPARKBUN_FFI_HELPERS_H
|
|
8
|
+
#define SPARKBUN_FFI_HELPERS_H
|
|
9
9
|
|
|
10
10
|
#include <string>
|
|
11
11
|
#include <cstring>
|
|
12
12
|
#include <cstdlib>
|
|
13
13
|
|
|
14
|
-
namespace
|
|
14
|
+
namespace sparkbun {
|
|
15
15
|
|
|
16
16
|
// Create a copy of a string for FFI callbacks
|
|
17
17
|
// The returned string is allocated with malloc/strdup and must be freed by the caller
|
|
@@ -127,13 +127,13 @@ public:
|
|
|
127
127
|
|
|
128
128
|
// Create FFI string (caller must free)
|
|
129
129
|
char* createFFIString() const {
|
|
130
|
-
return
|
|
130
|
+
return sparkbun::createFFIString(data_);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
private:
|
|
134
134
|
std::string data_;
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
} // namespace
|
|
137
|
+
} // namespace sparkbun
|
|
138
138
|
|
|
139
|
-
#endif //
|
|
139
|
+
#endif // SPARKBUN_FFI_HELPERS_H
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
// This is a header-only implementation to avoid build complexity.
|
|
5
5
|
// Supports * wildcard only, case-insensitive matching.
|
|
6
6
|
|
|
7
|
-
#ifndef
|
|
8
|
-
#define
|
|
7
|
+
#ifndef SPARKBUN_GLOB_MATCH_H
|
|
8
|
+
#define SPARKBUN_GLOB_MATCH_H
|
|
9
9
|
|
|
10
10
|
#include <string>
|
|
11
11
|
#include <cctype>
|
|
12
12
|
|
|
13
|
-
namespace
|
|
13
|
+
namespace sparkbun {
|
|
14
14
|
|
|
15
15
|
// Simple case-insensitive glob matcher (supports * wildcard only)
|
|
16
16
|
// Returns true if text matches the glob pattern
|
|
@@ -54,6 +54,6 @@ inline bool globMatch(const std::string& pattern, const std::string& text) {
|
|
|
54
54
|
return p == pattern.size();
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
} // namespace
|
|
57
|
+
} // namespace sparkbun
|
|
58
58
|
|
|
59
|
-
#endif //
|
|
59
|
+
#endif // SPARKBUN_GLOB_MATCH_H
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
// This is a header-only implementation to avoid build complexity.
|
|
6
6
|
// For complex JSON needs, use a proper JSON library instead.
|
|
7
7
|
|
|
8
|
-
#ifndef
|
|
9
|
-
#define
|
|
8
|
+
#ifndef SPARKBUN_JSON_MENU_PARSER_H
|
|
9
|
+
#define SPARKBUN_JSON_MENU_PARSER_H
|
|
10
10
|
|
|
11
11
|
#include <string>
|
|
12
12
|
#include <vector>
|
|
13
13
|
|
|
14
|
-
namespace
|
|
14
|
+
namespace sparkbun {
|
|
15
15
|
|
|
16
16
|
// Represents a parsed menu item from JSON
|
|
17
17
|
struct MenuItemJson {
|
|
@@ -218,6 +218,6 @@ inline std::vector<MenuItemJson> parseMenuJson(const std::string& jsonStr) {
|
|
|
218
218
|
return items;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
} // namespace
|
|
221
|
+
} // namespace sparkbun
|
|
222
222
|
|
|
223
|
-
#endif //
|
|
223
|
+
#endif // SPARKBUN_JSON_MENU_PARSER_H
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
//
|
|
5
5
|
// This is a header-only implementation to avoid build complexity.
|
|
6
6
|
|
|
7
|
-
#ifndef
|
|
8
|
-
#define
|
|
7
|
+
#ifndef SPARKBUN_MIME_TYPES_H
|
|
8
|
+
#define SPARKBUN_MIME_TYPES_H
|
|
9
9
|
|
|
10
10
|
#include <string>
|
|
11
11
|
|
|
12
|
-
namespace
|
|
12
|
+
namespace sparkbun {
|
|
13
13
|
|
|
14
14
|
// Get MIME type from a URL or file path based on extension
|
|
15
15
|
// Returns "application/octet-stream" as default for unknown types
|
|
@@ -96,6 +96,6 @@ inline std::string getMimeTypeFromUrl(const std::string& url) {
|
|
|
96
96
|
return "application/octet-stream"; // default
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
} // namespace
|
|
99
|
+
} // namespace sparkbun
|
|
100
100
|
|
|
101
|
-
#endif //
|
|
101
|
+
#endif // SPARKBUN_MIME_TYPES_H
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
//
|
|
5
5
|
// This is a header-only implementation to avoid build complexity.
|
|
6
6
|
|
|
7
|
-
#ifndef
|
|
8
|
-
#define
|
|
7
|
+
#ifndef SPARKBUN_NAVIGATION_RULES_H
|
|
8
|
+
#define SPARKBUN_NAVIGATION_RULES_H
|
|
9
9
|
|
|
10
10
|
#include <string>
|
|
11
11
|
#include <vector>
|
|
12
12
|
#include "glob_match.h"
|
|
13
13
|
|
|
14
|
-
namespace
|
|
14
|
+
namespace sparkbun {
|
|
15
15
|
|
|
16
16
|
// Represents a single navigation rule
|
|
17
17
|
// Rules starting with "^" are block rules (inverts the match)
|
|
@@ -93,6 +93,6 @@ inline bool checkNavigationRulesForUrl(const std::string& rulesString,
|
|
|
93
93
|
return checkNavigationRulesForUrl(rules, url, defaultAllow);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
} // namespace
|
|
96
|
+
} // namespace sparkbun
|
|
97
97
|
|
|
98
|
-
#endif //
|
|
98
|
+
#endif // SPARKBUN_NAVIGATION_RULES_H
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
// context for that partition with a warning. The webview still loads;
|
|
26
26
|
// isolation is lost for that one partition.
|
|
27
27
|
|
|
28
|
-
#ifndef
|
|
29
|
-
#define
|
|
28
|
+
#ifndef SPARKBUN_PARTITION_CONTEXT_H
|
|
29
|
+
#define SPARKBUN_PARTITION_CONTEXT_H
|
|
30
30
|
|
|
31
31
|
#include <string>
|
|
32
32
|
#include <map>
|
|
33
33
|
#include <mutex>
|
|
34
34
|
#include <cstdio>
|
|
35
35
|
|
|
36
|
-
namespace
|
|
36
|
+
namespace sparkbun {
|
|
37
37
|
|
|
38
38
|
// Platform-provided. Returns the absolute filesystem cache_path for a
|
|
39
39
|
// persistent partition with the given name (e.g. "test1"), creating any
|
|
@@ -132,6 +132,6 @@ inline CefRefPtr<CefRequestContext> getOrCreateRequestContextForPartition(
|
|
|
132
132
|
return context;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
} // namespace
|
|
135
|
+
} // namespace sparkbun
|
|
136
136
|
|
|
137
|
-
#endif //
|
|
137
|
+
#endif // SPARKBUN_PARTITION_CONTEXT_H
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
//
|
|
5
5
|
// This is a header-only implementation to avoid build complexity.
|
|
6
6
|
|
|
7
|
-
#ifndef
|
|
8
|
-
#define
|
|
7
|
+
#ifndef SPARKBUN_PERMISSIONS_H
|
|
8
|
+
#define SPARKBUN_PERMISSIONS_H
|
|
9
9
|
|
|
10
10
|
#include <string>
|
|
11
11
|
#include <map>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
#include <mutex>
|
|
14
14
|
#include <utility>
|
|
15
15
|
|
|
16
|
-
namespace
|
|
16
|
+
namespace sparkbun {
|
|
17
17
|
|
|
18
18
|
enum class PermissionType {
|
|
19
19
|
USER_MEDIA,
|
|
@@ -113,6 +113,6 @@ inline void cachePermission(const std::string& origin, PermissionType type, Perm
|
|
|
113
113
|
PermissionCache::getInstance().set(origin, type, status);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
} // namespace
|
|
116
|
+
} // namespace sparkbun
|
|
117
117
|
|
|
118
|
-
#endif //
|
|
118
|
+
#endif // SPARKBUN_PERMISSIONS_H
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Must be included AFTER include/cef_app.h (or any header that pulls in
|
|
3
3
|
// internal/cef_types.h) so the CEF_PERMISSION_TYPE_* constants are available.
|
|
4
4
|
|
|
5
|
-
#ifndef
|
|
6
|
-
#define
|
|
5
|
+
#ifndef SPARKBUN_PERMISSIONS_CEF_H
|
|
6
|
+
#define SPARKBUN_PERMISSIONS_CEF_H
|
|
7
7
|
|
|
8
8
|
// Consumers must already have included CEF headers that define
|
|
9
9
|
// CEF_PERMISSION_TYPE_* (e.g. include/cef_app.h, which pulls in
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
#include <cstdint>
|
|
14
14
|
#include <cstdio>
|
|
15
15
|
|
|
16
|
-
namespace
|
|
16
|
+
namespace sparkbun {
|
|
17
17
|
|
|
18
18
|
// Decode a CEF permission bitmask (as passed to OnShowPermissionPrompt) into a
|
|
19
19
|
// human-readable comma-separated list of permission names. Used to build
|
|
@@ -69,6 +69,6 @@ inline std::string describeCefPermissions(uint32_t mask) {
|
|
|
69
69
|
return out;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
} // namespace
|
|
72
|
+
} // namespace sparkbun
|
|
73
73
|
|
|
74
|
-
#endif //
|
|
74
|
+
#endif // SPARKBUN_PERMISSIONS_CEF_H
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
// This is a header-only implementation to avoid build complexity.
|
|
5
5
|
|
|
6
|
-
#ifndef
|
|
7
|
-
#define
|
|
6
|
+
#ifndef SPARKBUN_PRELOAD_SCRIPT_H
|
|
7
|
+
#define SPARKBUN_PRELOAD_SCRIPT_H
|
|
8
8
|
|
|
9
9
|
#include <string>
|
|
10
10
|
#include <map>
|
|
11
11
|
#include <mutex>
|
|
12
12
|
|
|
13
|
-
namespace
|
|
13
|
+
namespace sparkbun {
|
|
14
14
|
|
|
15
15
|
// Represents a preload script to be injected into webviews
|
|
16
16
|
struct PreloadScript {
|
|
@@ -66,6 +66,6 @@ private:
|
|
|
66
66
|
std::map<int, std::string> scripts_;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
} // namespace
|
|
69
|
+
} // namespace sparkbun
|
|
70
70
|
|
|
71
|
-
#endif //
|
|
71
|
+
#endif // SPARKBUN_PRELOAD_SCRIPT_H
|