Browse Source

Use client-side config files to config things

pull/5/head
Gabe Kangas 5 years ago
parent
commit
c6e4ea8349
  1. 23
      webroot/index.html
  2. 8
      webroot/js/app.js
  3. 6
      webroot/js/config.js
  4. 11
      webroot/js/config.json

23
webroot/index.html

@ -44,7 +44,7 @@ possible hacks @@ -44,7 +44,7 @@ possible hacks
<div id="top-content">
<header class="flex border-b border-gray-900 border-solid shadow-md">
<h1 class="text-gray-400">
😈 Owncast
😈 {{title}}
</h1>
<div id="user-options-container" class="flex">
@ -99,17 +99,9 @@ possible hacks @@ -99,17 +99,9 @@ possible hacks
<div id="user-content" class="user-content">
<!-- USER CONTENT... -->
<div>
Blathers 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.
<br />
</div>
<div>
Blathers 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.
<div v-html="description"></div>
</div>
</div>
</div>
@ -121,16 +113,7 @@ possible hacks @@ -121,16 +113,7 @@ possible hacks
<div id="user-content-touch" class="user-content">
<!-- USER CONTENT... -->
<div>
Blathers 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.
<br />
</div>
<div>
Blathers 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.
</div>
<div v-html="description"></div>
</div>

8
webroot/js/app.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
function setupApp() {
async function setupApp() {
Vue.filter('plural', function (string, count) {
if (count === 1) {
return string;
@ -15,6 +15,8 @@ function setupApp() { @@ -15,6 +15,8 @@ function setupApp() {
sessionMaxViewerCount: 0,
overallMaxViewerCount: 0,
messages: [],
description: "",
title: "",
},
});
@ -25,7 +27,9 @@ function setupApp() { @@ -25,7 +27,9 @@ function setupApp() {
var appMessagingMisc = new Messaging();
appMessagingMisc.init();
const config = new Config();
const config = await new Config().init();
app.description = autoLink(config.description, { embed: false });
app.title = config.title;
}
async function getStatus() {

6
webroot/js/config.js

@ -1,9 +1,4 @@ @@ -1,9 +1,4 @@
class Config {
constructor() {
this.init();
}
async init() {
const configFileLocation = "./js/config.json";
@ -11,6 +6,7 @@ class Config { @@ -11,6 +6,7 @@ class Config {
const response = await fetch(configFileLocation);
const configData = await response.json();
Object.assign(this, configData);
return this;
} catch(error) {
console.log(error);
// No config file present. That's ok. It's not required.

11
webroot/js/config.json

@ -1,5 +1,10 @@ @@ -1,5 +1,10 @@
{
"title": "Title",
"logo": "https://vignette.wikia.nocookie.net/animalcrossing/images/b/b3/NH-character-Blathers.png/revision/latest?cb=20200229053519",
"color": "#276749"
"title": "Owncast Demo Server",
"logo": "/img/logo.png",
"description": "This is a demo server for Owncast. You can read more about it at owncast.online. You can edit this description in your web config file. <br><br>Blathers 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"
]
}
Loading…
Cancel
Save