Commit Graph
1561 Commits
Author SHA1 Message Date
BastiaanandClaude Opus 5.5 c2c7edf1b7 Default to the newest Base Game pack on new clusters (#1216)
A new cluster gets the default mod packs but controller.default_mod_pack_id
stays null, so the first Create save or Start fails with "Default mod pack
not set on controller". When seeding the packs, also point the default at
the newest Base Game pack, unless an admin already set one. Clusters that
already have mod packs are left alone. The config is written with the
mod packs on the next autosave or shutdown.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:03:22 +00:00
BastiaanandClaude Opus 5.5 09d79d775f Fix small web interface nits from the RC smoke test (#1215)
Fix the "Permamently" typo in the delete instance confirm.

The Search Mod Portal dialog now opens on the default mod pack's
Factorio version, or the newest known version when there is no default
pack. It used to always start on 2.0. A version the user picks still
sticks while the page is open.

The mod portal cache key used request.hide_deprecated directly, and the
web interface never sends it, so the controller logged "2.0-undefined".
A missing value now counts as false, the same default
fetchAllModsFromPortal already uses, so "2.1" and "2.1-false" share a
cache entry.

Closes #1209

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:57:32 +00:00
BastiaanandClaude Opus 5.5 c6bc81b0df Confirm controller and host restarts in the web UI (#1214)
Restart on the Controller and host pages sent the request on click. A
host restart stops every running instance on it, and they stay down
unless instance.auto_start is set, so one misclick takes servers
offline. Both now open a confirm dialog first, and the host one names
the running instances it will stop.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:51:34 +00:00
BastiaanandClaude Opus 5.5 8acb54985c Print Set values in ctl tables as lists (#1213)
user list, user show and role list passed UserDetails and Role objects
straight to as-table, whose default String() turns the roleIds,
instances and permissions Sets into "[object Set]". Move the as-table
setup into command_ops.ts with a cell printer that joins Sets with
", ", and use it for the user and role commands.

The integration tests for role list and user list now capture the
output and check it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:44:39 +00:00
BastiaanandClaude Opus 5.5 ec2bc6504b Exit run scripts with the code that stopped the restart loop (#1212)
run-controller.sh and run-host.sh ran `exit $?` after the `[[ ]]` test,
so they exited with the test's status (0) even when the process exited
with 8 to ask not to be restarted. Save the status before testing it.

The .cmd scripts now pass 8 to `exit /b` explicitly instead of relying on
a bare `exit /b` to carry the errorlevel through.

Closes #1208.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:44:17 +00:00
Bastiaan 154ebe294a Merge pull request #1211 from bbassie/fix/pairing-restart-pending
Don't flag a restart when a new host pairs
2026-11-17 10:32:44 +00:00
Cooldude2606 61f2b01172 Prepare 2.1.0 2026-11-14 22:53:42 +00:00
Daniel 79ef9aaeb0 Merge branch 'master' into fix/stream-reject-closes-connection 2026-11-13 23:17:41 +01:00
Danielv123 b31983e30b Close requests moving too little instead of idle ones
Replace controller.transfer_idle_timeout with
controller.transfer_min_progress, the amount a request has to move
every 30 seconds, so a request trickled in is closed too. The check
now runs for every route.

Both ends of a proxy stream are judged on what the receiver has taken,
so a sender held back by a slow receiver is not closed.

Keep the limit on receiving headers, which turning off the request
timeout also turned off.
2026-11-13 22:59:12 +01:00
Bastiaan e37bf31cd3 Merge pull request #1200 from bbassie/feature/log-retention
Delete log files older than a configurable number of days
2026-11-13 19:30:24 +00:00
Cooldude2606 9ec817c1c6 Share one connect and close listener between subscribers (#1171)
* Share one connect and close listener between subscribers

Every EventSubscriber added its own connect and close listener to the
connector, and Link caps the connector at 20 listeners per event. The
web Control and App use 13 close listeners, so the 8th plugin
subscriber made the browser log MaxListenersExceededWarning on every
page load. Subscribers on a connector now share one listener for each
event, which leaves the cap in place for everything else.

* Keep the connector subscribers as a static on EventSubscriber
2026-11-11 17:49:48 +00:00
BastiaanandClaude Opus 5.5 e2185e9269 Detect Steam's Factorio install on macOS in the installer (#1195)
Steam on macOS puts Factorio in ~/Library/Application Support/Steam/steamapps/common/Factorio, with the app bundle inside it. Point at factorio.app/Contents like the existing /Applications entry, since that's where data/ lives and the host finds MacOS/factorio next to it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 17:43:35 +00:00
BastiaanandClaude Opus 5.5 381d1d8573 Show online player count on the instance list (#1196)
Counts users per instance from the shared users subscription, the same
data the instance page's online players list reads, so the table adds
no per-row requests. The column is sortable and hidden without
core.user.subscribe.

Fixes #1193

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 17:42:16 +00:00
BastiaanandClaude Opus 5.5 ae707f7768 Always show the instance player list, collapsed when empty (#1197)
The list used to disappear when nobody was online. It is now a Collapse
that opens while players are online and closes when the last one leaves.
Once the user toggles it, their choice sticks for the page.

Fixes #1191

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 17:40:37 +00:00
BastiaanandClaude Opus 5.5 484cffc136 Add controller metrics for WebSocket session events (#1199)
Counts ready, resume, drop and session timeout per connection type
(host or control), plus resume attempts rejected for an unknown or
expired session. Lets a dashboard show hosts or users reconnecting.

Fixes #1192

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 17:37:13 +00:00
Danielv123 f86ebb6e66 Keep the connector subscribers as a static on EventSubscriber 2026-11-11 11:22:08 +01:00
bbassieandClaude Opus 5.5 3868efcead Focus the mod search inputs when they open
The "Add mods" card on the mod pack view mounts when shown, so autoFocus
is enough there. The Search Mod Portal modal stays mounted after the
first open, so it focuses the name input from afterOpenChange instead.

Fixes #1194

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:38:11 +00:00
Danielv123 49ddc9ebd1 Stop reading all rejected uploads and close stalled transfers
Guard the export, save, mod and stream routes with one middleware that
closes the connection of an upload answered before its body was read,
and of a transfer that has made no progress for the new
controller.transfer_idle_timeout.

The save and mod uploads share one handler that responds on the first
error instead of reading the rest of the upload, and uploads cut short
now fail the transfer instead of leaving it hanging.

Node's 5 minute limit on receiving a request is turned off so large
uploads over slow connections are not cut off.
2026-11-10 21:59:03 +01:00
Danielv123 60a4b103ab Merge remote-tracking branch 'origin/master' into fix/stream-reject-closes-connection 2026-11-10 21:32:23 +01:00
Cooldude2606andClaude Opus 5.5 7cf9cf8d3e Unpatch saves started with save patching disabled (#1184)
* Unpatch saves started with save patching disabled

Turning factorio.enable_save_patching off did nothing to a save that
was patched before. Its control.lua still loaded every module, so the
clusterio_api interface, player_sync's join handling and the other
module event handlers kept running with no plugin on the host side.

When patching is disabled the instance now restores the original
control.lua that patching kept as scenario.lua and removes the module
files, locale files included, as listed in clusterio.json. The patch
info stays with an empty module list so the patch number keeps
counting. Otherwise patching the save again would reuse the number
stored in the game and on_server_startup would not be raised. Data
the modules put in storage is left alone.

PatchInfo.fromSave dropped the version read from the save, so the
check against newer patch versions never fired. It now keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Remove scenario.lua when unpatching a save

Unpatching moves scenario.lua back to control.lua instead of copying it, so the save only keeps clusterio.json for the patch number. Patching such a save again copies control.lua back to scenario.lua.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 20:58:13 +00:00
BastiaanandClaude Opus 5.5 6d9a32d28b Show localised names of mod settings in the web UI (#1181)
The mod pack page only looked up mod-setting-name.<name>, so settings
with a localised_name showed the internal name, and rich text tags in
the locale showed up as raw text.

Resolve localised_name and localised_description from the exported
settings prototypes against the exported locale, falling back to the
mod-setting-name/mod-setting-description keys and then the internal
name. The resolver handles parameters, the "" and "?" keys and
__ITEM__/__ENTITY__/__TILE__/__FLUID__ references. Rich text
formatting tags are removed and prototype icons are replaced with
their name.

Fixes #768

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:02:37 +00:00
bbassieandClaude Opus 5.5 513d964a8b Remove scenario.lua when unpatching a save
Unpatching moves scenario.lua back to control.lua instead of copying it, so the save only keeps clusterio.json for the patch number. Patching such a save again copies control.lua back to scenario.lua.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 17:21:19 +00:00
BastiaanandClaude Opus 5.5 c6867de13d Keep users instance filter and icon search in the URL (#1185)
The instance picker on the users page and the search box on the icon
reference page held their value in component state, so leaving the page
and coming back with the browser history reset them. Both now go through
useTableQueryState like the table filters do, as user.instance and
icon.search.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:22:02 +00:00
Bastiaan 4a2c164188 Merge pull request #1183 from bbassie/fix/save-patching-plugin-default
Default load_plugin to off when the instance lacks required features
2026-11-04 01:19:10 +00:00
bbassieandClaude Opus 5.5 4c6aed3cff Return the host record from verifyHostToken
Matches verifyUserToken returning the user. HostConnection._saveInfo is
renamed saveRecord to match User.saveRecord.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:37:37 +00:00
bbassieandClaude Opus 5.5 e6554e09c7 Add HostManager for host records and host tokens
controller.hosts is now a HostManager wrapping the hosts datastore, the
same way controller.users wraps the users datastore. It owns creating
hosts (moved from HostPairingManager), revoking them (moved from
ControlConnection) and signing and verifying host tokens (moved from
Controller, generateHostToken is renamed signHostToken to match
signUserToken).

UserManager gains verifyUserToken, replacing the copies of the user
token check in WsServer and routes. The WsServer copy accepted a token
without iat when the user had no tokenValidAfter; the shared check
always requires iat, which jsonwebtoken adds by default.

Follows Cooldude2606's comment on #1161.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:37:37 +00:00
BastiaanandClaude Opus 5.5 5d1e98dafd Hide unknown mod pack settings and allow removing them (#1179)
Settings stored in a mod pack that no setting prototype in the export
data defines are now listed in a collapsed "Unknown settings" panel
under each scope instead of under an "Unknown Fields" heading. Each one
has a remove link, and a revert link once removed, matching what
`clusterioctl mod-pack edit --remove-setting` already allows. They are
never removed automatically.

Without export data nothing is called unknown and stored settings are
listed as before, without a mod heading.

Fixes #773

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:18:32 +00:00
bbassieandClaude Opus 5.5 ca3dbab49d Unpatch saves started with save patching disabled
Turning factorio.enable_save_patching off did nothing to a save that
was patched before. Its control.lua still loaded every module, so the
clusterio_api interface, player_sync's join handling and the other
module event handlers kept running with no plugin on the host side.

When patching is disabled the instance now restores the original
control.lua that patching kept as scenario.lua and removes the module
files, locale files included, as listed in clusterio.json. The patch
info stays with an empty module list so the patch number keeps
counting. Otherwise patching the save again would reuse the number
stored in the game and on_server_startup would not be raised. Data
the modules put in storage is left alone.

PatchInfo.fromSave dropped the version read from the save, so the
check against newer patch versions never fired. It now keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:16:52 +00:00
BastiaanandClaude Opus 5.5 d250394580 Show the mod pack an instance uses in the web UI (#1177)
InstanceDetails now carries factorio.mod_pack_id as modPackId, so the
instance list and pages can show it without fetching each config. The
web UI resolves an unset value to the controller default and tags it
"Default". The name links to the mod pack page.

Closes #852

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:07:26 +00:00
bbassieandClaude Opus 5.5 f14bfc3222 Address review of template inheritance
- Unlinking a field enables Apply on its own and sends the current value.
- The link button no longer toggles the checkbox of its label.
- Link and disconnect icons for all four states, pending ones highlighted.
- instance.is_template is hidden.
- ctl create takes --as-template.
- Clearer names for the InstanceManager inheritance helpers.

Part of #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:57:01 +00:00
bbassieandClaude Opus 5.5 943619a657 Show the template value while a link is staged
Part of #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:54:37 +00:00
bbassieandClaude Opus 5.5 cd04995b65 Use link and disconnect icons for template inheritance
Overridden values show a disconnect icon. Clicking it stages a link,
shown with a link icon, which is applied together with the other
changes instead of right away.

Part of #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:54:37 +00:00
bbassieandClaude Opus 5.5 b584991f5c Give templates their own table and keep rcon_password per instance
The templates table shows name, inheritor count and a create instance
action instead of the instance status and start/stop columns.
factorio.rcon_password joins the ports as never inherited.

Part of #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:54:37 +00:00
bbassieandClaude Opus 5.5 b5c372f109 Rename bases to templates and add per property inheritance
Review changes for #1142:
- base becomes template everywhere (is_template, template_id,
  --template, --is-template, --templates, InstanceDetails.isTemplate).
- Object fields inherit per property. inherited_fields lists the
  overridden properties for object fields and the template object is
  merged with them.
- Linking a template also inherits fields that hold the default value.
  The server name stays per instance.
- Ports are never inherited.
- InstanceDetails carries templateId.

Web UI: inherited values are locked until unlocked, overridden values
can be inherited again, templates are listed separately, the create
modal can create templates and instances from templates, and the
instance page has "Create template" which can link the source.

Part of #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:54:37 +00:00
bbassieandClaude Opus 5.5 01cf789f5d Add base instances for instance config inheritance
Instances can be marked as a base with instance.is_base and other
instances inherit config values from it through instance.base_id.
The controller copies base values into inheriting configs and keeps
track of inherited fields in the hidden instance.inherited_fields, so
hosts receive resolved configs and need no changes. Setting a field
stops inheriting it, `instance config inherit` undoes that.

Bases cannot be assigned to a host, are hidden from `instance list`
unless --bases is given, and cannot be deleted or unmarked while
other instances inherit from them. Chains of bases are allowed and
cycles are rejected.

Part of #200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:54:21 +00:00
024d7b427a Rename safeOutputFile to atomicOverwriteFile (#1167)
"safe" suggested the data being written survives a crash, it only
guarantees the old file is either kept or fully replaced. The new name
says what it does. No alias, plugin API breaks are allowed in minor
versions and the 2.1 migration guide lists the rename.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
2026-11-01 23:14:31 +00:00
Bastiaan 1b87497e15 Merge pull request #1154 from bbassie/fix/deleted-exports
Handle deleted export files
2026-11-01 23:10:27 +00:00
d7d1859aa0 Report missing base game icons when exporting from headless Factorio (#1153)
* Report missing base game icons when exporting from headless Factorio

The headless build has no graphics, so export-data found none of the
base game's icon files. Plain icons were skipped silently and layered
icons were drawn blank and counted as exported.

Skip a layered icon when any of its layers is missing, and log one
warning with the number of base game icon files that were not found.
Add host.factorio_graphics_directory to read builtin mod graphics from
a full install when the instance runs the headless build.

Fixes #1068

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Export without the graphics directory when it has no matching install

If host.factorio_graphics_directory had no install matching the major and
minor version of the instance, or did not exist, findVersion threw and the
whole export failed. Without the setting the same instance exports everything
except the base game icons, so it now logs a warning that names the setting
and exports without it.

* Find a full install in host.factorio_directory instead of a setting

Per review, drop host.factorio_graphics_directory. findVersion takes a
headless option that filters installs by build, telling them apart by
data/base/graphics/icons. When the instance runs the headless build the
export looks for a full install of the same major.minor version in the
host's factorio directory. Server startup is unchanged.

If none is found the export still runs, and the reason is included in
the missing icons warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Address review on findVersion and the export graphics lookup

findVersion takes headless as a plain optional argument, the helper is
checkInstallType, the warning is checkMissingBuiltinIcons and the full
install lookup is inlined into exportData.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Danielv123 <danielv@danielv.no>
2026-11-01 23:09:55 +00:00
Daniel 03ea6accc1 Show defaults for mod settings added while the page is open (#1172)
The mod pack view gave the settings form its values through the Form's
initialValues, which rc-field-form only applies when the form is
created. Settings added by a data export while the page was open were
shown empty, and color settings black, until the page was reloaded.
Each setting field now gets its saved value as its own initialValue,
which is applied when the field is created and when the form is reset.
2026-11-01 23:06:02 +00:00
bbassieandClaude Opus 5.5 f8aafe9265 Address review on findVersion and the export graphics lookup
findVersion takes headless as a plain optional argument, the helper is
checkInstallType, the warning is checkMissingBuiltinIcons and the full
install lookup is inlined into exportData.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:44:43 +00:00
bbassieandClaude Opus 5.5 37d74ca2a6 Find a full install in host.factorio_directory instead of a setting
Per review, drop host.factorio_graphics_directory. findVersion takes a
headless option that filters installs by build, telling them apart by
data/base/graphics/icons. When the instance runs the headless build the
export looks for a full install of the same major.minor version in the
host's factorio directory. Server startup is unchanged.

If none is found the export still runs, and the reason is included in
the missing icons warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:53:05 +00:00
Danielv123 46c6153201 Export without the graphics directory when it has no matching install
If host.factorio_graphics_directory had no install matching the major and
minor version of the instance, or did not exist, findVersion threw and the
whole export failed. Without the setting the same instance exports everything
except the base game icons, so it now logs a warning that names the setting
and exports without it.
2026-11-01 18:33:10 +01:00
Danielv123 46fd7fcad4 Merge remote-tracking branch 'origin/master' into fix/headless-export-icons 2026-11-01 18:32:20 +01:00
Daniel e251bf0072 Merge pull request #1174 from clusterio/fix/dev-plugin-shared-modules
Serve the web interface from source with --dev-plugin
2026-11-01 18:25:08 +01:00
Daniel 88855251e9 Merge pull request #1176 from clusterio/fix/export-skip-broken-icons
Skip icons that fail to export instead of failing the export
2026-11-01 18:24:58 +01:00
bbassieandClaude Opus 5.5 d2a4e9a4a1 Replace inquirer 8 with the @inquirer prompt packages in create
inquirer 8 pulls in 50 packages and 7.4 MB (rxjs, old chalk) for every
user running npm init @clusterio. The standalone select, input, confirm
and checkbox packages from the same project cover all prompts used and
cut the create install from 70 packages / 8.1 MB to 31 / 0.94 MB.

The Windows rl.close workaround now patches readline.Interface instead
of inquirer's Prompt class, since the new prompts create their own
readline interface. Ctrl+C at a prompt exits with code 130 instead of
0, and closed stdin no longer crashes with ERR_USE_AFTER_CLOSE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 17:53:36 +01:00
Danielv123 ff9080a766 Remove the close listener when a rejected upload ends
A connection kept open for more requests got one more close listener
for every rejected upload that finished within the grace period.
2026-11-01 17:46:24 +01:00
Danielv123 2e1710d3a9 Show the same page for missing, deleted and unloadable resources
Every view page handled a resource that can't be shown its own way, and
users without the subscribe permission were left on a spinner forever.

Adds useResourceState and a ResourceState component, used by the host,
instance, mod pack, icon reference, user, role and plugin pages and
exported for plugin pages. The single item hooks now also return the
subscription error.

Resolves #1165
2026-11-01 17:40:22 +01:00
Danielv123 8908079022 Merge remote-tracking branch 'origin/master' into host-pairing 2026-11-01 13:16:11 +01:00
Danielv123 495831da29 Stop waiting for approval when the terminal closes
SIGHUP while waiting for approval released the config lock but left the
host polling, as only SIGINT and SIGTERM stopped the wait.
2026-11-01 12:07:34 +01:00