Skip to content

Commit

Permalink
Change name
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubAndrysek committed Sep 22, 2024
1 parent f6b39a4 commit 32dbe50
Show file tree
Hide file tree
Showing 70 changed files with 104 additions and 221 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd forester-game-app
cd ForrestHub-app
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable
run: |
cd forester-game-app
cd ForrestHub-app
pyinstaller pyinstaller.spec
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: Forester-${{ runner.os }}
path: forester-game-app/dist/Forester*
name: ForrestHub-${{ runner.os }}
path: ForrestHub-app/dist/ForrestHub*

create-release:
needs: build-and-release
Expand All @@ -55,15 +55,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Forester-Windows/Forester.exe
asset_name: Forester-Windows.exe
asset_path: ./ForrestHub-Windows/ForrestHub.exe
asset_name: ForrestHub-Windows.exe
asset_content_type: application/octet-stream
- name: Upload macOS Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Forester-macOS/Forester
asset_name: Forester-macOS
asset_path: ./ForrestHub-macOS/ForrestHub
asset_name: ForrestHub-macOS
asset_content_type: application/octet-stream
16 changes: 8 additions & 8 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd forester-game-app
cd ForrestHub-app
pip install -r requirements.txt
pip install pyinstaller
- name: Build with PyInstaller
run: |
cd forester-game-app
cd ForrestHub-app
pyinstaller pyinstaller.spec
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: Forester-Windows
path: forester-game-app/dist/Forester.exe
name: ForrestHub-Windows
path: ForrestHub-app/dist/ForrestHub.exe

build-macos:
runs-on: macos-latest
Expand All @@ -42,15 +42,15 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd forester-game-app
cd ForrestHub-app
pip install -r requirements.txt
pip install pyinstaller
- name: Build with PyInstaller
run: |
cd forester-game-app
cd ForrestHub-app
pyinstaller pyinstaller.spec
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: Forester-macOS
path: forester-game-app/dist/Forester
name: ForrestHub-macOS
path: ForrestHub-app/dist/ForrestHub
2 changes: 1 addition & 1 deletion CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
games.helceletka.cz
forresthub.helceletka.cz
1 change: 1 addition & 0 deletions ForrestHub-app/ForrestHub-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"records": [{"id": 1, "time": "16:16:48", "date": "22/09/2024"}, {"id": 2, "time": "16:16:49", "date": "22/09/2024"}, {"id": 3, "time": "16:16:49", "date": "22/09/2024"}, {"id": 4, "time": "16:16:50", "date": "22/09/2024"}, {"id": 5, "time": "16:24:44", "date": "22. 9. 2024"}, {"id": 6, "time": "4:24:48 PM", "date": "9/22/2024"}, {"id": 7, "time": "22:46:52", "date": "22/09/2024"}, {"id": 8, "time": "22:46:53", "date": "22/09/2024"}, {"id": 9, "time": "22:46:54", "date": "22/09/2024"}, {"id": 10, "time": "22:46:56", "date": "22/09/2024"}, {"id": 11, "time": "22:46:57", "date": "22/09/2024"}, {"id": 12, "time": "22:46:58", "date": "22/09/2024"}, {"id": 13, "time": "22:47:47", "date": "22/09/2024"}, {"id": 14, "time": "22:47:48", "date": "22/09/2024"}, {"id": 15, "time": "22:47:49", "date": "22/09/2024"}], "prijem_queue": [], "odeslani_queue": [], "los_queue": [], "numbersList": ["1234"]}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ def render_page(folder: str, page: str):
return send_from_directory(path_to_file.parent, path_to_file.name)
return abort(404)
else:
title = folder.capitalize()
if page.lower() != "index":
title = f"{title} - {page.capitalize()}"

return render_template(
f"{folder}/{page}.html",
title=f"{folder.capitalize()}",
title=title,
folder=folder,
page=page,
data=db.get_data(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def handle_disconnect():


@socketio.on("get_game_status")
def handle_game_status(data):
def handle_game_status():
global game_status
emit("game_status", game_status)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added ForrestHub-app/assets/img/forrestHub.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ForrestHub-app/assets/img/forrestHubIcon.ico
Binary file not shown.
Binary file added ForrestHub-app/assets/img/forrestHubIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* ForrestHubLib - Library for communication with the server
*/

class ForrestHubLib {
// RUNNING = 1;
RUNNING = "running";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const image = document.getElementById('forester');
const image = document.getElementById('forrestHub');

let clickCount = 0;
image.addEventListener('click', function () {
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions forester-game-app/config.py → ForrestHub-app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@


class Config:
VERSION = "1.1.0"
DATAFILE = "data.json"
LOG_FOLDER = "ForesterLogs"
VERSION = "1.2.0"
DATAFILE = "ForrestHub-data.json"
LOG_FOLDER = "ForrestHub-logs"
ALLOWED_EXTENSIONS = ["json"]
TEMPLATES_DIR = "templates"
GAMES_DIR = "games"
ASSETS_DIR = "assets"

LIVE_DATA_DIR = "forester-live"
LIVE_DATA_DIR = "forrestHub-live"
IP_ADDRESS = get_local_ip_address()

DEBUG = True
Expand Down Expand Up @@ -43,7 +43,7 @@ class Config:
GAMES_FOLDER_LIVE = Path(LIVE_DATA_FOLDER) / GAMES_DIR
ASSETS_FOLDER_LIVE = Path(LIVE_DATA_FOLDER) / ASSETS_DIR

# check if exist
# check if exist
if not TEMPLATES_FOLDER_LIVE.exists():
raise FileNotFoundError(f"Templates folder not found: {TEMPLATES_FOLDER}")

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<h1 class="text-center mb-4">Admin Panel</h1>

<nav class="nav justify-content-center mb-4">
<a class="nav-link" href="/">Domů</a>
<a class="nav-link" href="/udavac">Udavač</a>
<a class="nav-link" href="/">Domů - výběr hry</a>
</nav>

<div class="row mb-4">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
const foresterLib = new ForrestHubLib();
foresterLib.setAdmin(true);
foresterLib.setGameMode(false);
const forrestHubLib = new ForrestHubLib();
forrestHubLib.setAdmin(true);
forrestHubLib.setGameMode(false);

let globalData = {};


foresterLib.addEventListenerKey("connect", async () => {
foresterLib.showAlert('success', 'Připojeno k serveru.');
forrestHubLib.addEventListenerKey("connect", async () => {
forrestHubLib.showAlert('success', 'Připojeno k serveru.');
await loadAndDisplayData();
foresterLib.emit('get_game_status');
forrestHubLib.emit('get_game_status');
});


setInterval(loadAndDisplayData, 1000);

async function loadAndDisplayData() {
try {
globalData = await foresterLib.getAllDatabase();
globalData = await forrestHubLib.getAllDatabase();
displayData();
} catch (error) {
foresterLib.showAlert('danger', 'Error loading data: ' + error.message);
forrestHubLib.showAlert('danger', 'Error loading data: ' + error.message);
}
}

Expand Down Expand Up @@ -123,55 +123,55 @@ async function saveData() {
}

try {
await foresterLib.setKeyBroadcast(key, value);
await forrestHubLib.setKeyBroadcast(key, value);
globalData[key] = value; // Update local data
displayData(); // Refresh the display
foresterLib.showAlert('success', `Value for ${key} updated successfully.`);
forrestHubLib.showAlert('success', `Value for ${key} updated successfully.`);
bootstrap.Modal.getInstance(document.getElementById('editModal')).hide();
} catch (error) {
foresterLib.showAlert('danger', `Error updating value: ${error}`);
forrestHubLib.showAlert('danger', `Error updating value: ${error}`);
}
}

async function deleteData(key) {
if (confirm(`Opravdu si přeješ smazat data s klíčem: ${key}`)) {
try {
await foresterLib.deleteKey(key);
await forrestHubLib.deleteKey(key);
delete globalData[key]; // Remove from local data
displayData(); // Refresh the display
foresterLib.showAlert('success', `Klíč '${key}' smazán úspěšně`);
forrestHubLib.showAlert('success', `Klíč '${key}' smazán úspěšně`);
} catch (error) {
foresterLib.showAlert('danger', `Chyba mazání ${key}: ${error}`);
forrestHubLib.showAlert('danger', `Chyba mazání ${key}: ${error}`);
}
}
}

foresterLib.addEventListenerKey('update_clients', (data) => {
forrestHubLib.addEventListenerKey('update_clients', (data) => {
document.getElementById('connected_clients').innerText = data.count;
});

function sendAdminMessage() {
const adminMessage = document.getElementById('adminMessage');
if (adminMessage.value.trim() !== '') {
foresterLib.socket.emit('send_admin_message', adminMessage.value);
forrestHubLib.socket.emit('send_admin_message', adminMessage.value);
document.getElementById('lastAdminMessage').innerText = adminMessage.value;
adminMessage.value = '';
foresterLib.showAlert('success', 'Zpráva odeslána.');
forrestHubLib.showAlert('success', 'Zpráva odeslána.');
} else {
foresterLib.showAlert('warning', 'Napište nejprve zprávu.');
forrestHubLib.showAlert('warning', 'Napište nejprve zprávu.');
}
}

document.getElementById("game_start").addEventListener("click", function () {
foresterLib.emit("set_game_status", foresterLib.RUNNING);
forrestHubLib.emit("set_game_status", forrestHubLib.RUNNING);
});

document.getElementById("game_pause").addEventListener("click", function () {
foresterLib.emit('set_game_status', foresterLib.PAUSED);
forrestHubLib.emit('set_game_status', forrestHubLib.PAUSED);
});

document.getElementById("game_stop").addEventListener("click", function () {
foresterLib.emit('set_game_status', foresterLib.STOPPED);
forrestHubLib.emit('set_game_status', forrestHubLib.STOPPED);
});


Expand All @@ -181,7 +181,7 @@ document.getElementById("download-button").addEventListener("click", function ()

document.getElementById("clear-button").addEventListener("click", async function () {
if (confirm("Are you sure you want to clear all data? This action cannot be undone.")) {
await foresterLib.deleteAllDatabase();
await forrestHubLib.deleteAllDatabase();
}
});

Expand All @@ -200,16 +200,16 @@ document.getElementById("upload-button").addEventListener("click", async functio
});
const data = await response.json();
if (data.status === "success") {
foresterLib.showAlert('success', "Data successfully uploaded.");
forrestHubLib.showAlert('success', "Data successfully uploaded.");
await loadAndDisplayData(); // Reload and display the new data
} else {
foresterLib.showAlert('danger', "An error occurred while uploading the data.");
forrestHubLib.showAlert('danger', "An error occurred while uploading the data.");
}
} catch (error) {
console.error("Error uploading file:", error);
foresterLib.showAlert('danger', "An error occurred while uploading the file.");
forrestHubLib.showAlert('danger', "An error occurred while uploading the file.");
}
} else {
foresterLib.showAlert('warning', "Please select a file to upload.");
forrestHubLib.showAlert('warning', "Please select a file to upload.");
}
});
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const foresterLib = new ForrestHubLib();
const forrestHubLib = new ForrestHubLib();

document.addEventListener('DOMContentLoaded', function () {
const counterElement = document.getElementById('counter');
const decrementButton = document.getElementById('decrementButton');

// Načti počáteční hodnotu počítadla
foresterLib.getKey('my_number').then((value) => {
forrestHubLib.getKey('my_number').then((value) => {
counterElement.innerText = value || 0;
}).catch((err) => {
console.error('Chyba při načítání počítadla:', err);
Expand All @@ -16,15 +16,15 @@ document.addEventListener('DOMContentLoaded', function () {
let currentValue = parseInt(counterElement.innerText, 10);
let newValue = currentValue - 1;

foresterLib.setKeyBroadcast('my_number', newValue).then((response) => {
forrestHubLib.setKeyBroadcast('my_number', newValue).then((response) => {
counterElement.innerText = newValue;
}).catch((err) => {
console.error('Chyba při ukládání počítadla:', err);
});
});

// Automatické načítání změn v hodnotě počítadla
foresterLib.addEventListenerKey('my_number', (data) => {
forrestHubLib.addEventListenerKey('my_number', (data) => {
counterElement.innerText = data || 0;
});
});
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ <h1>Demo úkázka použití šablony</h1>
</div>

<script>
const foresterLib = new ForrestHubLib();
const forrestHubLib = new ForrestHubLib();

document.addEventListener('DOMContentLoaded', function () {
const counterElement = document.getElementById('counter');
const incrementButton = document.getElementById('incrementButton');

// Načti počáteční hodnotu počítadla
foresterLib.getKey('my_number').then((value) => {
forrestHubLib.getKey('my_number').then((value) => {
counterElement.innerText = value || 0;
}).catch((err) => {
console.error('Chyba při načítání počítadla:', err);
Expand All @@ -28,15 +28,15 @@ <h1>Demo úkázka použití šablony</h1>
let currentValue = parseInt(counterElement.innerText, 10);
let newValue = currentValue + 1;

foresterLib.setKeyBroadcast('my_number', newValue).then((response) => {
forrestHubLib.setKeyBroadcast('my_number', newValue).then((response) => {
counterElement.innerText = newValue;
}).catch((err) => {
console.error('Chyba při ukládání počítadla:', err);
});
});

// Automatické načítání změn v hodnotě počítadla
foresterLib.addEventListenerKey('my_number', (data) => {
forrestHubLib.addEventListenerKey('my_number', (data) => {
counterElement.innerText = data || 0;
});
});
Expand Down
Loading

0 comments on commit 32dbe50

Please sign in to comment.