Skip to content

Commit 5be3981

Browse files
authored
More source code (#5)
1 parent 706e995 commit 5be3981

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2214
-3266
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Automatically update the database when an issue in the compatibility repo gets updated
2+
3+
name: Compatibility List Updater
4+
on:
5+
issues:
6+
types:
7+
- opened
8+
- labeled
9+
- edited
10+
- closed
11+
- deleted
12+
repositories:
13+
- obhq/compatibility
14+
workflow_dispatch:
15+
inputs:
16+
manual:
17+
description: Manually updates the database!
18+
19+
env:
20+
CARGO_TERM_COLOR: always
21+
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
HOMEBREW_API_TOKEN: ${{ secrets.HOMEBREW_API_TOKEN }}
23+
TMDB_HEX: ${{ secrets.TMDB_HEX }}
24+
25+
defaults:
26+
run:
27+
working-directory: updater/
28+
29+
jobs:
30+
build:
31+
name: obhqWebsite_database_updater
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: checkout repository
35+
uses: actions/checkout@v4
36+
37+
- name: setup rust
38+
run: |
39+
rustup update stable
40+
rustup default stable
41+
42+
- name: restore old images && database
43+
run: |
44+
git config --global user.name "GitHub Actions"
45+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
46+
git fetch origin gh-pages
47+
git switch gh-pages --force
48+
mkdir -p /home/runner/work/obhqWebsite/temp/updater/images/
49+
50+
# if there are images, copy em over
51+
if [ -d /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/ ]; then
52+
echo "Copying Images"
53+
cp -a -r -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/* /home/runner/work/obhqWebsite/temp/updater/images/
54+
fi
55+
56+
# if there is an old main db, copy it over
57+
if [ -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json ]; then
58+
echo "Copying Old Database"
59+
cp -a -r -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json /home/runner/work/obhqWebsite/temp/updater/database.json
60+
fi
61+
62+
git fetch origin main
63+
git switch main --force
64+
65+
- name: run obhqWebsite_database_updater
66+
run: cargo run --release
67+
68+
- name: Commit and push changes to main
69+
run: |
70+
git fetch origin main
71+
git add game_skips.json -f
72+
git add HBstore.db -f
73+
git add config/config.toml -f
74+
75+
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l)
76+
if [ $files_to_commit -gt 0 ]; then
77+
echo "Committing changes!"
78+
git fetch origin main
79+
git commit -m "Automatic Compatibility List Update"
80+
git push origin main
81+
else
82+
echo "No changes to commit."
83+
fi
84+
85+
86+
- name: Commit and push changes to gh-pages
87+
run: |
88+
git fetch origin gh-pages
89+
git switch gh-pages --force
90+
mkdir -p /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/
91+
92+
rm -r -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/games/
93+
rm -r -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/hb/
94+
rm -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json
95+
rm -f /home/runner/work/obhqWebsite/obhqWebsite/stats.json
96+
97+
mv -f /home/runner/work/obhqWebsite/temp/updater/images/* /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/
98+
mv -f /home/runner/work/obhqWebsite/temp/updater/database.json /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json
99+
mv -f /home/runner/work/obhqWebsite/temp/updater/stats.json /home/runner/work/obhqWebsite/obhqWebsite/stats.json
100+
101+
git add /home/runner/work/obhqWebsite/obhqWebsite/stats.json -f
102+
git add /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json -f
103+
git add /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/ -f
104+
105+
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l)
106+
if [ $files_to_commit -gt 0 ]; then
107+
echo "Committing changes!"
108+
git fetch origin gh-pages
109+
git commit -m "Automatic Compatibility List Update"
110+
git push origin gh-pages
111+
else
112+
echo "No changes to commit."
113+
fi

.github/workflows/mdbook.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Automatically updates the mdbook on build
2+
3+
name: mdbook updater
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- mdbook/**
10+
workflow_dispatch:
11+
inputs:
12+
manual:
13+
description: Manually updates the mdbook!
14+
15+
defaults:
16+
run:
17+
working-directory: mdbook/
18+
19+
jobs:
20+
build:
21+
name: mdbook updater
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: setup rust
28+
run: |
29+
rustup update stable
30+
rustup default stable
31+
32+
- name: install mdbook
33+
run: cargo install mdbook
34+
35+
- name: build mdbook
36+
run: |
37+
mdbook build --dest-dir /home/runner/work/obhqWebsite/temp/wiki/
38+
39+
- name: Commit and push changes to gh-pages
40+
run: |
41+
git config --global user.name "GitHub Actions"
42+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
43+
git fetch origin gh-pages
44+
git switch gh-pages --force
45+
rm -r -f /home/runner/work/obhqWebsite/obhqWebsite/wiki/
46+
mv -f /home/runner/work/obhqWebsite/temp/wiki/ /home/runner/work/obhqWebsite/obhqWebsite/wiki/
47+
git add /home/runner/work/obhqWebsite/obhqWebsite/wiki/
48+
49+
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l)
50+
if [ $files_to_commit -gt 0 ]; then
51+
echo "Committing changes!"
52+
git fetch origin gh-pages
53+
git commit -m "Automatic mdbook Update"
54+
git push origin gh-pages
55+
else
56+
echo "No changes to commit."
57+
fi

.github/workflows/public_html.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: public_html update
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- public_html/**
8+
workflow_dispatch:
9+
inputs:
10+
manual:
11+
description: Manually updates the public_html!
12+
13+
jobs:
14+
build:
15+
name: public_html Updater
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Copy files
22+
run: |
23+
mkdir -p /home/runner/work/obhqWebsite/temp/public_html/
24+
cp -a -r -f /home/runner/work/obhqWebsite/obhqWebsite/public_html/* /home/runner/work/obhqWebsite/temp/public_html/
25+
26+
- name: Commit and push changes to gh-pages
27+
run: |
28+
# Switch to gh-pages
29+
git config --global user.name "GitHub Actions"
30+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
31+
git fetch origin gh-pages
32+
git switch gh-pages --force
33+
34+
# put the new files into the folder
35+
rm -r -f /home/runner/work/obhqWebsite/obhqWebsite/*
36+
mv -f /home/runner/work/obhqWebsite/temp/public_html/* /home/runner/work/obhqWebsite/obhqWebsite/
37+
touch /home/runner/work/obhqWebsite/obhqWebsite/.nojekyll
38+
git add /home/runner/work/obhqWebsite/obhqWebsite/ -f
39+
40+
# restore files that dont need updating
41+
git restore --staged --worktree wiki/
42+
git restore --staged --worktree compatibility/_images/games/
43+
git restore --staged --worktree compatibility/_images/hb/
44+
git restore --staged --worktree compatibility/database.json
45+
git restore --staged --worktree stats.json
46+
47+
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l)
48+
if [ $files_to_commit -gt 0 ]; then
49+
echo "Committing changes!"
50+
git fetch origin gh-pages
51+
git commit -m "Automatic public_html update"
52+
git push origin gh-pages
53+
else
54+
echo "No changes to commit."
55+
fi

.gitignore

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# will have compiled files and executables
44
debug/
55
target/
6+
Cargo.lock
67

78
# These are backup files generated by rustfmt
89
**/*.rs.bk
@@ -15,6 +16,12 @@ stuff.txt
1516
.idea
1617
*.db
1718
.htaccess
19+
20+
mdbook/book/
1821
updater/images/
19-
updater/config/config.toml
20-
stats.json
22+
/public_html/Gamma-Boi/compatibility/_images/games/
23+
/public_html/Gamma-Boi/compatibility/_images/hb/
24+
25+
stats.json
26+
database.json
27+
game_skips.json

CHANGELOG.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
### [v0.3.1] (unreleased)
9+
- Put the tmdb hex into the config, instead of a secret variable
10+
- Added CSP to the `_errorPages` and some other small fixes
11+
12+
### [v0.3.0]
13+
14+
#### Added
15+
16+
- .yml files for automatic releases
17+
- Modified rust comp updater to get the secrets using the environmental variables
18+
- Added CSP to the pages
19+
20+
#### Changed
21+
22+
- Changed directories of the website
23+
- Aesthetic changes and error handling improvements to the rust comp updater
24+
- Fixed the top bar changing its width when typing on the comp page
25+
26+
#### Removed
27+
28+
- Removed Coming soon page
29+
- Removed `Gamma-Boi`
30+
- Removed inline javascript
31+
32+
### [v0.2.0]
33+
34+
#### Added
35+
36+
- Comp List
37+
- Added mobile support
38+
- Added comments to the javascript code
39+
40+
#### Changed
41+
42+
- General
43+
- Did **a lot of** cleanup and bug fixes with the rust updater script
44+
- Main Page
45+
- Improved mobile support
46+
- Smoll styling changes
47+
- Comp List
48+
- Check if the page search bar contains a number
49+
- fixed `minNumberElement` displaying that there is a page while there isn't
50+
- fixed `x results found` text to display the correct number
51+
- fixed css browser compatibility
52+
- removed unused css
53+
- Moved color accents to `required.css`
54+
- Made `updated_date` automatically change time format based on the user
55+
- Updater Script
56+
- Fixed `game_skips.json` not getting saved
57+
- Made homebrew database updater into a separate function
58+
- Changed the last_updated string into `rfc3339` format
59+
- Tidied up the code for getting the `status_tag`, `code`, and `issue_type`
60+
- Improved error handling
61+
- Merged the two config classes into one
62+
- Fixed folder creation
63+
- Updated the config
64+
- Fixed direction of issues being flipped
65+
66+
### [v0.1.0]
67+
68+
#### Added
69+
70+
- General
71+
- added avif images (if supported on the client) for the logo's, this resulted in a ~90% size reduction of the
72+
images.
73+
- Added an animation for the header when it's done loading
74+
75+
76+
- Main Page
77+
- Added an animation for the `main2` section.
78+
79+
80+
- Comp List
81+
- Added an animation for the status bars when it's done fetching the `storage.json`
82+
- Added animations for the GameCard's
83+
- Added placeholders for when it's fetching the `storage.json`
84+
- Added id/code searching
85+
- Added page searching
86+
87+
#### Changed
88+
89+
- General
90+
- Improved text
91+
- Hid alt text on images
92+
- Finished `animationHandler()`
93+
94+
95+
- Comp List
96+
- Changed the `Playable` color from <span style="background:#24bb2d;">#24bb2d</span>
97+
to <span style="background:#5fac4e;">#5fac4e</span>
98+
- Made `gameCardHandler()` only return the first 10 issues on load
99+
- Improved General code
100+
- Made the `N/A` image text for games without an image to `GAME`
101+
102+
#### Removed
103+
104+
- Comp List
105+
- Removed unnecessary id's for the status bar's
106+
- Removed `addEventListener` in favor of the `onInput` method for the search bar's

mdbook/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

mdbook/book.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ src = "src"
99
edition = "2018"
1010

1111
[build]
12-
build-dir = 'D:\Website\public_html\Gamma-Boi\wiki'
13-
create-missing = false
12+
build-dir = '/home/runner/work/obhqWebsite/temp/wiki/'
13+
create-missing = true

public_html/.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Prevents Github Pages from being silly
-121 KB
Binary file not shown.
-256 KB
Binary file not shown.

0 commit comments

Comments
 (0)