Compare commits

...

13 Commits

Author SHA1 Message Date
seriousm4x bf336a2da5 pnpm lock 2023-12-22 10:35:01 +01:00
seriousm4x 978d81abc7 fix: date-fns imports 2023-12-22 10:34:26 +01:00
dependabot[bot] 9cf32927fe npm-dep: bump date-fns from 3.0.4 to 3.0.6 in /frontend
Bumps [date-fns](https://github.com/date-fns/date-fns) from 3.0.4 to 3.0.6.
- [Release notes](https://github.com/date-fns/date-fns/releases)
- [Changelog](https://github.com/date-fns/date-fns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/date-fns/date-fns/compare/v3.0.4...v3.0.6)

---
updated-dependencies:
- dependency-name: date-fns
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 09:08:22 +00:00
seriousm4x d53c4699ba feat: add custom clickable links to ports #374 #222 2023-12-22 09:58:49 +01:00
seriousm4x 976e808d75 feat: add ping privileged env UPSNAP_PING_PRIVILEGED #207 2023-12-22 09:30:39 +01:00
seriousm4x 7bba99fc01 add UPSNAP_SCAN_TIMEOUT to docker-compose example 2023-12-22 09:22:43 +01:00
seriousm4x 30c074930c feat: add custom scan timeout env UPSNAP_SCAN_TIMEOUT #193 2023-12-22 09:14:39 +01:00
dependabot[bot] cb05d37bdb npm-dep: bump daisyui from 4.4.22 to 4.4.23 in /frontend
Bumps [daisyui](https://github.com/saadeghi/daisyui) from 4.4.22 to 4.4.23.
- [Release notes](https://github.com/saadeghi/daisyui/releases)
- [Changelog](https://github.com/saadeghi/daisyui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/saadeghi/daisyui/compare/v4.4.22...v4.4.23)

---
updated-dependencies:
- dependency-name: daisyui
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 10:04:39 +00:00
dependabot[bot] 5e644a5104 npm-dep: bump date-fns from 3.0.1 to 3.0.4 in /frontend
Bumps [date-fns](https://github.com/date-fns/date-fns) from 3.0.1 to 3.0.4.
- [Release notes](https://github.com/date-fns/date-fns/releases)
- [Changelog](https://github.com/date-fns/date-fns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/date-fns/date-fns/compare/v3.0.1...v3.0.4)

---
updated-dependencies:
- dependency-name: date-fns
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 10:04:31 +00:00
dependabot[bot] eb1c50f2ef npm-dep: bump tailwindcss from 3.3.7 to 3.4.0 in /frontend
Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 3.3.7 to 3.4.0.
- [Release notes](https://github.com/tailwindlabs/tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/tailwindcss/compare/v3.3.7...v3.4.0)

---
updated-dependencies:
- dependency-name: tailwindcss
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-20 09:31:20 +00:00
dependabot[bot] 9ff4b4212f npm-dep: bump date-fns from 3.0.0 to 3.0.1 in /frontend
Bumps [date-fns](https://github.com/date-fns/date-fns) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/date-fns/date-fns/releases)
- [Changelog](https://github.com/date-fns/date-fns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/date-fns/date-fns/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: date-fns
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-20 09:30:37 +00:00
dependabot[bot] 1b2042b6ee npm-dep: bump daisyui from 4.4.20 to 4.4.22 in /frontend
Bumps [daisyui](https://github.com/saadeghi/daisyui) from 4.4.20 to 4.4.22.
- [Release notes](https://github.com/saadeghi/daisyui/releases)
- [Changelog](https://github.com/saadeghi/daisyui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/saadeghi/daisyui/compare/v4.4.20...v4.4.22)

---
updated-dependencies:
- dependency-name: daisyui
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-20 09:29:00 +00:00
dependabot[bot] 702dc541ed npm-dep: bump date-fns from 2.30.0 to 3.0.0 in /frontend
Bumps [date-fns](https://github.com/date-fns/date-fns) from 2.30.0 to 3.0.0.
- [Release notes](https://github.com/date-fns/date-fns/releases)
- [Changelog](https://github.com/date-fns/date-fns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/date-fns/date-fns/compare/v2.30.0...v3.0.0)

---
updated-dependencies:
- dependency-name: date-fns
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 09:28:00 +00:00
10 changed files with 122 additions and 51 deletions
@@ -0,0 +1,52 @@
package migrations
import (
"encoding/json"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
m "github.com/pocketbase/pocketbase/migrations"
"github.com/pocketbase/pocketbase/models/schema"
)
func init() {
m.Register(func(db dbx.Builder) error {
dao := daos.New(db);
collection, err := dao.FindCollectionByNameOrId("cti4l8f4mz8df3r")
if err != nil {
return err
}
// add
new_link := &schema.SchemaField{}
json.Unmarshal([]byte(`{
"system": false,
"id": "i3uvw7ij",
"name": "link",
"type": "url",
"required": false,
"presentable": false,
"unique": false,
"options": {
"exceptDomains": null,
"onlyDomains": null
}
}`), new_link)
collection.Schema.AddField(new_link)
return dao.SaveCollection(collection)
}, func(db dbx.Builder) error {
dao := daos.New(db);
collection, err := dao.FindCollectionByNameOrId("cti4l8f4mz8df3r")
if err != nil {
return err
}
// remove
collection.Schema.RemoveField("i3uvw7ij")
return dao.SaveCollection(collection)
})
}
+7 -1
View File
@@ -2,8 +2,10 @@ package networking
import (
"net"
"os"
"os/exec"
"runtime"
"strconv"
"time"
"github.com/pocketbase/pocketbase/models"
@@ -21,7 +23,11 @@ func PingDevice(device *models.Record) bool {
}
pinger.Count = 1
pinger.Timeout = 500 * time.Millisecond
pinger.SetPrivileged(true)
privileged, err := strconv.ParseBool(os.Getenv("UPSNAP_PING_PRIVILEGED"))
if err != nil {
privileged = true
}
pinger.SetPrivileged(privileged)
err = pinger.Run()
if err != nil {
logger.Error.Println(err)
+6 -1
View File
@@ -4,6 +4,7 @@ import (
"encoding/xml"
"net"
"net/http"
"os"
"os/exec"
"strconv"
"strings"
@@ -146,7 +147,11 @@ func HandlerScan(c echo.Context) error {
}
// run nmap
cmd := exec.Command(nmap, "-sn", "-oX", "-", scanRange, "--host-timeout", "500ms")
timeout := os.Getenv("UPSNAP_SCAN_TIMEOUT")
if timeout == "" {
timeout = "500ms"
}
cmd := exec.Command(nmap, "-sn", "-oX", "-", scanRange, "--host-timeout", timeout)
cmdOutput, err := cmd.Output()
if err != nil {
return err
+8 -6
View File
@@ -7,12 +7,14 @@ services:
restart: unless-stopped
volumes:
- ./data:/app/pb_data
# # To use a non-root user, create the mountpoint first (mkdir data) so that it has the right permission.
# user: 1000:1000
# environment:
# - TZ=Europe/Berlin # Set container timezone for cron schedules
# - UPSNAP_INTERVAL=@every 10s # Sets the interval in which the devices are pinged
# - UPSNAP_SCAN_RANGE=192.168.1.0/24 # Scan range is used for device discovery on local network
# # To use a non-root user, create the mountpoint first (mkdir data) so that it has the right permission.
# user: 1000:1000
# environment:
# - TZ=Europe/Berlin # Set container timezone for cron schedules
# - UPSNAP_INTERVAL=@every 10s # Sets the interval in which the devices are pinged
# - UPSNAP_SCAN_RANGE=192.168.1.0/24 # Scan range is used for device discovery on local network
# - UPSNAP_SCAN_TIMEOUT=500ms # Scan timeout is nmap's --host-timeout value to wait for devices (https://nmap.org/book/man-performance.html)
# - UPSNAP_PING_PRIVILEGED=true # Set to false if you don't have root user permissions
# - UPSNAP_WEBSITE_TITLE=Custom name # Custom website title
# # dns is used for name resolution during network scan
# dns:
+3 -3
View File
@@ -20,7 +20,7 @@
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"autoprefixer": "^10.4.16",
"daisyui": "^4.4.20",
"daisyui": "^4.4.23",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
@@ -30,7 +30,7 @@
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"tailwindcss": "^3.3.7",
"tailwindcss": "^3.4.0",
"tslib": "^2.6.2",
"typescript": "^5.3.3",
"vite": "^4.5.1"
@@ -42,7 +42,7 @@
},
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"date-fns": "^2.30.0",
"date-fns": "^3.0.6",
"npm-run-all": "^4.1.5",
"pocketbase": "^0.20.1",
"svelte-fa": "^3.0.4",
+12 -32
View File
@@ -9,8 +9,8 @@ dependencies:
specifier: ^6.5.1
version: 6.5.1
date-fns:
specifier: ^2.30.0
version: 2.30.0
specifier: ^3.0.6
version: 3.0.6
npm-run-all:
specifier: ^4.1.5
version: 4.1.5
@@ -47,8 +47,8 @@ devDependencies:
specifier: ^10.4.16
version: 10.4.16(postcss@8.4.32)
daisyui:
specifier: ^4.4.20
version: 4.4.20(postcss@8.4.32)
specifier: ^4.4.23
version: 4.4.23(postcss@8.4.32)
eslint:
specifier: ^8.56.0
version: 8.56.0
@@ -77,8 +77,8 @@ devDependencies:
specifier: ^3.6.2
version: 3.6.2(postcss@8.4.32)(svelte@4.2.8)
tailwindcss:
specifier: ^3.3.7
version: 3.3.7
specifier: ^3.4.0
version: 3.4.0
tslib:
specifier: ^2.6.2
version: 2.6.2
@@ -116,16 +116,6 @@ packages:
'@jridgewell/gen-mapping': 0.3.3
'@jridgewell/trace-mapping': 0.3.20
/@babel/runtime@7.23.6:
resolution:
{
integrity: sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==
}
engines: { node: '>=6.9.0' }
dependencies:
regenerator-runtime: 0.14.1
dev: false
/@esbuild/android-arm64@0.18.20:
resolution:
{
@@ -1280,10 +1270,10 @@ packages:
engines: { node: ^12.20.0 || ^14.13.1 || >=16.0.0 }
dev: true
/daisyui@4.4.20(postcss@8.4.32):
/daisyui@4.4.23(postcss@8.4.32):
resolution:
{
integrity: sha512-AR2fuFVVLHVTdbkV+XWAqjtymEoxXksrsEMkdzPQo2wANtWjSXuODUzePNade64gJ0Y2CdQtiQkaZI7fWcp13g==
integrity: sha512-IFQRGoGoAke8chxPcDqQJFldVVd51JL7b4mRA3LqsLexW/6xicZzz9X3GXdGdnYsu8QPxZN4uzQZ5fwRNYXOSg==
}
engines: { node: '>=16.9.0' }
dependencies:
@@ -1295,14 +1285,11 @@ packages:
- postcss
dev: true
/date-fns@2.30.0:
/date-fns@3.0.6:
resolution:
{
integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==
integrity: sha512-W+G99rycpKMMF2/YD064b2lE7jJGUe+EjOES7Q8BIGY8sbNdbgcs9XFTZwvzc9Jx1f3k7LB7gZaZa7f8Agzljg==
}
engines: { node: '>=0.11' }
dependencies:
'@babel/runtime': 7.23.6
dev: false
/debug@4.3.4:
@@ -3180,13 +3167,6 @@ packages:
picomatch: 2.3.1
dev: true
/regenerator-runtime@0.14.1:
resolution:
{
integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==
}
dev: false
/regexp.prototype.flags@1.5.1:
resolution:
{
@@ -3781,10 +3761,10 @@ packages:
magic-string: 0.30.5
periscopic: 3.1.0
/tailwindcss@3.3.7:
/tailwindcss@3.4.0:
resolution:
{
integrity: sha512-pjgQxDZPvyS/nG3ZYkyCvsbONJl7GdOejfm24iMt2ElYQQw8Jc4p0m8RdMp7mznPD0kUhfzwV3zAwa80qI0zmQ==
integrity: sha512-VigzymniH77knD1dryXbyxR+ePHihHociZbXnLZHUyzf2MMs2ZVqlUrZ3FvpXP8pno9JzmILt1sZPD19M3IxtA==
}
engines: { node: '>=14.0.0' }
hasBin: true
+11 -6
View File
@@ -13,6 +13,11 @@
} from '@fortawesome/free-solid-svg-icons';
import type { Locale } from 'date-fns';
import { formatDistance, parseISO } from 'date-fns';
import { de } from 'date-fns/locale/de';
import { enUS } from 'date-fns/locale/en-US';
import { fr } from 'date-fns/locale/fr';
import { pt } from 'date-fns/locale/pt';
import { zhCN } from 'date-fns/locale/zh-CN';
import Fa from 'svelte-fa';
import toast from 'svelte-french-toast';
import { scale } from 'svelte/transition';
@@ -65,26 +70,26 @@
switch ($locale) {
case 'de':
case 'de-DE':
dateFnsLocale = (await import('date-fns/locale/de/index.js')).default;
dateFnsLocale = de;
break;
case 'en':
case 'en-US':
dateFnsLocale = (await import('date-fns/locale/en-US/index.js')).default;
dateFnsLocale = enUS;
break;
case 'fr':
case 'fr-FR':
dateFnsLocale = (await import('date-fns/locale/fr/index.js')).default;
dateFnsLocale = fr;
break;
case 'pt':
case 'pt-PT':
dateFnsLocale = (await import('date-fns/locale/pt/index.js')).default;
dateFnsLocale = pt;
break;
case 'zh':
case 'zh-CN':
dateFnsLocale = (await import('date-fns/locale/zh-CN/index.js')).default;
dateFnsLocale = zhCN;
break;
default:
dateFnsLocale = (await import('date-fns/locale/en-US/index.js')).default;
dateFnsLocale = enUS;
break;
}
})();
@@ -132,15 +132,23 @@
<div class="grow">
<div class="text-lg font-bold leading-4">{device.ip}</div>
<div>{device.mac}</div>
<div class="flex flex-wrap gap-x-4 gap-y-0">
<div class="flex flex-wrap gap-x-4">
{#if device?.expand?.ports}
{#each device?.expand?.ports.sort((a, b) => a.number - b.number) as port}
<span class="flex items-center gap-1 break-all">
{#if port.status}
<Fa icon={faCircle} class="text-success" />
{port.name} ({port.number})
{:else}
<Fa icon={faCircle} class="text-error" />
{/if}
{#if port.link}
<a
href={port.link}
target="_blank"
class="underline"
on:click={(e) => e.stopPropagation()}>{port.name} ({port.number})</a
>
{:else}
{port.name} ({port.number})
{/if}
</span>
@@ -60,6 +60,18 @@
/>
</div>
</div>
<div>
<label class="label p-0" for="port-link-{index}">
<span class="label-text">{$LL.device.link()}</span>
</label>
<input
id="port-link-{index}"
type="url"
placeholder="https:// ..."
class="input input-sm input-bordered w-full"
bind:value={device.expand.ports[index].link}
/>
</div>
<div class="card-actions justify-end">
<button
class="btn btn-xs btn-outline btn-error"
+1
View File
@@ -34,6 +34,7 @@ export type Device = RecordModel & {
export type Port = RecordModel & {
name: string;
number: number;
link: string;
};
export type Group = RecordModel & {