Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions hasura/metadata/actions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,13 @@ type Mutation {
): SuccessOutput
}

type Mutation {
setGamePluginAutoUpdate(
slug: String!
enabled: Boolean!
): SuccessOutput
}

type Mutation {
reconcileNodePlugins(
nodeId: String!
Expand Down
8 changes: 8 additions & 0 deletions hasura/metadata/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,14 @@ actions:
permissions:
- role: administrator
comment: Remove a game plugin from a node's plugin store
- name: setGamePluginAutoUpdate
definition:
kind: synchronous
handler: '{{HASURA_GRAPHQL_ACTIONS_HOOK}}'
forward_client_headers: true
permissions:
- role: administrator
comment: Track new releases of a game plugin, or pin it where it is
- name: reconcileNodePlugins
definition:
kind: synchronous
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ select_permissions:
- runtime
- version
- detected_version
- previous_version
- channel
- status
- source
Expand All @@ -46,6 +47,7 @@ insert_permissions:
- runtime
- version
- detected_version
- previous_version
- channel
- status
- source
Expand All @@ -62,6 +64,7 @@ update_permissions:
- runtime
- version
- detected_version
- previous_version
- channel
- status
- source
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "public"."game_server_node_plugins"
DROP COLUMN IF EXISTS "previous_version";
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- An Auto channel install changes version with nobody asking it to, and the row
-- only ever held where it landed. Without the version it came from there is no
-- record that anything moved -- the API overwrites `version` the moment a node
-- reports Installing, so the old value is gone before the install finishes.
ALTER TABLE "public"."game_server_node_plugins"
ADD COLUMN IF NOT EXISTS "previous_version" text;
19 changes: 18 additions & 1 deletion src/game-plugins/game-plugins.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ export class GamePluginsController {
@Body()
body: {
slug: string;
status: "Installing" | "Failed" | "Removing";
status: "Installing" | "Installed" | "Failed" | "Removing";
version?: string | null;
previousVersion?: string | null;
error?: string | null;
},
) {
Expand Down Expand Up @@ -109,6 +110,22 @@ export class GamePluginsController {
return { success: true };
}

// Auto is what installing gives you, so the toggle is the only way back to a
// pinned version -- and the only way to say "yes, I meant it" about a plugin
// that changes underneath the fleet on its own.
@HasuraAction()
public async setGamePluginAutoUpdate(data: {
user: User;
slug: string;
enabled: boolean;
}) {
this.assertAdministrator(data.user);

await this.gamePlugins.setAutoUpdate(data.slug, data.enabled);

return { success: true };
}

@HasuraAction()
public async uninstallGamePlugin(data: {
user: User;
Expand Down
2 changes: 2 additions & 0 deletions src/game-plugins/game-plugins.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ import { GameModesService } from "./game-modes.service";
import { GamePluginsController } from "./game-plugins.controller";
import { SyncGamePluginRegistry } from "./jobs/SyncGamePluginRegistry";
import { CheckGamePluginUpdates } from "./jobs/CheckGamePluginUpdates";
import { NotifyGamePluginUpdate } from "./jobs/NotifyGamePluginUpdate";

@Module({
providers: [
GamePluginsService,
GameModesService,
SyncGamePluginRegistry,
CheckGamePluginUpdates,
NotifyGamePluginUpdate,
...getQueuesProcessors("GamePlugins"),
loggerFactory(),
Logger,
Expand Down
Loading
Loading