Merge branch '0620gw-updates'

This commit is contained in:
Ginger Wong 2020-06-21 01:31:51 -07:00
commit e643727be5
11 changed files with 355 additions and 40 deletions

BIN
webroot/img/airplay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -13,6 +13,7 @@
<script src="//unpkg.com/video.js@7.8.3/dist/video.js"></script>
<script src="//unpkg.com/showdown/dist/showdown.min.js"></script>
<script src="vendor/autolink.js"></script>
<link href="./styles/layout.css" rel="stylesheet" />
</head>
<script>
@ -35,7 +36,7 @@ GW TODO:
<header class="flex border-b border-gray-900 border-solid shadow-md">
<h1 v-cloak class="flex text-gray-400">
<span id="logo-container" class="rounded-full bg-white mx-2 px-1 py-1">
<img class="logo" src="./img/logo128.png">
<img class="logo" v-bind:src="logo">
</span>
<span>{{title}}</span>
</h1>
@ -74,7 +75,7 @@ GW TODO:
autoplay
playsinline
muted
poster="/thumbnail.jpg"
poster="https://goth.land/thumbnail.jpg"
>
</video>
</div>
@ -89,29 +90,34 @@ GW TODO:
</main>
<section id="user-content" class="user-content">
<!-- USER CONTENT... -->
<div v-html="description"></div>
<footer class="flex border-t border-gray-500 border-solid">
<span>
<a href="https://github.com/gabek/owncast" target="_blank">About Owncast</a>
</span>
</footer>
<div class="user-image rounded-full bg-white">
<img class="logo" v-bind:src="logo">
</div>
<div class="">
<div class="user-content-header border-b border-gray-500 border-solid">
<h2 class="font-semibold">About <span class="streamer-name text-indigo-600">{{streamerName}}</span></h2>
<social-list v-bind:platforms="socialHandles"></social-list>
<div class="stream-summary" v-html="summary"></div>
<stream-tags v-bind:tags="tags"></stream-tags>
</div>
<!-- USER CONTENT... -->
<div class="extra-user-content" v-html="extraUserContent"></div>
</div>
</section>
<owncast-footer></owncast-footer>
</div>
<section id="chat-container-wrap" class="flex">
<div id="user-content-touch" class="user-content">
<!-- USER CONTENT... -->
<div v-html="description"></div>
<social-list v-bind:platforms="socialHandles"></social-list>
<!-- need a better way to duplicate footer, use VUE component-->
<footer class="flex border-t border-gray-500 border-solid">
<span>
<a href="https://github.com/gabek/owncast" target="_blank">About Owncast</a>
</span>
</footer>
<!-- USER CONTENT... -->
<div v-html="extraUserContent"></div>
<owncast-footer></owncast-footer>
</div>
<div id="chat-container" class="bg-gray-800">
@ -167,6 +173,8 @@ GW TODO:
<script src="js/config.js"></script>
<script src="js/utils.js"></script>
<script src="js/message.js"></script>
<script src="js/social.js"></script>
<script src="js/footer.js"></script>
<script src="js/app.js"></script>
<script src="js/player/airplay.js"></script>
<script src="js/player/player.js"></script>

View File

@ -1,7 +1,6 @@
async function setupApp() {
Vue.filter('plural', pluralize);
window.app = new Vue({
el: "#app-container",
data: {
@ -10,9 +9,16 @@ async function setupApp() {
sessionMaxViewerCount: 0,
overallMaxViewerCount: 0,
messages: [],
description: "",
title: "",
extraUserContent: "",
isOnline: false,
// from config
logo: null,
socialHandles: [],
streamerName: "",
summary: "",
tags: [],
title: "",
},
watch: {
messages: {
@ -33,16 +39,21 @@ async function setupApp() {
appMessaging.init();
const config = await new Config().init();
app.logo = config.logo;
app.socialHandles = config.socialHandles;
app.streamerName = config.name;
app.summary = config.summary && addNewlines(config.summary);
app.tags = config.tags;
app.title = config.title;
const configFileLocation = "./js/config.json";
// const configFileLocation = "../js/config.json";
try {
const pageContentFile = "/static/content.md"
const pageContentFile = "../static/content.md"
const response = await fetch(pageContentFile);
const descriptionMarkdown = await response.text()
const descriptionHTML = new showdown.Converter().makeHtml(descriptionMarkdown);
app.description = descriptionHTML;
app.extraUserContent = descriptionHTML;
return this;
} catch (error) {
console.log(error);
@ -55,9 +66,9 @@ function setupWebsocket() {
// Uncomment to point to somewhere other than goth.land
const protocol = location.protocol == "https:" ? "wss" : "ws"
var ws = new WebSocket(protocol + "://" + location.host + "/entry")
// var ws = new WebSocket(protocol + "://" + location.host + "/entry")
// var ws = new WebSocket("wss://goth.land/entry")
var ws = new WebSocket("wss://goth.land/entry")
ws.onmessage = (e) => {
const model = JSON.parse(e.data)

View File

@ -1,3 +1,4 @@
// add more to the promises later.
class Config {
async init() {
const configFileLocation = "./js/config.json";

View File

@ -1,10 +1,21 @@
{
"name": "gabek",
"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.",
"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" }
]
}

27
webroot/js/footer.js Normal file
View File

@ -0,0 +1,27 @@
Vue.component('owncast-footer', {
template: `
<footer class="flex border-t border-gray-500 border-solid">
<span>
<a href="https://github.com/gabek/owncast" target="_blank">About Owncast</a>
</span>
</footer>
`,
});
Vue.component('stream-tags', {
props: ['tags'],
template: `
<ul
class="tag-list flex"
v-if="this.tags.length"
>
<li class="tag rounded-sm text-gray-100 bg-gray-700"
v-for="tag in this.tags"
v-bind:key="tag"
>
{{tag}}
</li>
</ul>
`,
});

View File

@ -13,7 +13,13 @@ class Message {
}
formatText() {
var markdownToHTML = new showdown.Converter({ emoji: true, openLinksInNewWindow: true, tables: false, strikethrough: false, simplifiedAutoLink: false}).makeHtml(this.body);
var markdownToHTML = new showdown.Converter({
emoji: true,
openLinksInNewWindow: true,
tables: false,
strikethrough: false,
simplifiedAutoLink: false,
}).makeHtml(this.body);
var linked = autoLink(markdownToHTML, { embed: true });
return addNewlines(linked);
}

View File

@ -1,5 +1,5 @@
const streamURL = '/hls/stream.m3u8';
// const streamURL = 'https://goth.land/hls/stream.m3u'; // Uncomment me to point to remote video
// const streamURL = '/hls/stream.m3u8';
const streamURL = 'https://goth.land/hls/stream.m3u8'; // Uncomment me to point to remote video
// style hackings
window.VIDEOJS_NO_DYNAMIC_STYLE = true;

144
webroot/js/social.js Normal file
View File

@ -0,0 +1,144 @@
const SOCIAL_PLATFORMS_URLS = {
default: {
name: "default",
urlPrefix: "",
imgPos: [0,0], // [row,col]
},
facebook: {
name: "Facebook",
urlPrefix: "http://www.facebook.com/",
imgPos: [0,1],
},
twitter: {
name: "Twitter",
urlPrefix: "http://www.twitter.com/",
imgPos: [0,2],
},
instagram: {
name: "Instagram",
urlPrefix: "http://www.instagram.com/",
imgPos: [0,3],
},
instagram: {
name: "Snapchat",
urlPrefix: "http://www.snapchat.com/",
imgPos: [0,4],
},
tiktok: {
name: "TikTok",
urlPrefix: "http://www.tiktok.com/",
imgPos: [0,5],
},
soundcloud: {
name: "Soundcloud",
urlPrefix: "http://www.soundcloud.com/",
imgPos: [0,6],
},
basecamp: {
name: "Base Camp",
urlPrefix: "http://www.basecamp.com/",
imgPos: [0,7],
},
patreon: {
name: "Patreon",
urlPrefix: "http://www.patreon.com/",
imgPos: [0,1],
},
youtube: {
name: "YouTube",
urlPrefix: "http://www.youtube.com/",
imgPos: [0,9 ],
},
spotify: {
name: "Spotify",
urlPrefix: "http://www.spotify.com/",
imgPos: [0,10],
},
twitch: {
name: "Twitch",
urlPrefix: "http://www.twitch.com/",
imgPos: [0,11],
},
paypal: {
name: "Paypal",
urlPrefix: "http://www.paypal.com/",
imgPos: [0,12],
},
github: {
name: "Github",
urlPrefix: "http://www.github.com/",
imgPos: [0,13],
},
linkedin: {
name: "LinkedIn",
urlPrefix: "http://www.linkedin.com/",
imgPos: [0,14],
},
discord: {
name: "Discord",
urlPrefix: "http://www.discord.com/",
imgPos: [0,15],
},
mastadon: {
name: "Mastadon",
urlPrefix: "http://www.mastadon.com/",
imgPos: [0,16],
},
};
Vue.component('social-list', {
props: ['platforms'],
template: `
<ul class="social-list flex">
<span v-if="this.platforms.length" class="follow-label">Follow me: </span>
<user-social-icon
v-for="(item, index) in this.platforms"
v-if="item.platform && item.handle"
v-bind:key="index"
v-bind:platform="item.platform"
v-bind:username="item.handle"
/>
</ul>
`,
});
Vue.component('user-social-icon', {
props: ['platform', 'username'],
data: function() {
const platformInfo = SOCIAL_PLATFORMS_URLS[this.platform.toLowerCase()] || SOCIAL_PLATFORMS_URLS["default"];
const imgRow = platformInfo.imgPos && platformInfo.imgPos[0] || 0;
const imgCol = platformInfo.imgPos && platformInfo.imgPos[1] || 0;
const useDefault = platformInfo.name === "default";
return {
name: platformInfo.name,
link: platformInfo.name !== "default" ? `${platformInfo.urlPrefix}/${this.username}` : '#',
style: `--imgRow: -${imgRow}; --imgCol: -${imgCol};`,
itemClass: {
"user-social-item": true,
"flex": true,
"rounded": useDefault,
"use-default": useDefault,
},
labelClass: {
"platform-label": true,
"visually-hidden": !useDefault,
"text-indigo-800": true,
},
};
},
template: `
<li>
<a
v-bind:class="itemClass"
target="_blank"
:href="link"
>
<span class="platform-icon rounded-lg" :style="style" />
<span v-bind:class="labelClass">Find @{{username}} on {{platform}}</span>
</a>
</li>
`,
});

View File

@ -4,20 +4,13 @@
--right-col-width: 24em;
--video-container-height: 50vh;
--header-bg-color: rgba(20,0,40,1);
--user-image-width: 10em;
}
body {
font-size: 14px;
}
/* Tailwind sets list styles to none. I don't know why. */
ol {
list-style: decimal;
}
ul {
list-style: unset;
}
a:hover {
text-decoration: underline;
@ -29,6 +22,17 @@ a:hover {
background: transparent;
}
.visually-hidden {
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
white-space: nowrap; /* added line */
}
#app-container {
width: 100%;
flex-direction: column;
@ -108,6 +112,107 @@ footer {
}
/* ************************************************8 */
.user-content {
padding: 3em;
}
#user-content {
display: flex;
flex-direction: row;
}
.user-content .user-image {
padding: 1em;
margin-right: 2em;
min-width: var(--user-image-width);
width: var(--user-image-width);
height: var(--user-image-width);
max-height: var(--user-image-width);
}
.user-image img {
display: inline-block;
width: 100%;
height: 100%;
}
.stream-summary {
margin: 1em 0;
}
.extra-user-content {
margin: 1em 0;
}
h2 {
font-size: 3em;
}
.user-content-header {
margin-bottom: 2em;
}
.tag-list {
flex-direction: row;
margin: 1em 0;
}
.tag-list li {
font-size: .75em;
text-transform: uppercase;
margin-right: .75em;
padding: .5em;
}
.social-list {
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
}
.social-list .follow-label {
font-weight: bold;
font-size: .75em;
margin-right: .5em;
text-transform: uppercase;
}
.user-social-item {
display: flex;
justify-content: flex-start;
align-items: center;
margin-right: -.25em;
}
.user-social-item .platform-icon {
--icon-width: 40px;
height: var(--icon-width);
width: var(--icon-width);
background-image: url(../img/social-icons.gif);
background-repeat: no-repeat;
background-position: calc(var(--imgCol) * var(--icon-width)) calc(var(--imgRow) * var(--icon-width));
transform: scale(.65);
}
.user-social-item.use-default:hover {
text-decoration: none;
cursor: text;
}
.user-social-item.use-default .platform-label {
font-size: .7em;
text-transform: uppercase;
display: inline-block;
max-width: 10em;
}
.extra-user-content ol {
list-style: decimal;
}
.extra-user-content ul {
list-style: unset;
}
/* ************************************************8 */
#user-options-container {
flex-direction: row;
justify-content: flex-end;
@ -201,7 +306,8 @@ footer {
margin-top: -0.75em;
}
.vjs-airplay .vjs-icon-placeholder::before {
content: 'AP';
/* content: 'AP'; */
content: url("../img/airplay.png");
}
@ -305,6 +411,7 @@ footer {
@media screen and (max-width: 860px) {
:root {
--right-col-width: 20em;
--user-image-width: 6em;
}
#chat-container {