Remove proprietary notices about video (#40)

* Make content proprietary configurable

* Update README

* Fixed a few template context bugs

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
This commit is contained in:
Srxr 2021-06-08 21:22:14 +08:00 committed by GitHub
parent 7e3d72c24f
commit e743a9a425
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 167 additions and 125 deletions

View file

@ -204,6 +204,14 @@ Set `path` to the value of the path where you want to store videos and where
- Fill these values out as you see fit. If you are familiar with RSS
these should be straight forward :)
### Content Proprietary Notices Configuration
{
"copyright": {
"content": "All Content herein Public Domain and User Contributed."
}
}
## Stargazers over time
[![Stargazers over time](https://starcharts.herokuapp.com/prologic/tube.svg)](https://starcharts.herokuapp.com/prologic/tube)

View file

@ -188,11 +188,13 @@ func (a *App) indexHandler(w http.ResponseWriter, r *http.Request) {
ctx := &struct {
Sort string
Quality string
Config *Config
Playing *media.Video
Playlist media.Playlist
}{
Sort: sort,
Quality: quality,
Config: a.Config,
Playing: &media.Video{ID: ""},
Playlist: a.Library.Playlist(),
}
@ -204,8 +206,12 @@ func (a *App) indexHandler(w http.ResponseWriter, r *http.Request) {
// HTTP handler for /upload
func (a *App) uploadHandler(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
ctx := map[string]interface{}{
"MAX_UPLOAD_SIZE": a.Config.Server.MaxUploadSize,
ctx := &struct {
Config *Config
Playing *media.Video
}{
Config: a.Config,
Playing: &media.Video{ID: ""},
}
a.render("upload", w, ctx)
} else if r.Method == "POST" {
@ -566,11 +572,13 @@ func (a *App) pageHandler(w http.ResponseWriter, r *http.Request) {
ctx := &struct {
Sort string
Quality string
Config *Config
Playing *media.Video
Playlist media.Playlist
}{
Sort: sort,
Quality: quality,
Config: a.Config,
Playing: &media.Video{ID: ""},
Playlist: a.Library.Playlist(),
}
@ -621,11 +629,13 @@ func (a *App) pageHandler(w http.ResponseWriter, r *http.Request) {
ctx := &struct {
Sort string
Quality string
Config *Config
Playing *media.Video
Playlist media.Playlist
}{
Sort: sort,
Quality: quality,
Config: a.Config,
Playing: playing,
Playlist: playlist,
}

View file

@ -12,6 +12,7 @@ type Config struct {
Thumbnailer *ThumbnailerConfig `json:"thumbnailer"`
Transcoder *TranscoderConfig `json:"transcoder"`
Feed *FeedConfig `json:"feed"`
Copyright *Copyright `json:"copyright"`
}
// PathConfig settings for media library path.
@ -56,6 +57,11 @@ type FeedConfig struct {
Copyright string `json:"copyright"`
}
// Copyright text for App.
type Copyright struct {
Content string `json:"content"`
}
// DefaultConfig returns Config initialized with default values.
func DefaultConfig() *Config {
return &Config{
@ -82,6 +88,9 @@ func DefaultConfig() *Config {
Feed: &FeedConfig{
ExternalURL: "http://localhost:8000",
},
Copyright: &Copyright{
Content: "All Content herein Public Domain and User Contributed.",
},
}
}

File diff suppressed because one or more lines are too long

View file

@ -29,5 +29,8 @@
"email": "author@somewhere.example"
},
"copyright": "Copyright Text"
},
"copyright": {
"content": "All Content herein Public Domain and User Contributed."
}
}

View file

@ -237,10 +237,6 @@ main {
float:left;
width:100px;
}
#b_transfered {
float:right;
text-align:right;
}
.clear_both {
clear:both;
}

View file

@ -1,5 +1,6 @@
{{define "base"}}
{{ $playing := .Playing }}
{{ $config := .Config }}
<!DOCTYPE html>
<html lang="en" prefix="og: https://ogp.me/ns#">
<head>
@ -37,7 +38,7 @@
</main>
<footer>
<p><a href="https://github.com/prologic/tube">Tube</a> is CopyRight © 2020 <a href="https://github.com/prologic">James Mills / prologic</a>. All Rights Reserved.</p>
<p>All Content herein Public Domain and User Contributed.</p>
{{if .Config.Copyright.Content}}<p>{{ $config.Copyright.Content }}</p>{{end}}
</footer>
</body>
{{ template "scripts" . }}

View file

@ -36,6 +36,6 @@
</div>
{{end}}
{{define "scripts"}}
<script>window['MAX_UPLOAD_SIZE'] = '{{.MAX_UPLOAD_SIZE}}';</script>
<script>window['MAX_UPLOAD_SIZE'] = '{{.Config.Server.MaxUploadSize}}';</script>
<script type="application/javascript" src="/static/upload.js"></script>
{{end}}