mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 23:33:13 +09:00
Rename inventory_sync to player_sync
The plugin syncs more than inventories now (settings, appearance, recipe notifications), so name it for what it does. The package becomes @clusterio/plugin-player_sync and every inventory_sync identifier follows. A migration entrypoint renames the inventory_sync config fields, including load_plugin, and the inventory view permission. The plugin moves inventories.json in the database directory to player_sync.json and storage.inventory_sync in saves to storage.player_sync itself, and closes dialogs left open under the old GUI names on startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e455d17bb7
commit
8363c5f0ef
39 files changed
+331
-177
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import * as lib from "@clusterio/lib";
|
||||
import { Controller } from "@clusterio/controller";
|
||||
|
||||
import { plugin as info } from "../dist/node/index.js";
|
||||
|
||||
describe("player_sync migrations", function() {
|
||||
before(async function() {
|
||||
lib.addPluginConfigFields([info]);
|
||||
const packagePath = fileURLToPath(new URL("../package.json", import.meta.url));
|
||||
await lib.loadPluginMigrations([{ ...info, packagePath }]);
|
||||
});
|
||||
after(function() {
|
||||
for (const hook of [
|
||||
lib.ControllerConfig.pluginMigrations, lib.HostConfig.pluginMigrations,
|
||||
lib.InstanceConfig.pluginMigrations, lib.Role.pluginMigrations,
|
||||
]) {
|
||||
hook.detach(info.name);
|
||||
}
|
||||
});
|
||||
|
||||
it("should rename inventory_sync config fields", function() { // Alpha 28
|
||||
const controllerConfig = lib.ControllerConfig.fromJSON({
|
||||
"inventory_sync.load_plugin": false,
|
||||
"inventory_sync.player_lock_timeout": 120,
|
||||
}, "controller");
|
||||
assert.equal(controllerConfig.get("player_sync.load_plugin"), false);
|
||||
assert.equal(controllerConfig.get("player_sync.player_lock_timeout"), 120);
|
||||
assert.equal(controllerConfig.toJSON()["inventory_sync.player_lock_timeout"], undefined);
|
||||
|
||||
const hostConfig = lib.HostConfig.fromJSON({ "inventory_sync.load_plugin": false }, "host");
|
||||
assert.equal(hostConfig.get("player_sync.load_plugin"), false);
|
||||
|
||||
const instanceConfig = lib.InstanceConfig.fromJSON({
|
||||
"inventory_sync.rcon_chunk_size": 500,
|
||||
}, "controller");
|
||||
assert.equal(instanceConfig.get("player_sync.rcon_chunk_size"), 500);
|
||||
});
|
||||
it("should rename the inventory_sync permission in roles", function() { // Alpha 28
|
||||
const result = Controller.migrateRoles([
|
||||
{ permissions: ["core.admin", "inventory_sync.inventory.view"] },
|
||||
]);
|
||||
assert.deepEqual(result, [{ permissions: ["core.admin", "player_sync.inventory.view"] }]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user