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 - Fill these values out as you see fit. If you are familiar with RSS
these should be straight forward :) 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
[![Stargazers over time](https://starcharts.herokuapp.com/prologic/tube.svg)](https://starcharts.herokuapp.com/prologic/tube) [![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 { ctx := &struct {
Sort string Sort string
Quality string Quality string
Config *Config
Playing *media.Video Playing *media.Video
Playlist media.Playlist Playlist media.Playlist
}{ }{
Sort: sort, Sort: sort,
Quality: quality, Quality: quality,
Config: a.Config,
Playing: &media.Video{ID: ""}, Playing: &media.Video{ID: ""},
Playlist: a.Library.Playlist(), Playlist: a.Library.Playlist(),
} }
@ -204,8 +206,12 @@ func (a *App) indexHandler(w http.ResponseWriter, r *http.Request) {
// HTTP handler for /upload // HTTP handler for /upload
func (a *App) uploadHandler(w http.ResponseWriter, r *http.Request) { func (a *App) uploadHandler(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" { if r.Method == "GET" {
ctx := map[string]interface{}{ ctx := &struct {
"MAX_UPLOAD_SIZE": a.Config.Server.MaxUploadSize, Config *Config
Playing *media.Video
}{
Config: a.Config,
Playing: &media.Video{ID: ""},
} }
a.render("upload", w, ctx) a.render("upload", w, ctx)
} else if r.Method == "POST" { } else if r.Method == "POST" {
@ -566,11 +572,13 @@ func (a *App) pageHandler(w http.ResponseWriter, r *http.Request) {
ctx := &struct { ctx := &struct {
Sort string Sort string
Quality string Quality string
Config *Config
Playing *media.Video Playing *media.Video
Playlist media.Playlist Playlist media.Playlist
}{ }{
Sort: sort, Sort: sort,
Quality: quality, Quality: quality,
Config: a.Config,
Playing: &media.Video{ID: ""}, Playing: &media.Video{ID: ""},
Playlist: a.Library.Playlist(), Playlist: a.Library.Playlist(),
} }
@ -621,11 +629,13 @@ func (a *App) pageHandler(w http.ResponseWriter, r *http.Request) {
ctx := &struct { ctx := &struct {
Sort string Sort string
Quality string Quality string
Config *Config
Playing *media.Video Playing *media.Video
Playlist media.Playlist Playlist media.Playlist
}{ }{
Sort: sort, Sort: sort,
Quality: quality, Quality: quality,
Config: a.Config,
Playing: playing, Playing: playing,
Playlist: playlist, Playlist: playlist,
} }

View file

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

View file

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

View file

@ -1,5 +1,6 @@
{{define "base"}} {{define "base"}}
{{ $playing := .Playing }} {{ $playing := .Playing }}
{{ $config := .Config }}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" prefix="og: https://ogp.me/ns#"> <html lang="en" prefix="og: https://ogp.me/ns#">
<head> <head>
@ -37,7 +38,7 @@
</main> </main>
<footer> <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><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> </footer>
</body> </body>
{{ template "scripts" . }} {{ template "scripts" . }}

View file

@ -36,6 +36,6 @@
</div> </div>
{{end}} {{end}}
{{define "scripts"}} {{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> <script type="application/javascript" src="/static/upload.js"></script>
{{end}} {{end}}