初始提交:短剧库源码(含转码优化 ultrafast)

This commit is contained in:
yvan
2026-09-17 19:09:08 +08:00
commit 07dc0f1059
247 changed files with 43242 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
package app
import (
"context"
"net/http"
"strings"
)
func (account accountRecord) onlineOnly() bool {
return account.OnlineOnly && !account.Admin
}
func downloadAllowed(ctx context.Context) bool {
scope := sourceScope(ctx)
return scope == nil || !scope.OnlineOnly
}
func accountDownloadPath(path string) bool {
if strings.HasPrefix(path, "/api/ui/tasks/") {
return true
}
switch path {
case "/api/ui/download", "/api/ui/tasks", "/api/ui/update", "/api/ui/merge", "/api/emby/export":
return true
}
return false
}
func requireDownload(writer http.ResponseWriter, request *http.Request) bool {
if downloadAllowed(request.Context()) {
return true
}
writeViewerError(writer, http.StatusForbidden, "download_forbidden", "当前账号仅可在线观看,请联系管理员开通下载权限")
return false
}