From 13f85e68190722d2289ae7517768788b1ce4e67f Mon Sep 17 00:00:00 2001
From: mircearoata
Date: Wed, 19 Jun 2024 22:38:18 +0200
Subject: [PATCH 1/9] feat: remove SML-related pages
---
.../sml-versions/delete_sml_version.graphql | 3 -
.../sml-versions/new_sml_version.graphql | 5 -
.../sml-versions/sml_version_admin.graphql | 18 --
.../sml-versions/sml_versions_admin.graphql | 21 --
.../sml-versions/update_sml_version.graphql | 5 -
src/gql/auth/get_me.graphql | 3 +-
src/gql/sml/sml_versions.graphql | 18 --
src/lib/components/general/Sidebar.svelte | 9 +-
src/lib/components/general/TopBar.svelte | 4 +-
.../sml-versions/SMLVersionForm.svelte | 196 ------------------
.../versions/VersionDependenciesGrid.svelte | 2 +-
src/lib/core/graphql.ts | 6 -
src/lib/models/sml-versions.ts | 49 -----
src/lib/models/versions.ts | 13 +-
src/routes/admin/+page.svelte | 4 -
src/routes/admin/sml-versions/+page.svelte | 117 -----------
.../[smlVersionId]/edit/+page.svelte | 76 -------
.../sml-versions/[smlVersionId]/edit/+page.ts | 5 -
.../admin/sml-versions/new/+page.svelte | 51 -----
src/routes/sml-versions/+page.svelte | 121 -----------
20 files changed, 11 insertions(+), 715 deletions(-)
delete mode 100644 src/gql/admin/sml-versions/delete_sml_version.graphql
delete mode 100644 src/gql/admin/sml-versions/new_sml_version.graphql
delete mode 100644 src/gql/admin/sml-versions/sml_version_admin.graphql
delete mode 100644 src/gql/admin/sml-versions/sml_versions_admin.graphql
delete mode 100644 src/gql/admin/sml-versions/update_sml_version.graphql
delete mode 100644 src/gql/sml/sml_versions.graphql
delete mode 100644 src/lib/components/sml-versions/SMLVersionForm.svelte
delete mode 100644 src/lib/models/sml-versions.ts
delete mode 100644 src/routes/admin/sml-versions/+page.svelte
delete mode 100644 src/routes/admin/sml-versions/[smlVersionId]/edit/+page.svelte
delete mode 100644 src/routes/admin/sml-versions/[smlVersionId]/edit/+page.ts
delete mode 100644 src/routes/admin/sml-versions/new/+page.svelte
delete mode 100644 src/routes/sml-versions/+page.svelte
diff --git a/src/gql/admin/sml-versions/delete_sml_version.graphql b/src/gql/admin/sml-versions/delete_sml_version.graphql
deleted file mode 100644
index 6e8a8877f..000000000
--- a/src/gql/admin/sml-versions/delete_sml_version.graphql
+++ /dev/null
@@ -1,3 +0,0 @@
-mutation DeleteSMLVersion($smlVersionID: SMLVersionID!) {
- deleteSMLVersion(smlVersionId: $smlVersionID)
-}
diff --git a/src/gql/admin/sml-versions/new_sml_version.graphql b/src/gql/admin/sml-versions/new_sml_version.graphql
deleted file mode 100644
index 502680c07..000000000
--- a/src/gql/admin/sml-versions/new_sml_version.graphql
+++ /dev/null
@@ -1,5 +0,0 @@
-mutation NewSMLVersion($smlVersion: NewSMLVersion!) {
- createSMLVersion(smlVersion: $smlVersion) {
- id
- }
-}
diff --git a/src/gql/admin/sml-versions/sml_version_admin.graphql b/src/gql/admin/sml-versions/sml_version_admin.graphql
deleted file mode 100644
index 07b56cadb..000000000
--- a/src/gql/admin/sml-versions/sml_version_admin.graphql
+++ /dev/null
@@ -1,18 +0,0 @@
-query GetSMLVersionAdmin($smlVersionID: SMLVersionID!) {
- getSMLVersion(smlVersionID: $smlVersionID) {
- id
- version
- stability
- link
- targets {
- targetName
- link
- }
- changelog
- created_at
- date
- satisfactory_version
- bootstrap_version
- engine_version
- }
-}
diff --git a/src/gql/admin/sml-versions/sml_versions_admin.graphql b/src/gql/admin/sml-versions/sml_versions_admin.graphql
deleted file mode 100644
index bce883420..000000000
--- a/src/gql/admin/sml-versions/sml_versions_admin.graphql
+++ /dev/null
@@ -1,21 +0,0 @@
-query GetSMLVersionsAdmin($filter: SMLVersionFilter) {
- getSMLVersions(filter: $filter) {
- sml_versions {
- id
- version
- stability
- link
- targets {
- targetName
- link
- }
- changelog
- created_at
- date
- satisfactory_version
- bootstrap_version
- engine_version
- }
- count
- }
-}
diff --git a/src/gql/admin/sml-versions/update_sml_version.graphql b/src/gql/admin/sml-versions/update_sml_version.graphql
deleted file mode 100644
index f996d777f..000000000
--- a/src/gql/admin/sml-versions/update_sml_version.graphql
+++ /dev/null
@@ -1,5 +0,0 @@
-mutation UpdateSMLVersion($smlVersionID: SMLVersionID!, $smlVersion: UpdateSMLVersion!) {
- updateSMLVersion(smlVersionId: $smlVersionID, smlVersion: $smlVersion) {
- id
- }
-}
diff --git a/src/gql/auth/get_me.graphql b/src/gql/auth/get_me.graphql
index 3f2fc08da..004372bdd 100644
--- a/src/gql/auth/get_me.graphql
+++ b/src/gql/auth/get_me.graphql
@@ -14,8 +14,7 @@ query GetMe {
deleteContent
editContent
editUsers
- editSMLVersions
- editBootstrapVersions
+ editSatisfactoryVersions
editAnyModCompatibility
}
}
diff --git a/src/gql/sml/sml_versions.graphql b/src/gql/sml/sml_versions.graphql
deleted file mode 100644
index 649e696c8..000000000
--- a/src/gql/sml/sml_versions.graphql
+++ /dev/null
@@ -1,18 +0,0 @@
-query GetSMLVersions($limit: Int!, $offset: Int!) {
- getSMLVersions(filter: { limit: $limit, offset: $offset }) {
- count
- sml_versions {
- id
- version
- stability
- changelog
- link
- targets {
- targetName
- link
- }
- date
- satisfactory_version
- }
- }
-}
diff --git a/src/lib/components/general/Sidebar.svelte b/src/lib/components/general/Sidebar.svelte
index 0917400b0..757c9d934 100644
--- a/src/lib/components/general/Sidebar.svelte
+++ b/src/lib/components/general/Sidebar.svelte
@@ -12,7 +12,9 @@
export const { t } = getTranslate();
- $: isAdmin = !$user ? false : $user.roles.approveMods || $user.roles.approveVersions || $user.roles.editSMLVersions;
+ $: isAdmin = !$user
+ ? false
+ : $user.roles.approveMods || $user.roles.approveVersions || $user.roles.editSatisfactoryVersions;
let top: SidebarItemData[];
$: top = [
@@ -31,11 +33,6 @@
icon: 'description',
label: $t('sidebar.guides')
},
- {
- url: base + '/sml-versions',
- icon: 'lightbulb',
- label: $t('sidebar.sml-versions')
- },
{
url: base + '/tools',
icon: 'apps',
diff --git a/src/lib/components/general/TopBar.svelte b/src/lib/components/general/TopBar.svelte
index 66e221529..78acfbe09 100644
--- a/src/lib/components/general/TopBar.svelte
+++ b/src/lib/components/general/TopBar.svelte
@@ -8,7 +8,9 @@
import { AppBar, type PopupSettings, popup, getDrawerStore, getModalStore } from '@skeletonlabs/skeleton';
import LoginModal from '$lib/modals/LoginModal.svelte';
- $: isAdmin = !$user ? false : $user.roles.approveMods || $user.roles.approveVersions || $user.roles.editSMLVersions;
+ $: isAdmin = !$user
+ ? false
+ : $user.roles.approveMods || $user.roles.approveVersions || $user.roles.editSatisfactoryVersions;
export const { t } = getTranslate();
diff --git a/src/lib/components/sml-versions/SMLVersionForm.svelte b/src/lib/components/sml-versions/SMLVersionForm.svelte
deleted file mode 100644
index 4b98a2e26..000000000
--- a/src/lib/components/sml-versions/SMLVersionForm.svelte
+++ /dev/null
@@ -1,196 +0,0 @@
-
-
-
-
-
diff --git a/src/lib/components/versions/VersionDependenciesGrid.svelte b/src/lib/components/versions/VersionDependenciesGrid.svelte
index 9426de245..0c3216e95 100644
--- a/src/lib/components/versions/VersionDependenciesGrid.svelte
+++ b/src/lib/components/versions/VersionDependenciesGrid.svelte
@@ -23,7 +23,7 @@
|
{dependency.mod_id}
|
{dependency.condition} |
diff --git a/src/lib/core/graphql.ts b/src/lib/core/graphql.ts
index 1700dc296..5f9220b99 100644
--- a/src/lib/core/graphql.ts
+++ b/src/lib/core/graphql.ts
@@ -65,12 +65,6 @@ export const initializeGraphQLClient = (fetch?: LoadEvent['fetch']): Client =>
id: args.versionId as string
});
},
- deleteSMLVersion(_result, args, cache) {
- cache.invalidate({
- __typename: 'SMLVersion',
- id: args.smlVersionId as string
- });
- },
deleteVersion(_result, args, cache) {
cache.invalidate({
__typename: 'Version',
diff --git a/src/lib/models/sml-versions.ts b/src/lib/models/sml-versions.ts
deleted file mode 100644
index 0fd3acf02..000000000
--- a/src/lib/models/sml-versions.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import * as zod from 'zod';
-import type { TargetName, UpdateSmlVersionTarget, VersionStabilities } from '$lib/generated';
-
-export type SMLTargetData = {
- targetName: TargetName;
- link: string;
-};
-
-export type SMLVersionData = {
- version: string;
- satisfactory_version: number;
- bootstrap_version?: string;
- stability: VersionStabilities;
- link: string;
- changelog: string;
- date: string;
- targets: UpdateSmlVersionTarget[];
- engine_version: string;
-};
-
-const versionRegex =
- /^(<=|<|>|>=|\^)?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
-
-export const smlTargetSchema = zod.object({
- targetName: zod.string(),
- link: zod.string().url()
-});
-
-export const smlVersionSchema = zod.object({
- version: zod.string().regex(versionRegex),
- satisfactory_version: zod.number(),
- bootstrap_version: zod.string().regex(versionRegex).optional(),
- stability: zod.string(),
- link: zod.string().url(),
- targets: zod.array(smlTargetSchema).superRefine((targets, ctx) => {
- for (let i = 0; i < targets.length; i += 1) {
- if (targets.findIndex((t) => t.targetName == targets[i].targetName) !== i) {
- ctx.addIssue({
- code: zod.ZodIssueCode.custom,
- message: 'Targets must be unique',
- path: [i, 'targetName']
- });
- }
- }
- }),
- changelog: zod.string(),
- date: zod.string(),
- engine_version: zod.string()
-});
diff --git a/src/lib/models/versions.ts b/src/lib/models/versions.ts
index e72968a07..5d5233ab4 100644
--- a/src/lib/models/versions.ts
+++ b/src/lib/models/versions.ts
@@ -17,6 +17,7 @@ export type VersionMetadata = {
uplugin: {
Version: string;
SemVersion?: string;
+ GameVersion?: string;
Plugins?: {
Name: string;
SemVersion?: string;
@@ -45,17 +46,9 @@ const readUPluginJson = async (
const parsed = JSON.parse(uPluginJson) as VersionMetadata['uplugin'];
- let foundSML = false;
- for (const dependency of parsed.Plugins) {
- if (dependency.Name === 'SML') {
- foundSML = true;
- break;
- }
- }
-
- if (!foundSML) {
+ if (!parsed.GameVersion) {
return {
- message: 'mod must depend on SML'
+ message: `missing GameVersion in ${modReference}.uplugin`
};
}
diff --git a/src/routes/admin/+page.svelte b/src/routes/admin/+page.svelte
index 04689e72d..b57bf641f 100644
--- a/src/routes/admin/+page.svelte
+++ b/src/routes/admin/+page.svelte
@@ -19,10 +19,6 @@
Unapproved Versions
-
- SML Versions
-
-
Tag Manager
diff --git a/src/routes/admin/sml-versions/+page.svelte b/src/routes/admin/sml-versions/+page.svelte
deleted file mode 100644
index 34779b051..000000000
--- a/src/routes/admin/sml-versions/+page.svelte
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
New SML Version
-
- {#if totalVersions}
-
-
(page = p.detail)}
- on:amount={(p) => (perPage = p.detail)}
- controlVariant="variant-filled-surface" />
-
- {/if}
-
-
-
- {#if $versions.fetching}
-
- {:else if $versions.error}
-
Oh no... {$versions.error.message}
- {:else}
-
-
-
- | Version |
- Stability |
- Satisfactory Version |
- Bootstrap Version |
- Release Date |
- |
-
-
-
- {#each $versions.data.getSMLVersions.sml_versions as version}
-
- | {version.version} |
- {version.stability} |
- {version.satisfactory_version} |
- {version.bootstrap_version} |
- {prettyDate(version.created_at)} |
-
-
-
- Edit
-
- |
-
- {/each}
-
-
- {/if}
-
-
-{#if totalVersions}
-
-
-
(page = p.detail)}
- on:amount={(p) => (perPage = p.detail)}
- controlVariant="variant-filled-surface" />
-
-
-{/if}
diff --git a/src/routes/admin/sml-versions/[smlVersionId]/edit/+page.svelte b/src/routes/admin/sml-versions/[smlVersionId]/edit/+page.svelte
deleted file mode 100644
index 08e520b5e..000000000
--- a/src/routes/admin/sml-versions/[smlVersionId]/edit/+page.svelte
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-Edit SMLVersion
-
-
-
- {#if $smlVersion.fetching}
- Loading...
- {:else if $smlVersion.error}
- Oh no... {$smlVersion.error.message}
- {:else}
-
- {/if}
-
-
diff --git a/src/routes/admin/sml-versions/[smlVersionId]/edit/+page.ts b/src/routes/admin/sml-versions/[smlVersionId]/edit/+page.ts
deleted file mode 100644
index 9a95a14e6..000000000
--- a/src/routes/admin/sml-versions/[smlVersionId]/edit/+page.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type { PageLoad } from './$types';
-
-export const load: PageLoad = async ({ params }) => ({
- ...params
-});
diff --git a/src/routes/admin/sml-versions/new/+page.svelte b/src/routes/admin/sml-versions/new/+page.svelte
deleted file mode 100644
index b398112eb..000000000
--- a/src/routes/admin/sml-versions/new/+page.svelte
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-New SML Version
-
-
-
-
diff --git a/src/routes/sml-versions/+page.svelte b/src/routes/sml-versions/+page.svelte
deleted file mode 100644
index e9a8eea2b..000000000
--- a/src/routes/sml-versions/+page.svelte
+++ /dev/null
@@ -1,121 +0,0 @@
-
-
-
- SML Versions - SMR
-
-
-
-{#if totalVersions}
-
-
-
(page = p.detail)}
- on:amount={(p) => (perPage = p.detail)}
- controlVariant="variant-filled-surface" />
-
-
-{/if}
-
-
- {#if $versions.fetching}
-
- {:else if $versions.error}
-
Oh no... {$versions.error.message}
- {:else}
-
-
-
- | Version |
- Stability |
- Game Version |
- Release Date |
- |
-
-
-
- {#each $versions.data.getSMLVersions.sml_versions as version}
- toggleRow(version.id)}>
- | {version.version} |
- {version.stability} |
- {version.satisfactory_version} |
- {prettyDate(version.date)} |
-
-
- |
-
-
- {#if expandedVersions.has(version.id)}
-
- |
- {#await markdown(version.changelog) then changelogRendered}
-
- {@html changelogRendered}
- {/await}
- |
-
- {/if}
- {/each}
-
-
- {/if}
-
-
-{#if totalVersions}
-
-
-
(page = p.detail)}
- on:amount={(p) => (perPage = p.detail)}
- controlVariant="variant-filled-surface" />
-
-
-{/if}
From 4651b3b6b27b10778a99bd33a9002bdf56a931d1 Mon Sep 17 00:00:00 2001
From: mircearoata
Date: Fri, 21 Jun 2024 15:48:48 +0200
Subject: [PATCH 2/9] feat: add satisfactory versions admin page
---
.../create_satisfactory_version.graphql | 7 +
.../delete_satisfactory_version.graphql | 3 +
.../satisfactory_versions.graphql | 7 +
.../update_satisfactory_version.graphql | 7 +
src/routes/admin/+page.svelte | 4 +
.../admin/satisfactory-versions/+page.svelte | 196 ++++++++++++++++++
6 files changed, 224 insertions(+)
create mode 100644 src/gql/satisfactoryVersions/create_satisfactory_version.graphql
create mode 100644 src/gql/satisfactoryVersions/delete_satisfactory_version.graphql
create mode 100644 src/gql/satisfactoryVersions/satisfactory_versions.graphql
create mode 100644 src/gql/satisfactoryVersions/update_satisfactory_version.graphql
create mode 100644 src/routes/admin/satisfactory-versions/+page.svelte
diff --git a/src/gql/satisfactoryVersions/create_satisfactory_version.graphql b/src/gql/satisfactoryVersions/create_satisfactory_version.graphql
new file mode 100644
index 000000000..4f0aa82c4
--- /dev/null
+++ b/src/gql/satisfactoryVersions/create_satisfactory_version.graphql
@@ -0,0 +1,7 @@
+mutation CreateSatisfactoryVersion($satisfactoryVersion: NewSatisfactoryVersion!) {
+ createSatisfactoryVersion(input: $satisfactoryVersion) {
+ id
+ version
+ engine_version
+ }
+}
diff --git a/src/gql/satisfactoryVersions/delete_satisfactory_version.graphql b/src/gql/satisfactoryVersions/delete_satisfactory_version.graphql
new file mode 100644
index 000000000..c38b31c83
--- /dev/null
+++ b/src/gql/satisfactoryVersions/delete_satisfactory_version.graphql
@@ -0,0 +1,3 @@
+mutation DeleteSatisfactoryVersion($satisfactoryVersionID: SatisfactoryVersionID!) {
+ deleteSatisfactoryVersion(id: $satisfactoryVersionID)
+}
diff --git a/src/gql/satisfactoryVersions/satisfactory_versions.graphql b/src/gql/satisfactoryVersions/satisfactory_versions.graphql
new file mode 100644
index 000000000..567140299
--- /dev/null
+++ b/src/gql/satisfactoryVersions/satisfactory_versions.graphql
@@ -0,0 +1,7 @@
+query GetSatisfactoryVersions {
+ getSatisfactoryVersions {
+ id
+ version
+ engine_version
+ }
+}
diff --git a/src/gql/satisfactoryVersions/update_satisfactory_version.graphql b/src/gql/satisfactoryVersions/update_satisfactory_version.graphql
new file mode 100644
index 000000000..1a011dbf4
--- /dev/null
+++ b/src/gql/satisfactoryVersions/update_satisfactory_version.graphql
@@ -0,0 +1,7 @@
+mutation UpdateSatisfactoryVersion($id: SatisfactoryVersionID!, $satisfactoryVersion: UpdateSatisfactoryVersion!) {
+ updateSatisfactoryVersion(id: $id, input: $satisfactoryVersion) {
+ id
+ version
+ engine_version
+ }
+}
diff --git a/src/routes/admin/+page.svelte b/src/routes/admin/+page.svelte
index b57bf641f..cf36f9cc1 100644
--- a/src/routes/admin/+page.svelte
+++ b/src/routes/admin/+page.svelte
@@ -19,6 +19,10 @@
Unapproved Versions
+
+ Satisfactory Versions
+
+
Tag Manager
diff --git a/src/routes/admin/satisfactory-versions/+page.svelte b/src/routes/admin/satisfactory-versions/+page.svelte
new file mode 100644
index 000000000..579c139de
--- /dev/null
+++ b/src/routes/admin/satisfactory-versions/+page.svelte
@@ -0,0 +1,196 @@
+
+
+
+ {#if $satisfactoryVersionsQuery.fetching}
+
Loading satisfactory versions...
+ {:else if $satisfactoryVersionsQuery.error}
+
Failed to load satisfactory versions: {$satisfactoryVersionsQuery.error.message}
+ {:else}
+
+ {#each satisfactoryVersions as satisfactoryVersion}
+
+ {satisfactoryVersion.version}
+
+
+ satisfactoryVersionChange(satisfactoryVersion)} />
+
+ satisfactoryVersionChange(satisfactoryVersion)} />
+
+
+
+
+
+ {/each}
+
+
+
+
+
+ {/if}
+
From 1e3497730aa6d6c299944bdd4104903428de5d20 Mon Sep 17 00:00:00 2001
From: mircearoata
Date: Fri, 21 Jun 2024 20:47:06 +0200
Subject: [PATCH 3/9] feat: display game version in new version form
---
src/lib/components/versions/VersionForm.svelte | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lib/components/versions/VersionForm.svelte b/src/lib/components/versions/VersionForm.svelte
index 6e062ba65..1f663b91f 100644
--- a/src/lib/components/versions/VersionForm.svelte
+++ b/src/lib/components/versions/VersionForm.svelte
@@ -86,6 +86,8 @@
{$modMeta.uplugin.Version}.0.0
{/if}
+
+ Game version: {$modMeta.uplugin.GameVersion}
Targets: {$modMeta.targets.join(', ')}
From 773440bff8b07c3c79c8ff2aa1478eb796fe6a34 Mon Sep 17 00:00:00 2001
From: mircearoata
Date: Fri, 21 Jun 2024 20:48:03 +0200
Subject: [PATCH 4/9] feat: hide base plugins from dependencies in new version
form
---
src/lib/components/versions/VersionForm.svelte | 3 ++-
src/lib/models/versions.ts | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/lib/components/versions/VersionForm.svelte b/src/lib/components/versions/VersionForm.svelte
index 1f663b91f..abdf2f622 100644
--- a/src/lib/components/versions/VersionForm.svelte
+++ b/src/lib/components/versions/VersionForm.svelte
@@ -39,6 +39,7 @@
});
$: preview = ($data.changelog as string) || '';
+ $: dependencies = $modMeta?.uplugin?.Plugins?.filter((d) => !d.BasePlugin) || [];