Skip to content

Commit f815007

Browse files
authored
Implement loader version API (#35)
1 parent 94abfdc commit f815007

12 files changed

+895
-0
lines changed

.sqlx/query-acd5392daf7d6e76a3f76bae9051502cc4d945731f5593b430e250019c7e8a3e.json

+140
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE geode_versions;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
CREATE TABLE geode_versions (
2+
tag TEXT PRIMARY KEY NOT NULL,
3+
mac gd_version,
4+
win gd_version,
5+
android gd_version,
6+
ios gd_version,
7+
commit_hash TEXT NOT NULL,
8+
prerelease BOOLEAN DEFAULT FALSE NOT NULL,
9+
created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL
10+
);
11+
12+
-- prefill some versions for the android updater
13+
INSERT INTO geode_versions
14+
(tag, mac, win, android, ios, created_at, commit_hash, prerelease) VALUES
15+
('4.3.1', '2.2074', '2.2074', '2.2074', NULL, '2025-03-12T22:16:41Z', '25131977310c6325566e771add660c279ddd26fd', FALSE),
16+
('4.3.0', '2.2074', '2.2074', '2.2074', NULL, '2025-03-12T17:17:29Z', '75bf0dfef335f5a0ce5b2c46700875e52e801350', FALSE),
17+
('4.2.0', '2.2074', '2.2074', '2.2074', NULL, '2025-01-18T01:40:23Z', 'f540c39d251babf6981f1a197da9accee777b1e8', FALSE),
18+
('4.1.2', '2.2074', '2.2074', '2.2074', NULL, '2024-12-29T03:37:32Z', 'd9d8a1281bae20b51e4324825f22262499f40049', FALSE),
19+
('4.1.1', '2.2074', '2.2074', '2.2074', NULL, '2024-12-20T07:36:05Z', 'e558bd3d12b9527cccccfabc2b35444a538bf5f1', FALSE),
20+
('4.1.0', '2.2074', '2.2074', '2.2074', NULL, '2024-12-12T21:23:18Z', '695f39f6ae4d10a88929b4bdc336f980db9060b6', FALSE),
21+
('4.0.1', '2.2074', '2.2074', '2.2074', NULL, '2024-11-20T21:39:54Z', 'ed97f3b0405a63f7edfa98df8d493a327e844111', FALSE),
22+
('4.0.0', '2.2074', '2.2074', '2.2074', NULL, '2024-11-19T14:40:29Z', 'cb8d7571ddcff608d3a4de8f59f1a969ec0aff39', FALSE),
23+
('4.0.0-beta.2', '2.2074', '2.2074', '2.2074', NULL, '2024-11-19T03:37:04Z', 'c0514b191583d6002dbf5c4f387471cff8fa535e', TRUE),
24+
('4.0.0-beta.1', '2.2074', '2.2074', '2.2074', NULL, '2024-11-15T20:15:17Z', '9fe3d133e93191d6225f2521b0714788293995c6', TRUE),
25+
('4.0.0-alpha.1', '2.2074', '2.2074', '2.2074', NULL, '2024-11-13T16:38:10Z', 'ebd4c920f5775287aea82fe758edec000108ff04', TRUE),
26+
('3.9.3', '2.206', '2.206', '2.206', NULL, '2024-11-22T19:05:51Z', 'e363a3e44c4a0af5b8980de4b06ed4c17e7b92ae', FALSE),
27+
('3.9.2', '2.206', '2.206', '2.206', NULL, '2024-11-14T22:01:58Z', '948e0d453dec9ea814974b17c68fde4006629611', FALSE),
28+
('3.9.1', '2.206', '2.206', '2.206', NULL, '2024-11-14T00:39:09Z', 'c4f6758ab42717816e121bcc656701fc7fd14395', FALSE),
29+
('3.9.0', '2.206', '2.206', '2.206', NULL, '2024-10-30T18:29:44Z', 'bd8387df1bc0bbba06a332c655e833121eddd9ff', FALSE),
30+
('2.0.0-beta.27', '2.200', '2.204', '2.205', NULL, '2024-05-26T14:37:03Z', '6510df7c8557668744044471ed2a0391759c3f7f', FALSE),
31+
('2.0.0-beta.4', '2.200', '2.204', '2.200', NULL, '2024-01-21T16:37:45Z', 'c2f626b93767ef3678b9df1daca14b89fec6c6f7', FALSE);
32+
33+
CREATE INDEX idx_geode_versions_created_at ON geode_versions(created_at);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE gd_version_aliases;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
CREATE TABLE gd_version_aliases (
2+
version_name gd_version PRIMARY KEY NOT NULL,
3+
mac_arm_uuid uuid UNIQUE,
4+
mac_intel_uuid uuid UNIQUE,
5+
android_manifest_id INTEGER UNIQUE,
6+
windows_timestamp INTEGER UNIQUE,
7+
ios_bundle_version TEXT UNIQUE,
8+
added_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL
9+
);
10+
11+
INSERT INTO gd_version_aliases
12+
(version_name, mac_arm_uuid, mac_intel_uuid, android_manifest_id, windows_timestamp, ios_bundle_version) VALUES
13+
-- thanks to @hiimjasmine00 for bothering with the mac uuids
14+
('2.200', null, '29549F90-F083-35A8-B917-9962262FE112', 37, 1702921605, '2.2.0'),
15+
('2.204', null, null, null, 1705041028, null),
16+
('2.205', null, null, 38, null, '2.2.0.5'),
17+
('2.206', '620B0C9B-8F75-3043-BD34-3BB9DD201C3A', 'AE6DFCCC-153A-32AB-BFD5-6F2478BC41B6', 39, 1717243515, '2.2.0.6.0'),
18+
('2.207', '48C25B63-0D7C-3F67-B831-DF935524C043', 'D497E431-5C3F-3EB4-9DF7-115B861578EE', null, 1731098609, null),
19+
('2.2071', '4933391F-D6C1-3188-99E8-23D64C674B64', '08E24832-EC11-3637-910E-7CB6C0EF8EC0', null, 1731117052, null),
20+
('2.2072', '9C1D62A7-7C2F-3514-AEFB-D1AB7BBD48FF', 'E53731FD-D1B6-33D2-BFA4-3B5D8D55279F', null, 1731130219, null),
21+
('2.2073', '0B1FCFE4-79E8-3246-8ECB-500FDBDCFD9A', '1F4AFF98-DB51-382D-9BB2-59C911B88EB2', null, 1731156923, null),
22+
('2.2074', '27044C8B-76BD-303C-A035-5314AF1D9E6E', 'DB5CADC0-E533-3123-8A63-5A434FE391ED', 40, 1731376950, '2.2.0.7.0');
23+
24+
CREATE INDEX idx_gd_version_aliases_added_at ON gd_version_aliases(added_at);

openapi.yml

+167
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ tags:
1414
- name: user
1515
description: User management
1616

17+
- name: loader
18+
description: Loader information
19+
1720
paths:
1821
/:
1922
get:
@@ -680,6 +683,153 @@ paths:
680683
"500":
681684
$ref: "#/components/responses/InternalServerError"
682685

686+
/v1/loader/versions:
687+
get:
688+
tags:
689+
- loader
690+
summary: Get all loader versions, paginated
691+
description: Returns a paginated list of all loader versions. This list is sorted by when the version was added, not by their version number.
692+
693+
parameters:
694+
- name: gd
695+
in: query
696+
description: Geometry Dash version
697+
required: false
698+
schema:
699+
$ref: "#/components/schemas/GDVersionString"
700+
- name: platform
701+
in: query
702+
description: Platform to filter version by [win, android, mac, ios]
703+
required: false
704+
schema:
705+
$ref: "#/components/schemas/Platform"
706+
- name: prerelease
707+
in: query
708+
description: If prerelease builds should be included in results
709+
required: false
710+
schema:
711+
type: boolean
712+
- $ref: "#/components/parameters/Page"
713+
- $ref: "#/components/parameters/PerPage"
714+
715+
responses:
716+
"200":
717+
description: OK
718+
content:
719+
application/json:
720+
schema:
721+
type: array
722+
items:
723+
$ref: "#/components/schemas/LoaderVersion"
724+
"400":
725+
$ref: "#/components/responses/BadRequest"
726+
"500":
727+
$ref: "#/components/responses/InternalServerError"
728+
post:
729+
tags:
730+
- loader
731+
summary: Create a new loader version (admin only)
732+
security:
733+
- bearerAuth: []
734+
735+
requestBody:
736+
content:
737+
application/json:
738+
schema:
739+
type: object
740+
properties:
741+
tag:
742+
required: true
743+
type: string
744+
description: "Git tag that references the release"
745+
commit_hash:
746+
required: true
747+
type: string
748+
prerelease:
749+
required: false
750+
type: boolean
751+
gd:
752+
$ref: "#/components/schemas/GDVersionObject"
753+
754+
responses:
755+
"204":
756+
description: No Content (Version created)
757+
"400":
758+
$ref: "#/components/responses/BadRequest"
759+
"401":
760+
$ref: "#/components/responses/Unauthorized"
761+
"500":
762+
$ref: "#/components/responses/InternalServerError"
763+
764+
/v1/loader/versions/latest:
765+
get:
766+
tags:
767+
- loader
768+
summary: Gets the latest loader version
769+
description: Returns the latest loader version, filtered based on the given parameters
770+
771+
parameters:
772+
- name: gd
773+
in: query
774+
description: Geometry Dash version
775+
required: false
776+
schema:
777+
$ref: "#/components/schemas/GDVersionString"
778+
- name: platform
779+
in: query
780+
description: Platform to filter version by [win, android, mac, ios]
781+
required: false
782+
schema:
783+
$ref: "#/components/schemas/Platform"
784+
- name: prerelease
785+
in: query
786+
description: If prerelease builds should be accepted
787+
required: false
788+
schema:
789+
type: boolean
790+
791+
responses:
792+
"200":
793+
description: OK
794+
content:
795+
application/json:
796+
schema:
797+
$ref: "#/components/schemas/LoaderVersion"
798+
"404":
799+
$ref: "#/components/responses/NotFoundError"
800+
"400":
801+
$ref: "#/components/responses/BadRequest"
802+
"500":
803+
$ref: "#/components/responses/InternalServerError"
804+
805+
/v1/loader/versions/{version}:
806+
get:
807+
tags:
808+
- loader
809+
summary: Gets a loader version
810+
811+
parameters:
812+
- name: version
813+
description: Geode Version
814+
in: path
815+
required: true
816+
schema:
817+
$ref: "#/components/schemas/ModVersionString"
818+
819+
responses:
820+
"200":
821+
description: OK
822+
content:
823+
application/json:
824+
schema:
825+
$ref: "#/components/schemas/LoaderVersion"
826+
"404":
827+
$ref: "#/components/responses/NotFoundError"
828+
"400":
829+
$ref: "#/components/responses/BadRequest"
830+
"500":
831+
$ref: "#/components/responses/InternalServerError"
832+
683833
components:
684834
securitySchemes:
685835
bearerAuth:
@@ -1017,6 +1167,23 @@ components:
10171167
nullable: true
10181168
description: Information given with the version's status (typically a reason)
10191169

1170+
LoaderVersion:
1171+
type: object
1172+
properties:
1173+
tag:
1174+
type: string
1175+
commit_hash:
1176+
type: string
1177+
version:
1178+
$ref: "#/components/schemas/ModVersionString"
1179+
prerelease:
1180+
type: boolean
1181+
gd:
1182+
$ref: "#/components/schemas/GDVersionObject"
1183+
created_at:
1184+
type: string
1185+
format: date-time
1186+
10201187
Platform:
10211188
type: string
10221189
enum:

0 commit comments

Comments
 (0)