I don't even know.

Filled out API for user management
Proper escaping of user input for SQL queries (stream keys aren't user input)
Filled out frontend with profile management, vods, etc.
I don't remember there's probably more, fuck.
This commit is contained in:
knotteye
2019-10-05 14:34:57 -05:00
parent eefa7c8dc7
commit f9e4a7a5c6
25 changed files with 323 additions and 104 deletions

View File

@ -1,4 +1,5 @@
{% extends "base.njk" %}
{% block content %}
What to put on index?
<p></p>
Couldn't find that page!
{% endblock %}

View File

@ -1 +1 @@
<p>Add a description of your instance here!</p>
<p>Add a description of your instance here!</br>You can find this file in templates/about.html</p>

View File

@ -1,12 +1,14 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="/styles.css">
<link rel="stylesheet" type="text/css" href="/local.css">
<link rel="icon" type="image/svg" href="/logo.svg">
<title>{{ sitename }}</title>
</head>
<body>
<div id="wrapper">
<div id="header">
<span style="float:left;"><h4><a href="/">{{ sitename }}</a> | <a href="/users/live">Live</a> <a href="/users">Users</a> <a href="/about">About</a></h4></span><span style="float:right;"><h4>| <a href="/login">Login</a></h4></span>
<span style="float:left;"><h4><a href="/">{{ sitename }}</a> | <a href="/users">Users</a> <a href="/users/live">Live</a> <a href="/about">About</a></h4></span><span style="float:right;"><h4>| <a href="/profile">Profile</a></h4></span>
</div>
<div id="content">
{% block content %}
@ -17,10 +19,10 @@
<div>
<b>Satyr</b></br>
<a href="https://gitlab.com/knotteye/satyr">About</a></br>
<a href="">v0.1.0</a>
<a href="https://gitlab.com/knotteye/satyr/-/releases">v{{ version }}</a>
</div>
<div>
<img src="/satyr.png" height="50" />
<img src="/logo.svg" height="50" />
</div>
<div>
<b>{{ sitename }}</b></br>

12
templates/changepwd.njk Normal file
View File

@ -0,0 +1,12 @@
{% extends "base.njk" %}
{% block content %}
<h3>Change your password on {{ sitename }}</h3><span style="font-size: small;">Not registered yet? Sign up <a href="/register">here</a>.</br> Update your <a href="/profile">profile</a> or <a href="/changesk">stream key</a>.</span>
<p></p>
<form action="/api/user/password" method="POST" target="responseFrame">
Username: </br><input type="text" name="username" style="min-width: 300px" placeholder="e.g. lain"/></br>
Password: </br><input type="password" name="password" style="min-width: 300px"/></br>
New Password: </br><input type="password" name="newpassword" style="min-width: 300px"/></br>
<input type="submit" value="Submit">
</form>
<iframe name="responseFrame" border="0" frameborder="0" style="display: inline;"></iframe>
{% endblock %}

11
templates/changesk.njk Normal file
View File

@ -0,0 +1,11 @@
{% extends "base.njk" %}
{% block content %}
<h3>Change your password on {{ sitename }}</h3><span style="font-size: small;">Not registered yet? Sign up <a href="/register">here</a>.</br> Update your <a href="/profile">profile</a> or <a href="/changepwd">password</a>.</span>
<p></p>
<form action="/api/user/streamkey" method="POST" target="responseFrame">
Username: </br><input type="text" name="username" style="min-width: 300px" placeholder="e.g. lain"/></br>
Password: </br><input type="password" name="password" style="min-width: 300px"/></br>
<input type="submit" value="Submit">
</form>
<iframe name="responseFrame" border="0" frameborder="0" style="display: inline;"></iframe>
{% endblock %}

9
templates/list.njk Normal file
View File

@ -0,0 +1,9 @@
{% extends "base.njk" %}
{% block content %}
<h3>Streaming on {{ sitename }}</h3>
{% asyncEach user in list%}
<a href="/users/{{user.username}}">{{ user.username }}</a></br></br>
{% else %}
No users found!
{% endeach %}
{% endblock %}

9
templates/live.njk Normal file
View File

@ -0,0 +1,9 @@
{% extends "base.njk" %}
{% block content %}
<h3>Currently live on {{ sitename }}</h3>
{% for user in list%}
<a href="/users/{{user.username}}">{{ user.username | capitalize}} | {{user.title}}</a></br></br>
{% else %}
No one is live!
{% endfor %}
{% endblock %}

View File

View File

@ -0,0 +1,14 @@
{% extends "base.njk" %}
{% block content %}
<h3>Update your profile on {{ sitename }}</h3><span style="font-size: small;">Not registered yet? Sign up <a href="/register">here</a>.</br> Change your <a href="/changepwd">password</a> or <a href="/changesk">stream key</a>.</span>
<p></p>
<form action="/api/user" method="POST" target="responseFrame">
Username: </br><input type="text" name="username" style="min-width: 300px" placeholder="e.g. lain"/></br>
Password: </br><input type="password" name="password" style="min-width: 300px"/></br>
Stream Title: </br><input type="text" name="title" style="min-width: 300px"/></br>
Bio: </br><input type="text" name="bio" style="min-width: 300px; min-height: 150px;"/></br>
Record VODs: <input type="checkbox" name="record" value="true"></br>
<input type="submit" value="Submit">
</form>
<iframe name="responseFrame" border="0" frameborder="0" style="display: inline;"></iframe>
{% endblock %}

View File

@ -2,12 +2,13 @@
{% block content %}
<div id="jscontainer" style="height: 100%;">
<div id="jschild" style="width: 50%;height: 100%;text-align: left;margin: 20px;">
<form action="/api/register" method="POST" target="_self">
<form action="/api/register" method="POST" target="responseFrame">
Username: </br><input type="text" name="username" style="min-width: 300px" placeholder="e.g. lain"/></br>
Password: </br><input type="password" name="password" style="min-width: 300px"/></br>
Request Stream Key: <input type="checkbox" name="streamer" value="true" style="min-heigh: 50px;"> </br>
Confirm: </br><input type="password" name="confirm" style="min-width: 300px"/></br>
<input type="submit" value="Submit">
</form>
<iframe name="responseFrame" border="0" frameborder="0" style="display: inline;"></iframe>
</div>
<div id="jschild" style="width: 50%;height: 100%;text-align: left;margin: 20px;">
{% include "tos.html" %}

View File

@ -1,2 +1,2 @@
This is example terms of service!</br>
This is an example TOS!</br>
You should change it by editing templates/tos.html

View File

@ -1,6 +1,7 @@
{% extends "base.njk" %}
{% block content %}
<span style="float: left;font-size: large;"><b>{{ user | capitalize }}'s Stream</b></span><span style="float: right;font-size: large;">Direct Links: <a href="rtmp://{{ domain }}/live/{{ user }}">RTMP</a> <a href="/live/{{ user }}/index.m3u8">HLS</a></span>
</br>
<span style="float: left;font-size: large;"><b>{{ user }} | {{ streamtitle | escape }}</b></span><span style="float: right;font-size: large;"> Links | <a href="/vods/{{ user }}">VODs</a></span>
<div id="jscontainer">
<div id="jschild" style="width: 70%;height: 100%;">
<video controls poster="/thumbnail.jpg" class="video-js vjs-default-skin" id="live-video" style="width:100%;height:100%;"></video>
@ -28,4 +29,6 @@
});
})
</script></br>
<noscript>The webclients for the stream and the chat require javascript, but feel free to use the direct links above!</br></br></noscript>
{{ about | escape }}
{% endblock %}

9
templates/vods.njk Normal file
View File

@ -0,0 +1,9 @@
{% extends "base.njk" %}
{% block content %}
<h3>{{ user }}'s VODs</h3>
{% asyncEach vid in list%}
<a href="/live/{{ user }}/{{ vid.name }}">{{ vid.name }}</a></br></br>
{% else %}
No recordings found!
{% endeach %}
{% endblock %}