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
Add a cron timer for the state cron
Fix the dialogClose function
Fix backups not being removed
Some rewording
  • Loading branch information
austinwbest committed Sep 13, 2024
1 parent c091e4c commit cd50466
Show file tree
Hide file tree
Showing 69 changed files with 3,091 additions and 1,517 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
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ RUN \
# install sockets
RUN apk add --no-cache \
php82-sockets

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

# add regctl for container digest checks
ARG TARGETARCH
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ Dockwatch has basic functionality for protecting the UI with a username and pass
UI

![image](https://github.com/Notifiarr/dockwatch/assets/8321115/87fc88d0-3430-43ba-a636-9c89992c7f59)
![image](https://github.com/Notifiarr/dockwatch/assets/8321115/d338a736-1c1b-4fa5-ac9e-6d5ab6f885ff)
![image](https://github.com/user-attachments/assets/37eec4ee-364b-4cdc-806b-e08938f96af0)
![image](https://github.com/Notifiarr/dockwatch/assets/8321115/6e41ca48-1347-4a7f-8a2a-5e5c5020bf41)
![image](https://github.com/Notifiarr/dockwatch/assets/8321115/9d4fc121-c457-4b85-981d-7c615c037946)
![image](https://github.com/user-attachments/assets/dafd2368-2a7f-46a2-9f65-49c23e3757c3)
![image](https://github.com/Notifiarr/dockwatch/assets/8321115/2257d9bf-a9a8-46e3-8712-f3cb2c037199)
![image](https://github.com/Notifiarr/dockwatch/assets/8321115/0c5c64b1-ea87-4269-b9fc-d91744c7219d)
![image](https://github.com/Notifiarr/dockwatch/assets/8321115/952d424a-f171-4366-8f2e-f673618e8e51)
Expand Down
30 changes: 14 additions & 16 deletions root/app/www/public/ajax/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<div class="col-sm-12 mb-2">
<select class="form-select" id="command">
<optgroup label="docker">
<option value="dockerInspect">inspect {container}</option>
<option value="dockerNetworks">network {params}</option>
<option value="dockerPort">port {container}</option>
<option value="dockerProcessList">ps</option>
<option value="docker-inspect">inspect {container}</option>
<option value="docker-networks">network {params}</option>
<option value="docker-port">port {container}</option>
<option value="docker-processList">ps</option>
</optgroup>
</select>
</div>
Expand All @@ -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,21 +72,19 @@
$servers = explode(',', $_POST['servers']);
$params = $_POST['params'];

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

if ($apiResponse['code'] == 200) {
$apiResponse = $apiResponse['response']['docker'];
} else {
$apiResponse = $apiResponse['code'] .': '. $apiResponse['error'];
}
$apiResponse = apiRequest($_POST['command'], ['name' => $_POST['container'], 'params' => $_POST['parameters']]);
$apiResponse = $apiResponse['code'] == 200 ? $apiResponse['result'] : $apiResponse['code'] . ': ' . $apiResponse['error'];

?>
<h4><?= $serverData['name'] ?></h4>
<h4 class="d-inline-block"><?= $serverData['name'] ?></h4> <span class="small-text d-inline-block"><?= $serverData['url'] ?></span>
<pre style="max-height: 500px; overflow: auto;"><?= htmlspecialchars($apiResponse) ?></pre>
<?php
}
}

apiSetActiveServer(APP_SERVER_ID, $serversTable);
}
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;
}
}
}
Loading

0 comments on commit cd50466

Please sign in to comment.