Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
b2ad448
chore: upgrade to JDK 25
sylv256 Sep 27, 2025
6953663
feat: use 5 lowercase letter natural ID
sylv256 Sep 27, 2025
685ae8a
refactor: distinguish V1 methods from V2 & deduplicate code
sylv256 Sep 29, 2025
d626ac7
refactor: v2 auth & v2 java-isms
sylv256 Sep 29, 2025
b4c1eac
feat: endpoint and datafixer
sylv256 Sep 30, 2025
9a0a752
cleanup: use Collections.addAll instead of FIXES.add every damn time
sylv256 Sep 30, 2025
5748bcc
build: build in java major version twenty-five
sylv256 Sep 30, 2025
7c018e1
feat(db): implement passwords table & use foreign keys
sylv256 Sep 30, 2025
31a46d3
feat: API keys
sylv256 Sep 30, 2025
2c4c3f7
fix: NIDs allowed only when they existed
sylv256 Sep 30, 2025
2b9e929
feat: disallow reserved user IDs
sylv256 Sep 30, 2025
0396e01
fix: check start and end for NID validation
sylv256 Sep 30, 2025
ae3acd3
refactor: reformat database to fit the v2 spec
sylv256 Oct 1, 2025
a86f5cf
refactor: move away from a constant schema value
sylv256 Oct 1, 2025
8d1d1b6
refactor: finish project data fixer
sylv256 Oct 1, 2025
7cb5243
fix: set defaults for project_roles table
sylv256 Oct 1, 2025
1091095
fix: ensure droppers are executed after each fixer
sylv256 Oct 1, 2025
8c7982b
refactor: datafix user IDs & fix db modification order to prevent for…
sylv256 Oct 2, 2025
c0e5a97
refactor: use addBatch instead of execute
sylv256 Oct 2, 2025
4c9c243
Merge remote-tracking branch 'origin/master' into v2
sylv256 Oct 2, 2025
73893cc
feat: fix and add reserved accounts
sylv256 Oct 2, 2025
1ca6b8d
fix: properly generate NIDs from any number and length
sylv256 Oct 2, 2025
ff0621f
feat: new global permissions
sylv256 Oct 2, 2025
4e1d887
feat: new global permissions
sylv256 Oct 2, 2025
d2e0a36
chore(gitignore): thanks linux (.directory)
sylv256 Oct 4, 2025
dbbf8d4
refactor: events and submissions
sylv256 Oct 5, 2025
b0a3399
refactor: update role and permissions columns in team_invites
sylv256 Oct 5, 2025
429c25b
refactor: update role and permissions columns in team_invites
sylv256 Oct 6, 2025
14ec0e0
feat: API key authentication
sylv256 Oct 7, 2025
0a464bb
feat: `project_id` query for `ListKeysEndpoint`
sylv256 Oct 7, 2025
e946d6a
docs: fix erroneous apiKeys -> keys
sylv256 Oct 7, 2025
1fddf2c
chore: bump version `2.0.0-beta.1`
sylv256 Oct 7, 2025
7c9f319
docs: test your code disclaimer in AuthorizedEndpoint#validateAuth
sylv256 Oct 7, 2025
bacdbb2
refactor(auth): DRY the 403 and 401 messages
sylv256 Oct 7, 2025
43e08de
typo: misleading phrasing in project permissions 404
sylv256 Oct 8, 2025
e7fc179
chore: optimize imports
sylv256 Oct 8, 2025
562cc8c
chore: remove unused stuff
sylv256 Oct 8, 2025
62169f2
fix: set status unauthorized when user permissions are not present
sylv256 Oct 8, 2025
b45a28b
style(auth): reduce confusion between scope, user, project, and reque…
sylv256 Oct 8, 2025
bb823cd
fix(auth): correctly restrict scope permissions to API key permissions
sylv256 Oct 8, 2025
dd2408e
perf: rewrite `generateFromNumber` from recursive to iterative
sylv256 Oct 9, 2025
cd75140
docs(auth): document security incident 2025-10-08
sylv256 Oct 10, 2025
8c07d93
feat: Manage CDN Permission
sylv256 Oct 11, 2025
1cc2afe
feat: Update project and submission structure based on #12.
MerchantCalico Nov 19, 2025
9bd46aa
feat: Update Event class structure.
MerchantCalico Nov 19, 2025
dd8bda9
fix: Idea ext run configurations.
MerchantCalico Nov 19, 2025
fbe2685
docs(build): Add notes for build script visual errors.
MerchantCalico Nov 19, 2025
eca3ffe
chore: Update dependencies and remove unused dependencies.
MerchantCalico Nov 19, 2025
90e6536
docs(build): Update error comment to specify that it's only visual.
MerchantCalico Nov 19, 2025
5fe2054
refactor: Set Event time related fields as longs instead of ISO time.
MerchantCalico Nov 19, 2025
8762b3b
refactor: Make Submission time submitted field a long instead of ISO …
MerchantCalico Nov 19, 2025
118cef0
refactor: Represent permissions values as a long.
MerchantCalico Nov 19, 2025
6005be4
fix: Account for a DFU ordering bug.
MerchantCalico Nov 19, 2025
bf8849e
fix: Values for maps with less than 4 entries no longer resolve incor…
MerchantCalico Nov 19, 2025
fdde12c
feat: Refactors relating to projects and submissions, implement endpo…
MerchantCalico Nov 19, 2025
6067caa
docs: Refactor Javadoc for OrderCorrectedRecordCodec to use markdown.
MerchantCalico Nov 19, 2025
70b89d9
feat: Add submission getting endpoints.
MerchantCalico Nov 20, 2025
9a2ea3c
fix: V5ToV6 now applies foreign keys to the new tables.
MerchantCalico Nov 20, 2025
676d6e8
refactor: Randomize IDs within V5ToV6 instead of making them consistent.
MerchantCalico Nov 21, 2025
6069fe0
fix: Fix window in which an exception could happen when looking up so…
MerchantCalico Nov 21, 2025
51fe3ae
tweak: Use fabric.mod.json's contact field with the external source U…
MerchantCalico Nov 21, 2025
0fa363c
feat: Add @EndpointPath annotation to GetProjectEndpoint and GetSubmi…
MerchantCalico Nov 21, 2025
ceba12d
refactor: Hardcode 'type' field as it only has one option for now.
MerchantCalico Nov 21, 2025
481f4ce
feat: Add delete project endpoint.
MerchantCalico Nov 21, 2025
6164331
feat: Add edit event permission.
MerchantCalico Nov 21, 2025
524de43
refactor: Refactor permission check in DeleteProjectEndpoint to retur…
MerchantCalico Nov 21, 2025
617b85f
feat: Add delete submission endpoint.
MerchantCalico Nov 21, 2025
7ec83bb
feat: Add has_permissions function and refactor database function reg…
MerchantCalico Nov 21, 2025
898f2a6
refactor: Modify path for delete endpoints for project and submissions.
MerchantCalico Nov 21, 2025
f0d87e6
feat: Add most of the project team member related endpoints.
MerchantCalico Nov 21, 2025
cd368d9
refactor: Rename project and submission getting endpoints.
MerchantCalico Nov 21, 2025
db3796d
fix: Make rerolled seeded ID consistent when an existing ID exists.
MerchantCalico Nov 21, 2025
f2eb68c
fix: Remove seed field from NaturalId generation.
MerchantCalico Nov 21, 2025
0648a15
refactor: Remove NaturalId#isValidLegacy.
MerchantCalico Nov 21, 2025
4e6e86a
refactor: Use FMJ contact field as the fallback instead of the extern…
MerchantCalico Nov 21, 2025
0f3895a
feat: `InternalEndpoint`
sylv256 Nov 21, 2025
9ad29a7
Merge remote-tracking branch 'origin/v2' into v2
sylv256 Nov 21, 2025
aebe579
refactor: deduplicate authorization checks
sylv256 Nov 22, 2025
6ad6a74
feat: Implement BunnyCDNUtils for later use, refactors to project met…
MerchantCalico Nov 22, 2025
6001c29
fix: Use correct constructor for project endpoint.
MerchantCalico Nov 22, 2025
0a02abb
refactor: Refactors to member related endpoints, and add more permiss…
MerchantCalico Nov 22, 2025
0240f8d
refactor: OrderCorrectedRecordCodec -> OrderCorrectedCodec.
MerchantCalico Nov 22, 2025
3c77a8c
refactor: Modify submission endpoint packages.
MerchantCalico Nov 22, 2025
d4e8362
feat: Create project endpoint and project metadata rewrite.
MerchantCalico Nov 22, 2025
399bfee
feat: Add debug comment to show the time that the data-fixer takes.
MerchantCalico Nov 22, 2025
4859928
feat: Make fields named 'type' apepar first within OrderCorrectedCodec.
MerchantCalico Nov 22, 2025
48436e8
refactor: Remove 'slug' field from Modrinth submission platform.
MerchantCalico Nov 22, 2025
9b7a0f8
refactor: Remove getSlugFromId from ModrinthUtils.
MerchantCalico Nov 22, 2025
ed812c4
fix: Make AuthorizedEndpoint#requireAnyPermissions use the correct in…
MerchantCalico Nov 22, 2025
2bb556b
refactor: Miscellaneous rewrites to integrations, metadata and platfo…
MerchantCalico Nov 22, 2025
ec25c88
refactor: Rewrite unregistered scope exception message a bit.
MerchantCalico Nov 22, 2025
a9200bb
fix: set status to 403 when non-administrator attempts to edit an adm…
sylv256 Nov 22, 2025
c52b7f2
feat: Expand on OrderCorrectedCodec and rename it to ReadableOrderCodec.
MerchantCalico Nov 22, 2025
87fad1f
Merge remote-tracking branch 'origin/v2' into v2
sylv256 Nov 22, 2025
d366c30
fix: make sure there's one admin left in a project
sylv256 Nov 22, 2025
856d366
fix: make `MODERATE_PROJECTS(0x10)` permission `ALL` scope
sylv256 Nov 22, 2025
67cd009
fix: be compliant with HTTP status 201 Location header
sylv256 Nov 23, 2025
c318dfe
docs: todo for db access class in /v2/project
sylv256 Nov 23, 2025
4aefe7c
fix: set project ID for permission scopes
sylv256 Nov 23, 2025
1427584
fix: make this a javadoc
sylv256 Nov 23, 2025
64f8124
fix: call handle super method & handle exceptions
sylv256 Nov 23, 2025
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ bin/
### Mac OS ###
.DS_Store

### Linux ###
.directory

### Custom
/.idea
/run
Expand Down
38 changes: 21 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.jetbrains.gradle.ext.Application
import org.jetbrains.gradle.ext.runConfigurations
import org.jetbrains.gradle.ext.settings

Expand All @@ -14,7 +13,7 @@ group = "net.modgarden"
version = project.properties["version"].toString()

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
withJavadocJar()
}

Expand All @@ -30,13 +29,13 @@ dependencies {
implementation(libs.javalin)
implementation(libs.logback)
implementation(libs.sqlite)
implementation(libs.snowflakeid)
implementation(libs.dotenv)
implementation(libs.jwt.api)
implementation(libs.jwt.impl)
implementation(libs.jwt.gson)
implementation(libs.base62)
implementation(libs.jetbrains.annotations)

implementation(libs.argon2.jvm)
}

tasks {
Expand Down Expand Up @@ -81,18 +80,23 @@ application {
mainClass = "net.modgarden.backend.ModGardenBackend"
}

// When refreshing the project, the entire build.gradle.kts may visually error because of IDEA Ext.
// Refresh the project again to fix this. We'll likely have to report this to JetBrains.
idea {
project {
settings.runConfigurations {
create("Run", Application::class.java) {
workingDirectory = "${rootProject.projectDir}/run"
mainClass = "net.modgarden.backend.ModGardenBackend"
moduleName = project.idea.module.name + ".main"
includeProvidedDependencies = true
envs = mapOf(
"env" to "development"
)
}
}
}
project {
settings {
runConfigurations {
create("Run Backend", org.jetbrains.gradle.ext.Application::class.java) {
workingDirectory = "${rootProject.projectDir}/run"
mainClass = "net.modgarden.backend.ModGardenBackend"
moduleName = project.idea.module.name + ".main"
includeProvidedDependencies = true
envs = mapOf(
"env" to "development",
)
jvmArgs = "--enable-native-access=ALL-UNNAMED"
}
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 1.4.0
version = 2.0.0-beta.1
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
[versions]
dfu = "8.0.16"
javalin = "6.4.0"
logback = "1.5.18"
sqlite = "3.47.1.0"
snowflakeid = "0.0.2"
javalin = "6.7.0"
logback = "1.5.21"
sqlite = "3.51.0.0"
dotenv = "2.3.0"
jwt = "0.11.5"
base62 = "0.1.3"
jetbrains_annotations = "0.1.3"

idea_ext = "1.1.9"
argon2-jvm = "2.12"

idea_ext = "1.3"

[libraries]
dfu = { group = "com.mojang", name = "datafixerupper", version.ref = "dfu" }
javalin = { group = "io.javalin", name = "javalin", version.ref = "javalin" }
logback = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" }
sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" }
dotenv = { group = "io.github.cdimascio", name = "dotenv-java", version.ref = "dotenv" }
snowflakeid = { group = "de.mkammerer.snowflake-id", name = "snowflake-id", version.ref = "snowflakeid" }
jwt_api = { group = "io.jsonwebtoken", name = "jjwt-api", version.ref = "jwt" }
jwt_impl = { group = "io.jsonwebtoken", name = "jjwt-impl", version.ref = "jwt" }
jwt_gson = { group = "io.jsonwebtoken", name = "jjwt-gson", version.ref = "jwt" }
base62 = { group = "io.seruco.encoding", name = "base62", version.ref = "base62" }
jetbrains_annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains_annotations" }

argon2-jvm = { group = "de.mkammerer", name = "argon2-jvm", version.ref = "argon2-jvm" }

[plugins]
idea_ext = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "idea_ext" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
52 changes: 52 additions & 0 deletions src/main/java/net/modgarden/backend/HypertextResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package net.modgarden.backend;

import io.javalin.http.Context;
import org.jetbrains.annotations.Nullable;

public final class HypertextResult<T> {
private final boolean success;
private final int status;
private String message;
private T object;

public HypertextResult(int status, String message) {
this.success = false;
this.status = status;
this.message = message;
}

public HypertextResult(T object) {
this.success = true;
this.status = 200;
this.object = object;
}

public boolean isSuccess() {
return success;
}

public int getStatus() {
return status;
}

public String getMessage() {
if (success) throw new IllegalStateException("result succeeded");
return message;
}

public T getObject() {
if (!success) throw new IllegalStateException("result failed");
return object;
}

@Nullable
public T unwrap(Context ctx) {
if (!success) {
ctx.result(message);
ctx.status(status);
return null;
}

return object;
}
}
Loading