Skip to content

Commit

Permalink
Merge branch 'main' into archive-downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Fleeym committed Dec 17, 2024
2 parents 68dab60 + 73cbf52 commit 47baeb8
Show file tree
Hide file tree
Showing 21 changed files with 238 additions and 33 deletions.
15 changes: 15 additions & 0 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Setup rust
description: Installs rust for cross-compilation on ARM

runs:
using: "composite"
steps:
- name: Install ARM cross-compilation tools
shell: bash
run: sudo apt-get update && sudo apt-get install --assume-yes --no-install-recommends g++-aarch64-linux-gnu

- name: Install rust
shell: bash
run: |
rustup toolchain install stable --profile minimal
rustup target add aarch64-unknown-linux-gnu
33 changes: 33 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build Index

on:
push:
branches:
- "**"
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup rust
uses: ./.github/actions/setup-rust

- name: Setup cache
uses: Swatinem/rust-cache@v2

- name: Build
shell: bash
id: build
run: |
cargo build --release --target aarch64-unknown-linux-gnu
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: geode-index
path: ./target/aarch64-unknown-linux-gnu/release/geode-index
6 changes: 3 additions & 3 deletions .github/workflows/deploy-api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
build:
build-api-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -25,8 +25,8 @@ jobs:
with:
path: swagger-ui

deploy:
needs: build
deploy-api-docs:
needs: build-api-docs
permissions:
pages: write
id-token: write
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,19 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v4

- name: Install stuff
run: sudo apt-get update && sudo apt-get install --assume-yes --no-install-recommends g++-aarch64-linux-gnu

- name: Setup env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Install rust
run: |
rustup toolchain install stable --profile minimal
rustup target add aarch64-unknown-linux-gnu
- name: Setup rust
uses: ./.github/actions/setup-rust

- name: Setup cache
uses: Swatinem/rust-cache@v2

- name: Build
shell: bash
id: build
run: |
cargo build --release --target aarch64-unknown-linux-gnu
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "geode-index"
version = "0.31.1"
version = "0.34.1"
edition = "2021"

[dependencies]
Expand Down
3 changes: 3 additions & 0 deletions migrations/20241112190527_add_22074_gd.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Add up migration script here

alter type gd_version add value '2.2074';
6 changes: 6 additions & 0 deletions migrations/20241113145919_add_display_name_to_tags.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Add down migration script here

ALTER TABLE mod_tags DROP COLUMN display_name;

UPDATE mod_tags SET name = 'cheats'
WHERE name = 'cheat';
40 changes: 40 additions & 0 deletions migrations/20241113145919_add_display_name_to_tags.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- Add up migration script here

ALTER TABLE mod_tags ADD COLUMN display_name TEXT;

UPDATE mod_tags SET display_name = 'Universal'
WHERE name = 'universal';
UPDATE mod_tags SET display_name = 'Gameplay'
WHERE name = 'gameplay';
UPDATE mod_tags SET display_name = 'Editor'
WHERE name = 'editor';
UPDATE mod_tags SET display_name = 'Offline'
WHERE name = 'offline';
UPDATE mod_tags SET display_name = 'Online'
WHERE name = 'online';
UPDATE mod_tags SET display_name = 'Enhancement'
WHERE name = 'enhancement';
UPDATE mod_tags SET display_name = 'Music'
WHERE name = 'music';
UPDATE mod_tags SET display_name = 'Interface'
WHERE name = 'interface';
UPDATE mod_tags SET display_name = 'Bugfix'
WHERE name = 'bugfix';
UPDATE mod_tags SET display_name = 'Utility'
WHERE name = 'utility';
UPDATE mod_tags SET display_name = 'Performance'
WHERE name = 'performance';
UPDATE mod_tags SET display_name = 'Customization'
WHERE name = 'customization';
UPDATE mod_tags SET display_name = 'Content'
WHERE name = 'content';
UPDATE mod_tags SET display_name = 'Developer'
WHERE name = 'developer';
UPDATE mod_tags SET display_name = 'Cheat', name = 'cheat'
WHERE name = 'cheats';
UPDATE mod_tags SET display_name = 'Paid'
WHERE name = 'paid';
UPDATE mod_tags SET display_name = 'Joke'
WHERE name = 'joke';
UPDATE mod_tags SET display_name = 'Modtober 2024'
WHERE name = 'modtober24';
3 changes: 3 additions & 0 deletions migrations/20241210001229_add_readonly_to_mod_tags.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Add down migration script here

ALTER TABLE mod_tags DROP is_readonly;
4 changes: 4 additions & 0 deletions migrations/20241210001229_add_readonly_to_mod_tags.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Add up migration script here

ALTER TABLE mod_tags
ADD is_readonly BOOLEAN NOT NULL DEFAULT false;
5 changes: 4 additions & 1 deletion src/endpoints/mod_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ pub async fn create_version(

let mut file_path = download_geode_file(&download_link).await?;
let json = ModJson::from_zip(&mut file_path, &download_link, dev.verified)
.or(Err(ApiError::FilesystemError))?;
.map_err(|err| {
log::error!("Failed to parse mod.json: {}", err);
ApiError::FilesystemError
})?;
if json.id != path.id {
return Err(ApiError::BadRequest(format!(
"Request id {} does not match mod.json id {}",
Expand Down
12 changes: 12 additions & 0 deletions src/endpoints/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@ pub async fn index(data: web::Data<AppData>) -> Result<impl Responder, ApiError>
payload: tags,
}))
}

#[get("/v1/detailed-tags")]
pub async fn detailed_index(data: web::Data<AppData>) -> Result<impl Responder, ApiError> {
let mut pool = data.db.acquire().await.or(Err(ApiError::DbAcquireError))?;

let tags = Tag::get_detailed_tags(&mut pool).await?;

Ok(web::Json(ApiResponse {
error: "".to_string(),
payload: tags,
}))
}
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ async fn main() -> anyhow::Result<()> {
.service(endpoints::developers::get_me)
.service(endpoints::developers::update_developer)
.service(endpoints::tags::index)
.service(endpoints::tags::detailed_index)
.service(endpoints::stats::get_stats)
.service(health)
})
Expand Down
4 changes: 4 additions & 0 deletions src/types/models/mod_gd_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ pub enum GDVersionEnum {
#[serde(rename = "2.2073")]
#[sqlx(rename = "2.2073")]
GD22073,
#[serde(rename = "2.2074")]
#[sqlx(rename = "2.2074")]
GD22074,
}

impl FromStr for GDVersionEnum {
Expand All @@ -57,6 +60,7 @@ impl FromStr for GDVersionEnum {
"2.2071" => Ok(GDVersionEnum::GD22071),
"2.2072" => Ok(GDVersionEnum::GD22072),
"2.2073" => Ok(GDVersionEnum::GD22073),
"2.2074" => Ok(GDVersionEnum::GD22074),
_ => Err(()),
}
}
Expand Down
Loading

0 comments on commit 47baeb8

Please sign in to comment.