Skip to content

Commit 064e731

Browse files
committed
v0.9.2
1 parent 7414bf2 commit 064e731

24 files changed

Lines changed: 411 additions & 68 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ body:
1717
attributes:
1818
label: ChannelWatch version
1919
description: Run `docker inspect coderluii/channelwatch:latest | grep -i version` or check the UI footer.
20-
placeholder: "e.g. 0.9.1"
20+
placeholder: "e.g. 0.9.2"
2121
validations:
2222
required: true
2323

.github/ISSUE_TEMPLATE/question.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ body:
2323
id: cw_version
2424
attributes:
2525
label: ChannelWatch version
26-
placeholder: "e.g. 0.9.1"
26+
placeholder: "e.g. 0.9.2"
2727
validations:
2828
required: true
2929

.github/workflows/docker-publish.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,58 @@ jobs:
137137
password: ${{ secrets.DOCKERHUB_TOKEN }}
138138
repository: ${{ env.DOCKERHUB_IMAGE }}
139139
readme-filepath: docs/dockerhub-description.md
140+
141+
sync-site:
142+
name: Sync website release metadata
143+
runs-on: ubuntu-latest
144+
needs:
145+
- build-and-push
146+
- update-dockerhub-description
147+
if: startsWith(github.ref, 'refs/tags/v')
148+
permissions:
149+
contents: read
150+
151+
steps:
152+
- name: Parse version
153+
id: version
154+
shell: bash
155+
run: |
156+
raw="${GITHUB_REF_NAME}"
157+
version="${raw#v}"
158+
echo "version=${version}" >> "${GITHUB_OUTPUT}"
159+
160+
- name: Dispatch website sync
161+
env:
162+
GH_TOKEN: ${{ secrets.SITE_SYNC_TOKEN }}
163+
VERSION: ${{ steps.version.outputs.version }}
164+
TAG: ${{ github.ref_name }}
165+
SOURCE_SHA: ${{ github.sha }}
166+
SOURCE_REPO: ${{ github.repository }}
167+
shell: bash
168+
run: |
169+
if [ -z "${GH_TOKEN}" ]; then
170+
echo "::error::SITE_SYNC_TOKEN is required to dispatch the website sync workflow."
171+
exit 1
172+
fi
173+
174+
jq -n \
175+
--arg version "${VERSION}" \
176+
--arg tag "${TAG}" \
177+
--arg sha "${SOURCE_SHA}" \
178+
--arg release_url "https://github.com/CoderLuii/ChannelWatch/releases/tag/${TAG}" \
179+
--arg source_repo "${SOURCE_REPO}" \
180+
'{
181+
event_type: "channelwatch-release",
182+
client_payload: {
183+
version: $version,
184+
tag: $tag,
185+
sha: $sha,
186+
release_url: $release_url,
187+
source_repo: $source_repo
188+
}
189+
}' > site-sync-dispatch.json
190+
191+
gh api \
192+
--method POST \
193+
repos/CoderLuii/ChannelWatch-site/dispatches \
194+
--input site-sync-dispatch.json

app/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
ChannelWatch - Channels DVR monitoring tool for real-time notifications.
33
"""
44

5-
__version__ = "0.9.1"
5+
__version__ = "0.9.2"
66
__app_name__ = "ChannelWatch"

app/core/tests/test_metrics_and_probes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _mock_system_info(dvr_status=None):
5656
from ui.backend.main import SystemInfo, DVRStatus
5757

5858
return SystemInfo(
59-
channelwatch_version="0.9.1",
59+
channelwatch_version="0.9.2",
6060
channels_dvr_host="192.168.1.10",
6161
channels_dvr_port=8089,
6262
channels_dvr_server_version=None,

app/ui/__tests__/disk-space-card.test.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,51 @@ import { renderToStaticMarkup } from "react-dom/server"
33
import { describe, expect, it } from "vitest"
44

55
import { DiskSpaceCard, type DiskSpaceState } from "@/components/dashboard/disk-space-card"
6+
import { formatDiskSizeFromGB } from "@/lib/utils"
67

78
const baseDiskSpace: DiskSpaceState = {
89
usedPercent: 20,
910
freePercent: 80,
1011
loading: false,
1112
error: null,
12-
totalTB: "1.00",
13-
usedTB: "0.20",
14-
freeGB: "819.2",
13+
totalFormatted: "1.00 TB",
14+
usedFormatted: "204.8 GB",
15+
freeFormatted: "819.2 GB",
1516
libraryShows: 0,
1617
libraryMovies: 0,
1718
libraryEpisodes: 0,
1819
}
1920

21+
describe("formatDiskSizeFromGB", () => {
22+
it("keeps dashboard values below 1024 GB in GB", () => {
23+
expect(formatDiskSizeFromGB(819.2)).toBe("819.2 GB")
24+
})
25+
26+
it("formats dashboard values at or above 1024 GB in TB", () => {
27+
expect(formatDiskSizeFromGB(11202.56)).toBe("10.94 TB")
28+
expect(formatDiskSizeFromGB(1024)).toBe("1.00 TB")
29+
})
30+
})
31+
2032
describe("DiskSpaceCard server severity", () => {
33+
it("renders TB free values without appending a hardcoded GB unit", () => {
34+
const html = renderToStaticMarkup(
35+
React.createElement(DiskSpaceCard, {
36+
diskSpace: {
37+
...baseDiskSpace,
38+
totalFormatted: "18.03 TB",
39+
usedFormatted: "7.09 TB",
40+
freeFormatted: "10.94 TB",
41+
},
42+
loading: false,
43+
hasError: false,
44+
}),
45+
)
46+
47+
expect(html).toContain("10.94 TB Free")
48+
expect(html).not.toContain("10.94 TB GB Free")
49+
})
50+
2151
it("renders backend warning severity even when local percentage is normal", () => {
2252
const html = renderToStaticMarkup(
2353
React.createElement(DiskSpaceCard, {

app/ui/__tests__/status-panel.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const baseProps = {
3333
activeProviderNames: ["Discord"],
3434
activeAlertTypes: ["Channel Watching"],
3535
coreProcessStatus: "Running",
36-
channelwatchVersion: "0.9.1",
36+
channelwatchVersion: "0.9.2",
3737
currentSettings: baseSettings,
3838
onNavigate: vi.fn(),
3939
}

app/ui/components/dashboard/disk-space-card.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export interface DiskSpaceState {
1111
freePercent: number
1212
loading: boolean
1313
error: string | null
14-
totalTB: string
15-
usedTB: string
16-
freeGB: string
14+
totalFormatted: string
15+
usedFormatted: string
16+
freeFormatted: string
1717
libraryShows: number
1818
libraryMovies: number
1919
libraryEpisodes: number
@@ -126,10 +126,10 @@ export function DiskSpaceCard({
126126
<div className="text-sm text-red-700 dark:text-red-400">{diskSpace.error}</div>
127127
) : (
128128
<>
129-
<div className={`text-3xl font-bold ${colors.heading}`}>{t("disk.gbFree", { value: diskSpace.freeGB })}</div>
129+
<div className={`text-3xl font-bold ${colors.heading}`}>{t("disk.free", { value: diskSpace.freeFormatted })}</div>
130130
<div className="flex justify-between text-xs mt-0.5">
131-
<span className={colors.sub}>{t("disk.tbUsed", { value: diskSpace.usedTB })}</span>
132-
<span className={colors.sub}>{t("disk.tbTotal", { value: diskSpace.totalTB })}</span>
131+
<span className={colors.sub}>{t("disk.used", { value: diskSpace.usedFormatted })}</span>
132+
<span className={colors.sub}>{t("disk.total", { value: diskSpace.totalFormatted })}</span>
133133
</div>
134134
<Progress
135135
value={diskSpace.usedPercent}

app/ui/components/diagnostics-panel.tsx

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
downloadDebugBundle,
4545
} from "@/lib/api";
4646
import { t } from "@/lib/i18n";
47+
import { formatDiskSizeFromGB } from "@/lib/utils";
4748
import { useToast } from "@/hooks/use-toast";
4849
import { useDvrSelection } from "@/lib/dvr-selection-context";
4950
import type { SystemInfo, AppSettings, DVRStatusInfo } from "@/lib/types";
@@ -444,11 +445,7 @@ export function DiagnosticsPanel() {
444445
return t("diagnostics.system.na");
445446
}
446447

447-
if (sizeInGB >= 1000) {
448-
return (sizeInGB / 1000).toFixed(2) + " TB";
449-
} else {
450-
return Math.round(sizeInGB) + " GB";
451-
}
448+
return formatDiskSizeFromGB(sizeInGB, { gbDecimals: 0 });
452449
};
453450

454451
const calculateDiskUsage = () => {
@@ -459,9 +456,9 @@ export function DiagnosticsPanel() {
459456
) {
460457
return {
461458
usedGB: null,
462-
usedTB: t("diagnostics.system.na"),
459+
usedFormatted: t("diagnostics.system.na"),
463460
totalGB: null,
464-
totalTB: t("diagnostics.system.na"),
461+
totalFormatted: t("diagnostics.system.na"),
465462
freeGB: null,
466463
};
467464
}
@@ -470,17 +467,11 @@ export function DiagnosticsPanel() {
470467
const freeGB = systemInfo.disk_free_gb;
471468
const usedGB = totalGB - freeGB;
472469

473-
const totalTB = (totalGB / 1000).toFixed(2);
474-
const usedTB = (usedGB / 1000).toFixed(2);
475-
476-
const totalTBFormatted = `${totalTB} TB`;
477-
const usedTBFormatted = `${usedTB} TB`;
478-
479470
return {
480471
usedGB,
481-
usedTB: usedTBFormatted,
472+
usedFormatted: formatDiskSize(usedGB),
482473
totalGB,
483-
totalTB: totalTBFormatted,
474+
totalFormatted: formatDiskSize(totalGB),
484475
freeGB,
485476
usedPercent: systemInfo.disk_usage_percent,
486477
};
@@ -633,8 +624,8 @@ export function DiagnosticsPanel() {
633624
value:
634625
diskInfo.usedGB != null
635626
? t("diagnostics.export.usedOf", {
636-
used: formatDiskSize(diskInfo.usedGB),
637-
total: String(diskInfo.totalTB),
627+
used: diskInfo.usedFormatted,
628+
total: diskInfo.totalFormatted,
638629
percent: String(diskInfo.usedPercent),
639630
})
640631
: t("diagnostics.system.na"),
@@ -1149,8 +1140,8 @@ export function DiagnosticsPanel() {
11491140
{t("diagnostics.system.usedKey")}
11501141
</span>
11511142
<span>
1152-
{diskInfo.usedGB
1153-
? formatDiskSize(diskInfo.usedGB)
1143+
{diskInfo.usedGB != null
1144+
? diskInfo.usedFormatted
11541145
: t("diagnostics.system.na")}
11551146
</span>
11561147
</div>
@@ -1159,7 +1150,7 @@ export function DiagnosticsPanel() {
11591150
{t("diagnostics.system.freeKey")}
11601151
</span>
11611152
<span>
1162-
{diskInfo.freeGB
1153+
{diskInfo.freeGB != null
11631154
? formatDiskSize(diskInfo.freeGB)
11641155
: t("diagnostics.system.na")}
11651156
</span>
@@ -1168,7 +1159,7 @@ export function DiagnosticsPanel() {
11681159
<span className="text-muted-foreground">
11691160
{t("diagnostics.system.totalKey")}
11701161
</span>
1171-
<span>{diskInfo.totalTB}</span>
1162+
<span>{diskInfo.totalFormatted}</span>
11721163
</div>
11731164
{systemInfo.disk_usage_percent != null && (
11741165
<Progress

app/ui/components/status-overview.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
import { useDvrSelection } from "@/lib/dvr-selection-context";
1818
import { t } from "@/lib/i18n";
1919
import type { ActivityItem } from "@/lib/types";
20+
import { formatDiskSizeFromGB } from "@/lib/utils";
2021
import { MetricCard } from "@/components/dashboard/metric-card";
2122
import { UptimeCard } from "@/components/dashboard/uptime-card";
2223
import {
@@ -63,9 +64,9 @@ export function StatusOverview({ settings, onNavigate }: StatusOverviewProps) {
6364
freePercent: 0,
6465
loading: true,
6566
error: null,
66-
totalTB: "",
67-
usedTB: "",
68-
freeGB: "",
67+
totalFormatted: "",
68+
usedFormatted: "",
69+
freeFormatted: "",
6970
libraryShows: 0,
7071
libraryMovies: 0,
7172
libraryEpisodes: 0,
@@ -130,21 +131,17 @@ export function StatusOverview({ settings, onNavigate }: StatusOverviewProps) {
130131
const usedGB = totalGB - freeGB;
131132
const usedPercent = diskUsagePercent;
132133
const freePercent = 100 - usedPercent;
133-
const totalTB = (totalGB / 1024).toFixed(2);
134-
const usedTB = (usedGB / 1024).toFixed(2);
135-
const freeGBFormatted =
136-
freeGB < 1024 ? freeGB.toFixed(1) : (freeGB / 1024).toFixed(2);
137134
setDiskSpace({
138135
usedPercent,
139136
freePercent,
140137
loading: false,
141138
error: null,
142-
totalTB,
143-
freeGB: freeGBFormatted,
139+
totalFormatted: formatDiskSizeFromGB(totalGB),
140+
freeFormatted: formatDiskSizeFromGB(freeGB),
144141
libraryShows: libShows,
145142
libraryMovies: libMovies,
146143
libraryEpisodes: libEpisodes,
147-
usedTB,
144+
usedFormatted: formatDiskSizeFromGB(usedGB),
148145
});
149146
} else {
150147
setDiskSpace((prev: DiskSpaceState) => ({

0 commit comments

Comments
 (0)