Skip to content

Commit

Permalink
WIP...
Browse files Browse the repository at this point in the history
Closes #43
Implement sqlite3 to replace settings and servers json files
Add nightly branch
Refactor notifications so multiples can be sent per platform
Refactor the api functions some
Add a trait/interface function loader
Add some defines for common platforms
Fix the dialogClose function
Fix backups not being removed
Some rewording
  • Loading branch information
austinwbest committed Sep 7, 2024
1 parent c091e4c commit 877e0a8
Show file tree
Hide file tree
Showing 60 changed files with 2,336 additions and 1,016 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ name: Docker

on:
push:
branches: [ "main", "develop" ]
branches: [ "main", "develop", "nightly" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main", "develop" ]
branches: [ "main", "develop", "nightly" ]

env:
# Use docker.io for Docker Hub if empty
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ RUN \
# install sockets
RUN apk add --no-cache \
php82-sockets

# install sqlite3
RUN apk add --no-cache \
sqlite \
php82-sqlite3

# add regctl for container digest checks
ARG TARGETARCH
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
## Purpose

Simple UI driven way to manage updates & notifications for Docker containers.
No database required. All settings are stored locally in a volume mount.
No database container required, all settings are stored locally with sqlite3

## Branches
- `:main` Stable releases after testing on develop
- `:develop` Usually pretty stable
- `:nightly` Use at your own risk, suggest joining Discord to keep up to date with what is going on. Might not be able to hop back to develop or main!!

## Notification triggers

Expand All @@ -21,12 +26,13 @@ No database required. All settings are stored locally in a volume mount.
## Notification platforms

- Notifiarr
- Telegram (*coming soon*)

## Update options

- Ignore
- Auto update
- Check for updates
- Auto update

## Additional features

Expand Down
15 changes: 5 additions & 10 deletions root/app/www/public/ajax/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
</thead>
<tbody>
<?php
foreach ($serversFile as $serverIndex => $serverData) {
foreach ($serversTable as $serverId => $serverData) {
?>
<tr>
<td><input type="checkbox" class="form-check-input" id="command-<?= $serverIndex ?>"></td>
<td><input type="checkbox" class="form-check-input" id="command-<?= $serverId ?>"></td>
<td><?= $serverData['name'] ?></td>
</tr>
<?php
Expand All @@ -72,16 +72,11 @@
$servers = explode(',', $_POST['servers']);
$params = $_POST['params'];

foreach ($serversFile as $serverIndex => $serverData) {
if (in_array($serverIndex, $servers)) {
foreach ($serversTable as $serverId => $serverData) {
if (in_array($serverId, $servers)) {
$serverOverride = $serverData;
$apiResponse = apiRequest($_POST['command'], ['name' => $_POST['container'], 'params' => $_POST['parameters']]);

if ($apiResponse['code'] == 200) {
$apiResponse = $apiResponse['response']['docker'];
} else {
$apiResponse = $apiResponse['code'] .': '. $apiResponse['error'];
}
$apiResponse = $apiResponse['code'] == 200 ? $apiResponse['response']['docker'] : $apiResponse['code'] .': '. $apiResponse['error'];

?>
<h4><?= $serverData['name'] ?></h4>
Expand Down
6 changes: 3 additions & 3 deletions root/app/www/public/ajax/compose.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
container_name: dockwatch
image: ghcr.io/notifiarr/dockwatch:main
ports:
- 9999:80/tcp
- ' . APP_PORT . ':80/tcp
environment:
- PGID=999
- TZ=America/New_York
Expand All @@ -35,7 +35,7 @@
closedir($dir);

if ($_POST['m'] == 'init') {
if ($_SESSION['serverIndex'] != 0) {
if ($_SESSION['activeServerId'] != APP_SERVER_ID) {
echo 'Remote compose management is not supported. Please do that on the Dockwatch instance directly.';
} else {
?>
Expand Down Expand Up @@ -176,4 +176,4 @@
} else {
echo $up;
}
}
}
314 changes: 182 additions & 132 deletions root/app/www/public/ajax/containers.php

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions root/app/www/public/ajax/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

require 'shared.php';

if ($_POST['m'] == 'resetSession') {
session_unset();
session_destroy();
}

if ($_POST['m'] == 'login') {
logger(SYSTEM_LOG, 'login ->');

Expand Down
Loading

0 comments on commit 877e0a8

Please sign in to comment.