You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Move AutomatedStartupHandler from DebugAdapter to Systems library to be reusable from all host apps that is started with parameters for automation purposes.
* Implement query parameters for Avalonia Browser app for automated startup and scripts.
* Update Avalonia Browser automation doc.
* Fix bug in Avalonia Log header not being updated and cleared correctly.
* Automatically show ROM acknowledgement dialog when starting C64 from Avalonia Browser query parameters.
* Preserve Lua MoonSharp library from AOT trimming to make it more compatible with running in Browser/WebAssembly.
* Remove non-ascii characters from .lua scripts
* Fix Avalonia Browser script editor dialog height
* Add links to start screen
Copy file name to clipboardExpand all lines: docs/tools/scripting/configuration.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Configuration
2
2
3
-
Scripting is configured in `appsettings.json` under the `"Highbyte.DotNet6502.Scripting"` section:
3
+
On desktop targets, scripting is configured in `appsettings.json` under the `"Highbyte.DotNet6502.Scripting"` section. On the Avalonia Browser app, the same section is persisted in browser `localStorage` by the settings UI.
4
4
5
5
```json
6
6
"Highbyte.DotNet6502.Scripting": {
@@ -14,7 +14,8 @@ Scripting is configured in `appsettings.json` under the `"Highbyte.DotNet6502.Sc
14
14
"AllowHttpRequests": true,
15
15
"AllowStore": true,
16
16
"StoreSubDirectory": ".store",
17
-
"AllowTcpClient": false
17
+
"AllowTcpClient": false,
18
+
"AllowUrlScripts": false
18
19
}
19
20
```
20
21
@@ -32,3 +33,4 @@ Scripting is configured in `appsettings.json` under the `"Highbyte.DotNet6502.Sc
32
33
|`AllowStore`| bool |`true`| Whether the `store` global is available to Lua scripts. Provides a cross-platform key/value store. On desktop, backed by files in `StoreSubDirectory`. In browser, backed by `localStorage`. Default is `true`. |
33
34
|`StoreSubDirectory`| string |`".store"`| Subdirectory within `ScriptDirectory` used for the filesystem store backend (desktop only). Default is `".store"`. |
34
35
|`AllowTcpClient`| bool |`false`| Whether the `tcp` global is available to Lua scripts. Desktop only — forced `false` in browser/WASM builds. Default is `false`. |
36
+
|`AllowUrlScripts`| bool |`false`| Browser-only. When `true`, the Avalonia Browser app honours the `script` and `scriptUrl` URL query parameters at startup. Disabled by default because a crafted link could otherwise execute Lua against the user's emulator session and `localStorage`. Takes effect on the next page load. |
Copy file name to clipboardExpand all lines: docs/web-apps/avalonia-browser.md
+78Lines changed: 78 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,84 @@ To self-host, see [Run from command line](#run-from-command-line) below.
42
42
43
43
The browser app supports the same Lua scripting API as the Avalonia Desktop app, except for filesystem and TCP access (the browser sandbox does not allow them; the key/value store falls back to `localStorage`). For the full guide, see [Tools / Scripting](../tools/scripting/overview.md).
44
44
45
+
### URL query parameters
46
+
47
+
The Avalonia Browser app supports URL-driven startup automation. This is the browser counterpart to the Avalonia Desktop app's [CLI arguments](../desktop-apps/avalonia-desktop.md#cli-arguments): instead of passing `--system` or `--script`, you encode the request in the page URL query string.
48
+
49
+
Query parameter names are case-insensitive. Boolean flags treat an empty value, `1`, `true`, and `yes` as true.
50
+
51
+
| Query parameter | Purpose | Notes |
52
+
| --- | --- | --- |
53
+
|`system`| Pre-select a system such as `C64` or `Generic`. | Mirrors desktop `--system`. |
54
+
|`systemVariant`| Pre-select a system variant. | Requires `system`. Mirrors desktop `--systemVariant`. |
|`waitForSystemReady`| Wait until the system reports ready. | Requires `system` and `start`. Mirrors desktop `--waitForSystemReady`. |
57
+
|`loadPrgUrl`| Fetch a `.prg` over HTTP and load it into memory. | Requires `system` and `start`. Browser equivalent of desktop `--loadPrg`, but uses a URL instead of a local file path. Relative URLs are resolved from the app origin. |
58
+
|`runLoadedProgram`| Start executing the loaded PRG from its load address. | Requires `loadPrgUrl`. Mirrors desktop `--runLoadedProgram`. |
59
+
|`basicText`| Paste inline C64 BASIC source text into the running C64. | Base64url-encoded UTF-8 text. Requires `system=C64`, `start`, and `waitForSystemReady`. Mutually exclusive with `loadPrgUrl` and `runLoadedProgram`. |
60
+
|`basicUrl`| Fetch C64 BASIC source text over HTTP and paste it into the running C64. | Same semantics as `basicText`, but uses a text file URL instead of embedding the source in the query string. |
61
+
|`runBasic`| Queue `RUN` after BASIC source has been pasted. | Requires `basicText` or `basicUrl`. |
62
+
|`script`| Run an inline Lua script supplied as base64url-encoded UTF-8 text. | Browser only. Mutually exclusive with all system-driven parameters below. Disabled by default; gated by `Scripting.AllowUrlScripts`. |
63
+
|`scriptUrl`| Fetch a Lua script from a relative or absolute URL and run it. | Same behavior as `script`, but avoids URL-length limits. Disabled by default; gated by `Scripting.AllowUrlScripts`. |
64
+
65
+
Validation rules are intentionally forgiving: invalid combinations are ignored and the normal UI still loads.
66
+
67
+
When a URL starts `system=C64` and the app does not yet have the required C64 ROMs, the browser startup flow prompts the user to acknowledge the ROM download terms and can download the ROMs before continuing. This lets first-run automation links work without opening the C64 config dialog first.
68
+
69
+
1.`systemVariant` requires `system`.
70
+
2.`start` and `waitForSystemReady` require `system`.
71
+
3.`waitForSystemReady` requires `start`.
72
+
4.`loadPrgUrl` requires `system` and `start`.
73
+
5.`runLoadedProgram` requires `loadPrgUrl`.
74
+
6.`basicText` and `basicUrl` are mutually exclusive.
75
+
7.`basicText` and `basicUrl` require `system=C64`, `start`, and `waitForSystemReady`.
76
+
8.`basicText` and `basicUrl` are mutually exclusive with `loadPrgUrl` and `runLoadedProgram`.
77
+
9.`runBasic` requires `basicText` or `basicUrl`.
78
+
10.`script` and `scriptUrl` are mutually exclusive.
79
+
11.`script` and `scriptUrl` are also mutually exclusive with `system`, `start`, `waitForSystemReady`, `loadPrgUrl`, `runLoadedProgram`, `basicText`, `basicUrl`, and `runBasic`.
80
+
81
+
Examples:
82
+
83
+
```text
84
+
# Start C64 PAL and wait until the machine is ready
# Run an inline Lua script (base64url for: log.info('hello'))
97
+
?script=bG9nLmluZm8oJ2hlbGxvJyk
98
+
99
+
# Run a Lua script fetched over HTTP
100
+
?scriptUrl=scripts/example_emulator_control.lua
101
+
```
102
+
103
+
The browser app ships the `basicUrl` sample above as `basic/c64/hello-world.bas`, containing:
104
+
105
+
```basic
106
+
10 c1=7:c2=14
107
+
20 c=c1
108
+
30 if c=c1 then c=c2 : goto 50
109
+
40 if c=c2 then c=c1
110
+
50 poke 53280,c
111
+
60 print "hello world!"
112
+
70 for i=1 to 150:next
113
+
80 goto 30
114
+
```
115
+
116
+
Important differences from desktop automation:
117
+
118
+
-`loadPrgUrl`, `basicUrl`, and `scriptUrl` use browser HTTP fetch semantics, so normal browser origin and CORS rules apply.
119
+
-`basicText` and `basicUrl` are C64-only and use the normal keyboard paste path after BASIC is ready; `runBasic=1` simply appends `RUN` and Return after the pasted source.
120
+
- URL-driven Lua is **disabled by default**. Enable **Allow URL-driven scripts (script / scriptUrl query params)** in the browser app's general settings, save, then reload the page.
121
+
- URL-driven scripts do not behave exactly like desktop `--script`: the browser app still selects the configured default system first, then enables the injected script. The script can still take over by calling APIs such as `emu.select(...)` and `emu.start()`.
122
+
45
123
## How to run locally for development
46
124
47
125
For development system requirements, see [Development](../home/development.md).
Copy file name to clipboardExpand all lines: docs/web-apps/overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,6 @@ The two apps share the same emulator core — they differ in UI/rendering tech.
15
15
16
16
- Lua TCP client (`tcp` global) is unavailable — `System.Net.Sockets.TcpClient` is not supported in WebAssembly.
17
17
- Lua filesystem access (`file` / `emu.load`) is sandboxed; the key/value `store` falls back to `localStorage`.
18
-
- No CLI arguments, no VS Code debug adapter, no remote control endpoint — those are desktop-only features. See [Tools](../tools/overview.md)for the full list of integrations.
18
+
- No CLI arguments, no VS Code debug adapter, no remote control endpoint — those are desktop-only features. The Avalonia Browser app does support URL query parameters for automated startup and script injection; see [Avalonia Browser app](avalonia-browser.md#url-query-parameters).
19
19
20
20
For general project limitations, see [Limitations](../home/limitations.md).
0 commit comments