Consolidate config files and surface frontend values via API. Closes #30
This commit is contained in:
parent
a9b8a70e8a
commit
73b6937496
@ -3,6 +3,26 @@ privateHLSPath: hls
|
||||
ffmpegPath: /usr/bin/ffmpeg
|
||||
webServerPort: 8080
|
||||
|
||||
instanceDetails:
|
||||
name: Owncast
|
||||
title: Owncast Demo Server
|
||||
logo: /img/logo128.png
|
||||
summary: "This is brief summary of whom you are or what your stream is. demo server for Owncast. You can read more about it at owncast.online. You can edit this description in your web config file.\n\nBlathers is an owl with brown feathers. His face is white and he has a yellow beak. His arms are wing shaped and he has yellow talons. His eyes are very big with small black irises. He also has big pink cheek circles on his cheeks. His belly appears to be checkered in diamonds with light brown and white squares, similar to an argyle vest, which is traditionally associated with academia. His green bowtie further alludes to his academic nature."
|
||||
extraUserInfoFileName: "/static/content.md"
|
||||
|
||||
tags:
|
||||
- music
|
||||
- software
|
||||
- animal crossing
|
||||
|
||||
# See documentation for full list of supported social links. All optional.
|
||||
socialHandles:
|
||||
twitter: http://twitter.com/owncast
|
||||
instagram: http://instagram.biz/owncast
|
||||
facebook: http://facebook.gov/owncast
|
||||
tiktok: http://tiktok.cn/owncast
|
||||
soundcloud: http://soundcloud.com/owncast
|
||||
|
||||
videoSettings:
|
||||
chunkLengthInSeconds: 4
|
||||
streamingKey: abc123
|
||||
|
@ -15,14 +15,26 @@ import (
|
||||
var Config *config
|
||||
|
||||
type config struct {
|
||||
IPFS ipfs `yaml:"ipfs"`
|
||||
PublicHLSPath string `yaml:"publicHLSPath"`
|
||||
PrivateHLSPath string `yaml:"privateHLSPath"`
|
||||
VideoSettings videoSettings `yaml:"videoSettings"`
|
||||
Files files `yaml:"files"`
|
||||
FFMpegPath string `yaml:"ffmpegPath"`
|
||||
WebServerPort int `yaml:"webServerPort"`
|
||||
S3 s3 `yaml:"s3"`
|
||||
IPFS ipfs `yaml:"ipfs"`
|
||||
PublicHLSPath string `yaml:"publicHLSPath"`
|
||||
PrivateHLSPath string `yaml:"privateHLSPath"`
|
||||
VideoSettings videoSettings `yaml:"videoSettings"`
|
||||
Files files `yaml:"files"`
|
||||
FFMpegPath string `yaml:"ffmpegPath"`
|
||||
WebServerPort int `yaml:"webServerPort"`
|
||||
S3 s3 `yaml:"s3"`
|
||||
InstanceDetails InstanceDetails `yaml:"instanceDetails"`
|
||||
}
|
||||
|
||||
// InstanceDetails defines the user-visible information about this particular instance.
|
||||
type InstanceDetails struct {
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Title string `yaml:"title" json:"title"`
|
||||
Summary string `yaml:"summary" json:"summary"`
|
||||
Logo string `yaml:"logo" json:"logo"`
|
||||
Tags []string `yaml:"tags" json:"tags"`
|
||||
SocialHandles map[string]string `yaml:"socialHandles" json:"socialHandles"`
|
||||
ExtraInfoFile string `yaml:"extraUserInfoFileName" json:"extraUserInfoFileName"`
|
||||
}
|
||||
|
||||
type videoSettings struct {
|
||||
@ -33,6 +45,7 @@ type videoSettings struct {
|
||||
EnablePassthrough bool `yaml:"passthrough"`
|
||||
}
|
||||
|
||||
// StreamQuality defines the specifics of a single HLS stream variant.
|
||||
type StreamQuality struct {
|
||||
// Enable passthrough to copy the video and/or audio directly from the
|
||||
// incoming stream and disable any transcoding. It will ignore any of
|
||||
|
18
controllers/config.go
Normal file
18
controllers/config.go
Normal file
@ -0,0 +1,18 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/gabek/owncast/config"
|
||||
"github.com/gabek/owncast/router/middleware"
|
||||
)
|
||||
|
||||
//GetWebConfig gets the status of the server
|
||||
func GetWebConfig(w http.ResponseWriter, r *http.Request) {
|
||||
middleware.EnableCors(&w)
|
||||
|
||||
config := config.Config.InstanceDetails
|
||||
|
||||
json.NewEncoder(w).Encode(config)
|
||||
}
|
@ -29,6 +29,9 @@ func Start() error {
|
||||
// chat rest api
|
||||
http.HandleFunc("/chat", controllers.GetChatMessages)
|
||||
|
||||
// web config api
|
||||
http.HandleFunc("/config", controllers.GetWebConfig)
|
||||
|
||||
port := config.Config.WebServerPort
|
||||
|
||||
log.Printf("Starting public web server on port: %d", port)
|
||||
|
@ -1,7 +1,7 @@
|
||||
// add more to the promises later.
|
||||
class Config {
|
||||
async init() {
|
||||
const configFileLocation = "./js/config.json";
|
||||
const configFileLocation = "/config";
|
||||
|
||||
try {
|
||||
const response = await fetch(configFileLocation);
|
||||
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"name": "gabek",
|
||||
"title": "Owncast Demo Server",
|
||||
"logo": "/img/logo128.png",
|
||||
|
||||
"summary": "This is brief summary of whom you are or what your stream is. demo server for Owncast. You can read more about it at owncast.online. You can edit this description in your web config file.\n\nBlathers is an owl with brown feathers. His face is white and he has a yellow beak. His arms are wing shaped and he has yellow talons. His eyes are very big with small black irises. He also has big pink cheek circles on his cheeks. His belly appears to be checkered in diamonds with light brown and white squares, similar to an argyle vest, which is traditionally associated with academia. His green bowtie further alludes to his academic nature.",
|
||||
|
||||
"tags": [
|
||||
"music",
|
||||
"software",
|
||||
"animal crossing"
|
||||
],
|
||||
"socialHandles": [
|
||||
{ "platform": "twitter", "handle": "abc" },
|
||||
{ "platform": "instagram", "handle": "abc" },
|
||||
{ "platform": "facebook", "handle": "" },
|
||||
{ "platform": "tiktok", "handle": "abc" },
|
||||
{ "platform": "soundcloud", "handle": "abc" },
|
||||
{ "platform": "newone", "handle": "abc" }
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user