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

8
webroot/js/app.js

@ -1,4 +1,4 @@
function setupApp() { async function setupApp() {
Vue.filter('plural', function (string, count) { Vue.filter('plural', function (string, count) {
if (count === 1) { if (count === 1) {
return string; return string;
@ -15,6 +15,8 @@ function setupApp() {
sessionMaxViewerCount: 0, sessionMaxViewerCount: 0,
overallMaxViewerCount: 0, overallMaxViewerCount: 0,
messages: [], messages: [],
description: "",
title: "",
}, },
}); });
@ -25,7 +27,9 @@ function setupApp() {
var appMessagingMisc = new Messaging(); var appMessagingMisc = new Messaging();
appMessagingMisc.init(); 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() { async function getStatus() {

6
webroot/js/config.js

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

11
webroot/js/config.json

@ -1,5 +1,10 @@
{ {
"title": "Title", "title": "Owncast Demo Server",
"logo": "https://vignette.wikia.nocookie.net/animalcrossing/images/b/b3/NH-character-Blathers.png/revision/latest?cb=20200229053519", "logo": "/img/logo.png",
"color": "#276749" "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