Skip to content

Commit

Permalink
merge maybe?
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcode-create committed Nov 8, 2024
1 parent 01ecc5f commit 01c6ebb
Show file tree
Hide file tree
Showing 48 changed files with 3,522 additions and 2,271 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [ 'barratt', 'stefanOltmann' ]
ko_fi: sgtimalas
155 changes: 90 additions & 65 deletions .github/workflows/build_mod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

permissions:
contents: write # Grant write permission for creating releases
actions: write # Grant write permission to delete old workflow runs

defaults:
run:
Expand All @@ -18,68 +19,92 @@ jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Replace credentials
run: sed -i 's\7FE9SFM9jdv7CcL\${{ secrets.MNI_API_KEY }}\g' _WorldGenStateCapture\Credentials.cs
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: NuGet Restore
run: msbuild -t:restore -property:Configuration=Release
- name: Build project
run: msbuild -t:rebuild -property:Configuration=Release -property:GameLibsFolder="../Lib"
- name: Create build artifact
uses: actions/upload-artifact@v4
with:
path: mod/Builds/MapsNotIncluded_WorldParser
name: MapsNotIncludedMod
- name: List all files
shell: cmd
run: |
dir /s /b
- name: Move
run: move "Builds\MapsNotIncluded_WorldParser" .
- name: Zip the directory
run: Compress-Archive -Path "MapsNotIncluded_WorldParser" -DestinationPath MapsNotIncludedMod.zip
- name: List all files
shell: cmd
run: |
dir /s /b
- name: Set SHORT_COMMIT environment variable
shell: pwsh
run: |
$SHORT_COMMIT = git rev-parse --short HEAD
echo "SHORT_COMMIT=$SHORT_COMMIT" >> $env:GITHUB_ENV
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "mod-${{ env.SHORT_COMMIT }}"
release_name: "Mod binary "
draft: false
prerelease: false
- name: Upload MapsNotIncludedMod.zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mod/MapsNotIncludedMod.zip
asset_name: MapsNotIncludedMod.zip
asset_content_type: application/zip
- name: Delete old releases
uses: dev-drprasad/delete-older-releases@v0.3.4
with:
keep_latest: 1
delete_tag_pattern: mod-*
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 3
keep_minimum_runs: 3
- uses: actions/checkout@v4
- name: Replace credentials
run: sed -i 's\7FE9SFM9jdv7CcL\${{ secrets.MNI_API_KEY }}\g' _WorldGenStateCapture\Credentials.cs
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: NuGet Restore
run: msbuild -t:restore -property:Configuration=Release
- name: Build project
run: msbuild -t:rebuild -property:Configuration=Release -property:GameLibsFolder="../Lib"
- name: Create build artifact
uses: actions/upload-artifact@v4
with:
path: mod/Builds/MapsNotIncluded_WorldParser
name: MapsNotIncludedMod
- name: List all files
shell: cmd
run: |
dir /s /b
- name: Move
run: move "Builds\MapsNotIncluded_WorldParser" .
- name: Zip the directory
run: Compress-Archive -Path "MapsNotIncluded_WorldParser" -DestinationPath MapsNotIncludedMod.zip
- name: List all files
shell: cmd
run: |
dir /s /b
- name: Set SHORT_COMMIT environment variable
shell: pwsh
run: |
$SHORT_COMMIT = git rev-parse --short HEAD
echo "SHORT_COMMIT=$SHORT_COMMIT" >> $env:GITHUB_ENV
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "mod-${{ env.SHORT_COMMIT }}"
release_name: "Mod binary "
draft: false
prerelease: false
- name: Upload MapsNotIncludedMod.zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mod/MapsNotIncludedMod.zip
asset_name: MapsNotIncludedMod.zip
asset_content_type: application/zip
- name: Delete old releases
uses: dev-drprasad/delete-older-releases@v0.3.4
with:
keep_latest: 1
delete_tag_pattern: mod-*
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 3
- name: Compute SHA-256 checksum and send to server
shell: powershell
env:
API_KEY: ${{ secrets.DATABASE_EXPORT_API_KEY }}
run: |
$filePath = "MapsNotIncluded_WorldParser\MapsNotIncluded_WorldParser.dll"
if (Test-Path -Path $filePath) {
$checksum = (Get-FileHash -Path $filePath -Algorithm SHA256 | Select-Object -ExpandProperty Hash).ToLower()
$headers = @{
"API_KEY" = "$env:API_KEY"
}
$response = Invoke-RestMethod -Uri "https://ingest.mapsnotincluded.org/add-mod-binary-checksum" -Method Post -Headers $headers -Body $checksum -ContentType "text/plain"
Write-Output "Server response: $response"
} else {
Write-Error "File not found: $filePath"
}
4 changes: 2 additions & 2 deletions .github/workflows/release_database_export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
uses: actions/checkout@v3
- name: Download data.zip
env:
DATABASE_EXPORT_API_KEY: ${{ secrets.DATABASE_EXPORT_API_KEY }}
API_KEY: ${{ secrets.DATABASE_EXPORT_API_KEY }}
run: |
curl --fail -H "DATABASE_EXPORT_API_KEY: $DATABASE_EXPORT_API_KEY" -o data.zip https://ingest.mapsnotincluded.org/export
curl --fail -H "API_KEY: $API_KEY" -o data.zip https://ingest.mapsnotincluded.org/export
- name: set NOW
run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Create GitHub release
Expand Down
28 changes: 28 additions & 0 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,35 @@
</div>
</template>

<style>
body {
overscroll-behavior: none;
}
</style>

<script setup>
import Navbar from '@/components/Navbar.vue'
import { RouterView } from 'vue-router'
</script>

<script>
import { useUserStore } from './stores';
export default {
data() {
return {};
},
mounted() {
console.log("App mounted");
this.$router.isReady().then(() => {
const token = this.$route.query.token;
if (token) {
useUserStore().setToken(token);
this.$router.replace({ query: {} });
}
});
}
}
</script>
62 changes: 62 additions & 0 deletions frontend/src/components/CoordinateRequestDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import Swal from "sweetalert2";
import { useUserStore } from "@/stores";

export function requestCoordinate() {
const apiUrl = import.meta.env.VITE_API_URL;
// Lets pop up a swal to ask for the seed name and then send it to the backend
Swal.fire({
title: "Request a seed thats not found in the database yet",
input: "text",
inputLabel: "Coordinate:",
inputPlaceholder: "Enter the Coordinate here...",
showCancelButton: true,
confirmButtonText: "Request",
showLoaderOnConfirm: true,
inputValidator: (coordinate) => validateCoordinate(coordinate),
preConfirm: (coordinates) => {
return fetch(`${apiUrl}/coordinates/request/` + coordinates, {
method: "GET",
headers: {
Authorization: `Bearer ${useUserStore().token}`,
},
})
.then((response) => {
return response.json();
})
.then((data) => {
if (data.error) {
throw new Error(data.error);
}
return data;
})

.catch((error) => {
Swal.showValidationMessage(`${error}`);
});
},
allowOutsideClick: () => !Swal.isLoading(),
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
title: "Seed Requested",
text: result.value.message,
icon: "success",
});
}
});
}

export function validateCoordinate(coordinate) {
const coordinateValidationRegex = RegExp(
/(^(SNDST-A|CER-A|CERS-A|OCAN-A|S-FRZ|LUSH-A|FRST-A|VOLCA|BAD-A|HTFST-A|OASIS-A|V-SNDST-C|V-CER-C|V-CERS-C|V-OCAN-C|V-SWMP-C|V-SFRZ-C|V-LUSH-C|V-FRST-C|V-VOLCA-C|V-BAD-C|V-HTFST-C|V-OASIS-C|SNDST-C|CER-C|FRST-C|SWMP-C|M-SWMP-C|M-BAD-C|M-FRZ-C|M-FLIP-C|M-RAD-C)-\d+-[^-]*-[^-]*-[^-]*)/gm
);
return new Promise((resolve) => {
console.log(coordinate);
let coordinateValid = coordinateValidationRegex.test(coordinate);
if (!coordinateValid) {
resolve("Not a valid Coordinate!");
} else {
resolve();
}
});
}
Loading

0 comments on commit 01c6ebb

Please sign in to comment.