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:
parent
7e3d72c24f
commit
e743a9a425
9 changed files with 167 additions and 125 deletions
|
@ -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)
|
||||
|
|
14
app/app.go
14
app/app.go
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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.",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
133
app/rice-box.go
133
app/rice-box.go
File diff suppressed because one or more lines are too long
|
@ -29,5 +29,8 @@
|
|||
"email": "author@somewhere.example"
|
||||
},
|
||||
"copyright": "Copyright Text"
|
||||
},
|
||||
"copyright": {
|
||||
"content": "All Content herein Public Domain and User Contributed."
|
||||
}
|
||||
}
|
||||
|
|
116
main.go
116
main.go
|
@ -1,58 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/prologic/tube/app"
|
||||
log "github.com/sirupsen/logrus"
|
||||
flag "github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
var (
|
||||
debug bool
|
||||
version bool
|
||||
config string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Usage: %s [options] [file]\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
flag.BoolVarP(&version, "version", "v", false, "display version information")
|
||||
flag.BoolVarP(&debug, "debug", "d", false, "enable debug logging")
|
||||
flag.StringVarP(&config, "config", "c", "config.json", "path to configuration file")
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if debug {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
} else {
|
||||
log.SetLevel(log.InfoLevel)
|
||||
}
|
||||
|
||||
if version {
|
||||
fmt.Printf("tube version %s", FullVersion())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
cfg := app.DefaultConfig()
|
||||
err := cfg.ReadFile(config)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
a, err := app.NewApp(cfg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
addr := fmt.Sprintf("%s:%d", cfg.Server.Host, cfg.Server.Port)
|
||||
log.Printf("Local server: http://%s", addr)
|
||||
err = a.Run()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/prologic/tube/app"
|
||||
log "github.com/sirupsen/logrus"
|
||||
flag "github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
var (
|
||||
debug bool
|
||||
version bool
|
||||
config string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Usage: %s [options] [file]\n", os.Args[0])
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
||||
flag.BoolVarP(&version, "version", "v", false, "display version information")
|
||||
flag.BoolVarP(&debug, "debug", "d", false, "enable debug logging")
|
||||
flag.StringVarP(&config, "config", "c", "config.json", "path to configuration file")
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if debug {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
} else {
|
||||
log.SetLevel(log.InfoLevel)
|
||||
}
|
||||
|
||||
if version {
|
||||
fmt.Printf("tube version %s", FullVersion())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
cfg := app.DefaultConfig()
|
||||
err := cfg.ReadFile(config)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
a, err := app.NewApp(cfg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
addr := fmt.Sprintf("%s:%d", cfg.Server.Host, cfg.Server.Port)
|
||||
log.Printf("Local server: http://%s", addr)
|
||||
err = a.Run()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,10 +237,6 @@ main {
|
|||
float:left;
|
||||
width:100px;
|
||||
}
|
||||
#b_transfered {
|
||||
float:right;
|
||||
text-align:right;
|
||||
}
|
||||
.clear_both {
|
||||
clear:both;
|
||||
}
|
||||
|
|
|
@ -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" . }}
|
||||
|
|
|
@ -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}}
|
||||
|
|
Loading…
Reference in a new issue