Compare commits

...

12 Commits

Author SHA1 Message Date
Maxi Quoß 20a3ddea1a v2.0.5 2022-04-30 17:58:27 +02:00
Maxi Quoß 4906ce722b fix key error link when restoring from v1 #17 2022-04-30 17:57:27 +02:00
Maxi Quoß f36be22e46 remove row 2022-04-22 21:24:12 +02:00
Maxi Quoß b1e8eaf864 close div 2022-04-22 21:19:53 +02:00
Maxi Quoß 01afbd1919 v2.0.4 2022-04-22 11:40:57 +02:00
Maxi Quoß 97e0d94d24 add clickable link for devices, close #13 2022-04-21 20:20:33 +02:00
Maxi Quoß 35df2757fd less verbose redis logs 2022-04-21 19:43:37 +02:00
Maxi Quoß ccc53c5349 fix #15 2022-04-21 19:41:59 +02:00
Maxi Quoß 5f1a68ab36 v2.0.3 2022-04-01 22:23:58 +02:00
Maxi Quoß daff99510f use mariadb for arm64 support 2022-04-01 22:18:17 +02:00
Maxi Quoß cff1705a9f npm update 2022-03-28 22:47:39 +02:00
Maxi Quoß d15810d8b2 replace node-sass with sass #11
node-sass is deprecated and doesn't work on arm64 https://sass-lang.com/blog/libsass-is-deprecated
2022-03-28 22:46:27 +02:00
13 changed files with 250 additions and 3804 deletions
+1
View File
@@ -5,5 +5,6 @@ from celery import Celery
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backend.settings")
app = Celery("dango_wol")
app.conf.timezone = os.getenv("DJANGO_TIME_ZONE", "UTC")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()
+1 -1
View File
@@ -174,4 +174,4 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
VERSION = "v2.0.2"
VERSION = "v2.0.5"
+7 -1
View File
@@ -1,7 +1,7 @@
import os
from django.contrib.auth.models import User
from django_celery_beat.models import IntervalSchedule, PeriodicTask
from django_celery_beat.models import IntervalSchedule, PeriodicTask, PeriodicTasks
from wol.models import Settings, Websocket
@@ -43,3 +43,9 @@ if created:
name="Ping all devices",
task="wol.tasks.ping_all_devices"
)
# reset last run to fix time zone changes
# https://django-celery-beat.readthedocs.io/en/latest/#important-warning-about-time-zones
PeriodicTask.objects.update(last_run_at=None)
for task in PeriodicTask.objects.all():
PeriodicTasks.changed(task)
+7 -1
View File
@@ -1,7 +1,9 @@
import ipaddress
import json
import os
import subprocess
import pytz
from channels.db import database_sync_to_async
from channels.generic.websocket import AsyncWebsocketConsumer
from django_celery_beat.models import (CrontabSchedule, IntervalSchedule,
@@ -138,6 +140,7 @@ class WSConsumer(AsyncWebsocketConsumer):
"ip": dev.ip,
"mac": dev.mac,
"netmask": dev.netmask,
"link": dev.link,
"ports": [],
"wake": {
"enabled": False,
@@ -184,6 +187,7 @@ class WSConsumer(AsyncWebsocketConsumer):
"name": data["name"],
"ip": data["ip"],
"netmask": data["netmask"],
"link": data["link"],
"shutdown_cmd": data["shutdown"]["command"] if data.get("shutdown") else ""
}
)
@@ -210,7 +214,8 @@ class WSConsumer(AsyncWebsocketConsumer):
hour=hour,
day_of_week=dow,
day_of_month=dom,
month_of_year=month
month_of_year=month,
timezone = pytz.timezone(os.getenv("DJANGO_TIME_ZONE", "UTC"))
)
PeriodicTask.objects.update_or_create(
name=f"{data['name']}-{action}",
@@ -306,6 +311,7 @@ class WSConsumer(AsyncWebsocketConsumer):
"ip": ip,
"netmask": netmask,
"mac": mac,
"link": "",
"ports": [],
"wake": {
"enabled": False,
+1
View File
@@ -13,6 +13,7 @@ class Device(models.Model):
ip = models.GenericIPAddressField()
mac = models.CharField(max_length=17)
netmask = models.CharField(max_length=15, default="255.255.255.0", blank=False, null=False)
link = models.URLField(blank=True, null=True)
port = models.ManyToManyField(Port, blank=True)
shutdown_cmd = models.TextField(null=True, blank=True)
+1
View File
@@ -37,6 +37,7 @@ class WolDevice:
"mac": dev.mac,
"netmask": dev.netmask,
"up": False,
"link": dev.link,
"ports": [],
"wake": {
"enabled": False,
+202 -3797
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -23,8 +23,8 @@
"@rollup/plugin-replace": "^4.0.0",
"bootstrap": "^5.1.3",
"dotenv": "^16.0.0",
"node-sass": "^7.0.1",
"postcss": "^8.4.6",
"sass": "^1.49.9",
"sirv-cli": "^2.0.0",
"svelte-preprocess": "^4.10.3"
}
+18 -2
View File
@@ -113,7 +113,11 @@
<i class="fa-solid fa-ellipsis-vertical fa-2x"></i>
</div>
</div>
<h5 class="card-title fw-bold my-2">{device.name}</h5>
{#if device.link}
<h5 class="card-title fw-bold my-2"><a class="inherit-color" href={device.link}>{device.name}</a></h5>
{:else}
<h5 class="card-title fw-bold my-2">{device.name}</h5>
{/if}
<h6 class="card-subtitle mb-2 text-muted">{device.ip}</h6>
<ul class="list-group">
{#each device.ports as port}
@@ -149,7 +153,7 @@
<input type="text" class="form-control" id="inputMac{modalDevice.mac}" bind:value="{modalDevice.mac}" required>
</div>
</div>
<div class="row">
<div class="row mb-2">
<div class="col-sm">
<label for="inputIp{modalDevice.id}" class="form-label">IP address</label>
<input type="text" class="form-control" id="inputIp{modalDevice.id}" bind:value="{modalDevice.ip}" pattern="^([01]?\d\d?|2[0-4]\d|25[0-5])(?:\.(?:[01]?\d\d?|2[0-4]\d|25[0-5])){'{'}3{'}'}$" required>
@@ -159,6 +163,14 @@
<input type="text" class="form-control" id="inputNetmask{modalDevice.id}" bind:value="{modalDevice.netmask}" pattern="^(((255\.){'{'}3{'}'}(255|254|252|248|240|224|192|128|0+))|((255\.){'{'}2{'}'}(255|254|252|248|240|224|192|128|0+)\.0)|((255\.)(255|254|252|248|240|224|192|128|0+)(\.0+){'{'}2{'}'})|((255|254|252|248|240|224|192|128|0+)(\.0+){'{'}3{'}'}))$" required>
</div>
</div>
<div class="row">
<div class="col">
<div class="mb-3">
<label for="inputLinkAddDevice" class="form-label">Web link</label>
<input type="text" class="form-control" id="inputILinkAddDevice" placeholder="http://...." bind:value="{modalDevice.link}">
</div>
</div>
</div>
<!-- ports -->
<h5 class="fw-bold mt-4">Ports</h5>
<p class="mb-2">Select ports to check if they are open.</p>
@@ -327,4 +339,8 @@
.list-group-item {
color: var(--color-text);
}
.inherit-color {
color: inherit;
}
</style>
@@ -67,6 +67,7 @@
// v1 file restore
for (const [key, value] of Object.entries(data)) {
value["mac"] = key
value["link"] = ""
updateDevice(value)
}
}
@@ -162,6 +163,12 @@
</div>
</div>
</div>
<div class="col">
<div class="mb-3">
<label for="inputLinkAddDevice" class="form-label">Web link</label>
<input type="text" class="form-control" id="inputILinkAddDevice" placeholder="http://...." bind:value="{addDevice.link}">
</div>
</div>
<div class="row">
<div class="col-auto ms-auto">
<button type="submit" form="addForm" class="btn btn-outline-success">Add device</button>
+2 -1
View File
@@ -34,12 +34,13 @@ services:
ports:
- "6379:6379"
restart: unless-stopped
command: redis-server --loglevel warning
healthcheck:
test: redis-cli ping
interval: 10s
mysql:
container_name: upsnap_mysql
image: mysql
image: mariadb
restart: unless-stopped
ports:
- "3306:3306"
+1
View File
@@ -34,6 +34,7 @@ services:
ports:
- "6379:6379"
restart: unless-stopped
command: redis-server --loglevel warning
healthcheck:
test: redis-cli ping
interval: 10s
+1
View File
@@ -27,6 +27,7 @@ services:
ports:
- "6379:6379"
restart: unless-stopped
command: redis-server --loglevel warning
healthcheck:
test: redis-cli ping
interval: 10s