mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 16:23:12 +09:00
Merge pull request #678 from Cooldude2606/fix/host-user-sync
Fix host being unable to sync user state to instances after controller connection
This commit is contained in:
3 files changed
+15
-4
No files matched your search
@@ -64,6 +64,7 @@ Many thanks to the following for contributing to this release:
|
|||||||
- Added `host.factorio_username` and `host.factorio_token` config to set Factorio credentials used on a given host.
|
- Added `host.factorio_username` and `host.factorio_token` config to set Factorio credentials used on a given host.
|
||||||
- Fixed 2.0 version extraction from linux headless downloaded during installation of clusterio. [#671](https://github.com/clusterio/clusterio/pull/671)
|
- Fixed 2.0 version extraction from linux headless downloaded during installation of clusterio. [#671](https://github.com/clusterio/clusterio/pull/671)
|
||||||
- Updated display name and description of `controller.external_address` to avoid confusion. [#674](https://github.com/clusterio/clusterio/pull/674)
|
- Updated display name and description of `controller.external_address` to avoid confusion. [#674](https://github.com/clusterio/clusterio/pull/674)
|
||||||
|
- Fixed host user sync to instances after reconnecting to the controller. [#678](https://github.com/clusterio/clusterio/pull/678)
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
|
|||||||
@@ -864,7 +864,7 @@ export class InstanceDetailsChangedEvent {
|
|||||||
export class InstanceBanlistUpdateEvent {
|
export class InstanceBanlistUpdateEvent {
|
||||||
declare ["constructor"]: typeof InstanceBanlistUpdateEvent;
|
declare ["constructor"]: typeof InstanceBanlistUpdateEvent;
|
||||||
static type = "event" as const;
|
static type = "event" as const;
|
||||||
static src = "controller" as const;
|
static src = ["controller", "host"] as const;
|
||||||
static dst = "instance" as const;
|
static dst = "instance" as const;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -887,7 +887,7 @@ export class InstanceBanlistUpdateEvent {
|
|||||||
export class InstanceAdminlistUpdateEvent {
|
export class InstanceAdminlistUpdateEvent {
|
||||||
declare ["constructor"]: typeof InstanceAdminlistUpdateEvent;
|
declare ["constructor"]: typeof InstanceAdminlistUpdateEvent;
|
||||||
static type = "event" as const;
|
static type = "event" as const;
|
||||||
static src = "controller" as const;
|
static src = ["controller", "host"] as const;
|
||||||
static dst = "instance" as const;
|
static dst = "instance" as const;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -908,7 +908,7 @@ export class InstanceAdminlistUpdateEvent {
|
|||||||
export class InstanceWhitelistUpdateEvent {
|
export class InstanceWhitelistUpdateEvent {
|
||||||
declare ["constructor"]: typeof InstanceWhitelistUpdateEvent;
|
declare ["constructor"]: typeof InstanceWhitelistUpdateEvent;
|
||||||
static type = "event" as const;
|
static type = "event" as const;
|
||||||
static src = "controller" as const;
|
static src = ["controller", "host"] as const;
|
||||||
static dst = "instance" as const;
|
static dst = "instance" as const;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
+11
-1
@@ -4,6 +4,7 @@ const path = require("path");
|
|||||||
|
|
||||||
const lib = require("@clusterio/lib");
|
const lib = require("@clusterio/lib");
|
||||||
const Host = require("@clusterio/host/dist/node/src/Host").default;
|
const Host = require("@clusterio/host/dist/node/src/Host").default;
|
||||||
|
const Instance = require("@clusterio/host/dist/node/src/Instance").default;
|
||||||
const { _discoverInstances } = require("@clusterio/host/dist/node/src/Host");
|
const { _discoverInstances } = require("@clusterio/host/dist/node/src/Host");
|
||||||
|
|
||||||
describe("Host testing", function() {
|
describe("Host testing", function() {
|
||||||
@@ -28,7 +29,15 @@ describe("Host testing", function() {
|
|||||||
|
|
||||||
describe("class Host", function() {
|
describe("class Host", function() {
|
||||||
describe(".handleSyncUserListsEvent()", function() {
|
describe(".handleSyncUserListsEvent()", function() {
|
||||||
let mockHost;
|
const hostAddress = lib.Address.fromShorthand({ hostId: 1 });
|
||||||
|
const instanceAddress = lib.Address.fromShorthand({ instanceId: 1 });
|
||||||
|
let mockHost, hostConnector, instanceConnector;
|
||||||
|
before(function() {
|
||||||
|
[hostConnector, instanceConnector] = lib.VirtualConnector.makePair(hostAddress, instanceAddress);
|
||||||
|
instanceConnector.on("message", function(message) {
|
||||||
|
Instance.prototype._validateMessage(message);
|
||||||
|
});
|
||||||
|
});
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
mockHost = {
|
mockHost = {
|
||||||
adminlist: new Set(),
|
adminlist: new Set(),
|
||||||
@@ -37,6 +46,7 @@ describe("Host testing", function() {
|
|||||||
broadcasts: [],
|
broadcasts: [],
|
||||||
broadcastEventToInstance(event) {
|
broadcastEventToInstance(event) {
|
||||||
this.broadcasts.push(event);
|
this.broadcasts.push(event);
|
||||||
|
hostConnector.sendEvent(event, instanceAddress);
|
||||||
},
|
},
|
||||||
handleSyncUserListsEvent: Host.prototype.handleSyncUserListsEvent,
|
handleSyncUserListsEvent: Host.prototype.handleSyncUserListsEvent,
|
||||||
syncLists(adminlist, banlist, whitelist) {
|
syncLists(adminlist, banlist, whitelist) {
|
||||||
|
|||||||
Reference in new issue
Block a user