From 01f16aeddff6d1880b3615aa931cfd07d093a774 Mon Sep 17 00:00:00 2001 From: gingervitis Date: Tue, 17 Nov 2020 15:12:54 -0800 Subject: [PATCH] Simplify Logo requirement from users. (#373) * Simplify Logo requirement from users. - Only require 1 logo file, instead of a `small` and `large` one. Just require `logo`. - Update frontend sso that primary header logo will ALWAYS be owncast logo. - User's logo will remain in "user content" area. * Commit updated API documentation Co-authored-by: Owncast --- config-example.yaml | 4 +--- config/config.go | 17 +++++++++-------- controllers/index.go | 2 +- core/core.go | 4 ++-- doc/api/index.html | 6 +++--- openapi.yaml | 8 ++------ webroot/js/app-video-only.js | 7 ++----- webroot/js/app.js | 26 +++++++++----------------- webroot/js/utils/constants.js | 2 ++ webroot/styles/app.css | 3 +++ webroot/styles/user-content.css | 3 ++- yp/api.go | 2 +- 12 files changed, 37 insertions(+), 47 deletions(-) diff --git a/config-example.yaml b/config-example.yaml index b2f66969e..eec9c15c8 100644 --- a/config-example.yaml +++ b/config-example.yaml @@ -5,9 +5,7 @@ instanceDetails: title: Owncast summary: "This is brief summary of whom you are or what your stream is. You can read more about it at owncast.online. You can edit this description in your config file." - logo: - small: /img/logo.svg - large: /img/logo.svg + logo: /img/logo.svg tags: - music diff --git a/config/config.go b/config/config.go index f9d30d119..8d4abbc19 100644 --- a/config/config.go +++ b/config/config.go @@ -32,10 +32,11 @@ type config struct { // 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 logo `yaml:"logo" json:"logo"` + Name string `yaml:"name" json:"name"` + Title string `yaml:"title" json:"title"` + Summary string `yaml:"summary" json:"summary"` + // Logo logo `yaml:"logo" json:"logo"` + Logo string `yaml:"logo" json:"logo"` Tags []string `yaml:"tags" json:"tags"` SocialHandles []socialHandle `yaml:"socialHandles" json:"socialHandles"` Version string `json:"version"` @@ -43,10 +44,10 @@ type InstanceDetails struct { ExtraPageContent string `json:"extraPageContent"` } -type logo struct { - Large string `yaml:"large" json:"large"` - Small string `yaml:"small" json:"small"` -} +// type logo struct { +// Large string `yaml:"large" json:"large"` +// Small string `yaml:"small" json:"small"` +// } type socialHandle struct { Platform string `yaml:"platform" json:"platform"` diff --git a/controllers/index.go b/controllers/index.go index ff33204d9..e340bc6c1 100644 --- a/controllers/index.go +++ b/controllers/index.go @@ -62,7 +62,7 @@ func handleScraperMetadataPage(w http.ResponseWriter, r *http.Request) { if err != nil { log.Panicln(err) } - imageURL, err := url.Parse(fmt.Sprintf("http://%s%s", r.Host, config.Config.InstanceDetails.Logo.Large)) + imageURL, err := url.Parse(fmt.Sprintf("http://%s%s", r.Host, config.Config.InstanceDetails.Logo)) if err != nil { log.Panicln(err) } diff --git a/core/core.go b/core/core.go index 9be362999..39636902d 100644 --- a/core/core.go +++ b/core/core.go @@ -99,7 +99,7 @@ func transitionToOfflineVideoStreamContent() { _transcoder.Start() // Copy the logo to be the thumbnail - err := utils.Copy(filepath.Join("webroot", config.Config.InstanceDetails.Logo.Large), "webroot/thumbnail.jpg") + err := utils.Copy(filepath.Join("webroot", config.Config.InstanceDetails.Logo), "webroot/thumbnail.jpg") if err != nil { log.Warnln(err) } @@ -153,7 +153,7 @@ func resetDirectories() { } // Remove the previous thumbnail - err = utils.Copy(path.Join(config.WebRoot, config.Config.InstanceDetails.Logo.Large), "webroot/thumbnail.jpg") + err = utils.Copy(path.Join(config.WebRoot, config.Config.InstanceDetails.Logo), "webroot/thumbnail.jpg") if err != nil { log.Warnln(err) } diff --git a/doc/api/index.html b/doc/api/index.html index 3a8a71390..2dab7b6c6 100644 --- a/doc/api/index.html +++ b/doc/api/index.html @@ -558,13 +558,13 @@ data-styled.g140[id="sc-aKZfe"]{content:"jLbdqt,"}/*!sc*/

Request samples

Content type
application/json
{
  • "key": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "changed"
}

Change the extra page content. Pre-release, do not use.

Change the extra page content in memory, but not on disk.

Authorizations:
Request Body schema: application/json
content
string

Responses

Request samples

Content type
application/json
{
  • "content": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "changed"
}

Server Configuration

Get the current configuration of the Owncast server.

-
Authorizations:

Responses

Response samples

Content type
application/json
{
  • "instanceDetails": {
    },
  • "ffmpegPath": "string",
  • "webServerPort": 0,
  • "s3": {
    },
  • "videoSettings": {
    },
  • "yp": {
    }
}

Viewers Over Time

Get the tracked viewer count over the collected period.

+
Authorizations:

Responses

Response samples

Content type
application/json
{
  • "instanceDetails": {
    },
  • "ffmpegPath": "string",
  • "webServerPort": 0,
  • "s3": {
    },
  • "videoSettings": {
    },
  • "yp": {
    }
}

Viewers Over Time

Get the tracked viewer count over the collected period.

Authorizations:

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Hardware Stats

Get the CPU, Memory and Disk utilization levels over the collected period.

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "cpu": [
    ],
  • "memory": [
    ],
  • "disk": [
    ]
}

Chat

Endpoints related to the chat interface.

Historical Chat Messages

Used to get all chat messages prior to connecting to the websocket.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Custom Emoji

Get a list of custom emoji that are supported in chat.

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Server

Information

The client configuration. Information useful for the user interface.

-

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "title": "string",
  • "summary": "string",
  • "logo": {
    },
  • "tags": [
    ],
  • "socialHandles": [],
  • "extraPageContent": "<p>This page is <strong>super</strong> cool!",
  • "version": "Owncast v0.0.3-macOS (ef3796a033b32a312ebf5b334851cbf9959e7ecb)"
}

Current Status

This endpoint is used to discover when a server is broadcasting, the number of active viewers as well as other useful information for updating the user interface.

+

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "title": "string",
  • "summary": "string",
  • "logo": "string",
  • "tags": [
    ],
  • "socialHandles": [],
  • "extraPageContent": "<p>This page is <strong>super</strong> cool!",
  • "version": "Owncast v0.0.3-macOS (ef3796a033b32a312ebf5b334851cbf9959e7ecb)"
}

Current Status

This endpoint is used to discover when a server is broadcasting, the number of active viewers as well as other useful information for updating the user interface.

Responses

Response samples

Content type
application/json
{
  • "lastConnectTime": "2020-10-03T21:36:22-05:00",
  • "lastDisconnectTime": null,
  • "online": true,
  • "overallMaxViewerCount": 420,
  • "sessionMaxViewerCount": 12,
  • "viewerCount": 7
}

Yellow Pages Information

Information to be used in the Yellow Pages service, a global directory of Owncast servers.

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "logo": "string",
  • "nsfw": true,
  • "tags": [
    ],
  • "online": true,
  • "viewerCount": 0,
  • "overallMaxViewerCount": 0,
  • "sessionMaxViewerCount": 0,
  • "lastConnectTime": "2019-08-24T14:15:22Z"
}

Pre-release

Update Stream Key. Pre-release, do not use.

Change the stream key in memory, but not in the config file. This will require all broadcasters to be reconfigured to connect again.

Authorizations:
Request Body schema: application/json
key
string

Responses

Authorizations:
Request Body schema: application/json
content
string

Responses

Request samples

Content type
application/json
{
  • "content": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "changed"
}