fix: nil pointer 保护视频源和集成服务模板

This commit is contained in:
tian 2026-07-24 10:33:52 +08:00
parent c2ba769be4
commit 139d668b77
3 changed files with 13 additions and 5 deletions

View File

@ -39,12 +39,12 @@
</div>
<div class="actions compact">
<a class="btn secondary" href="/assets/integrations?new=1">{{icon "apply"}}<span>新增服务</span></a>
{{if .AssetIntegration.Name}}
{{if .AssetIntegration}}{{if .AssetIntegration.Name}}
<a class="btn secondary" href="/assets/integrations?name={{.AssetIntegration.Name}}&edit=1">{{icon "edit"}}<span>编辑</span></a>
<form method="post" action="/assets/integrations/{{.AssetIntegration.Name}}/delete">
<button class="btn secondary" type="submit">删除</button>
</form>
{{end}}
{{end}}{{end}}
</div>
</div>
<div class="table-wrap">
@ -186,12 +186,12 @@ toggleIntegrationFields('{{.AssetIntegration.Type}}');
<a class="btn secondary" href="/assets/video-sources/template" title="下载 CSV 模板">{{icon "apply"}}<span>模板下载</span></a>
<button class="btn secondary" type="button" onclick="document.getElementById('csv-import-input').click()">{{icon "apply"}}<span>CSV 导入</span></button>
<a class="btn secondary" href="/assets/video-sources?new=1">{{icon "apply"}}<span>新增视频源</span></a>
{{if .AssetVideoSource.Name}}
{{if .AssetVideoSource}}{{if .AssetVideoSource.Name}}
<a class="btn secondary" href="/assets/video-sources?name={{.AssetVideoSource.Name}}&edit=1">{{icon "edit"}}<span>编辑</span></a>
<form method="post" action="/assets/video-sources/{{.AssetVideoSource.Name}}/delete">
<button class="btn secondary" type="submit">删除</button>
</form>
{{end}}
{{end}}{{end}}
</div>
<form id="csv-import-form" method="post" action="/assets/video-sources/import" enctype="multipart/form-data" style="display:none">
<input type="file" id="csv-import-input" name="file" accept=".csv" onchange="this.form.submit()">
@ -212,7 +212,7 @@ toggleIntegrationFields('{{.AssetIntegration.Type}}');
</thead>
<tbody>
{{range .AssetVideoSources}}
<tr data-nav-row data-nav-href="/assets/video-sources?name={{.Name}}"{{if and $.AssetVideoSource (eq $.AssetVideoSource.Name .Name)}} class="selected"{{end}}>
<tr data-nav-row data-nav-href="/assets/video-sources?name={{.Name}}"{{if $.AssetVideoSource}}{{if eq $.AssetVideoSource.Name .Name}} class="selected"{{end}}{{end}}>
<td><a class="mono" href="/assets/video-sources?name={{.Name}}">{{.Name}}</a></td>
<td>{{.SourceTypeLabel}}</td>
<td>{{if .Area}}{{.Area}}{{else}}-{{end}}</td>

Binary file not shown.

8
scripts/build.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# 快速编译 Linux ARM64 二进制(仅编译,不打包)
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_DIR"
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o safesightd-linux-arm64 ./cmd/safesightd/
echo "$(ls -lh safesightd-linux-arm64 | awk '{print $5,$NF}')"