Compare commits

...

3 Commits

Author SHA1 Message Date
gashapwn
134ec10ab5 added rule. added new bkg pic. CSS can change bkg pic. 2020-11-26 21:41:00 +00:00
gashapwn
55203c1092 added skel 2020-11-26 06:53:32 +00:00
gashapwn
5625e3e2ce added user_list.txt code 2020-11-26 06:53:20 +00:00
13 changed files with 166 additions and 35 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ test_*.txt
*/p0.pl */p0.pl
*/p1.pl */p1.pl
*/p2.pl */p2.pl
user_list.txt

28
app.py
View File

@ -5,7 +5,17 @@ app=Flask(__name__)
@app.route("/") @app.route("/")
def home(): def home():
app.route('/') app.route('/')
return render_template("index.html")
u_list = [];
with open("user_list.txt") as u_file:
for line in u_file:
u_list.append(line);
return render_template("index.html", u_list=u_list, page_name="home")
def rules():
return render_template("rules.html")
def home2(name): def home2(name):
# app.route('/home2/<name>') # app.route('/home2/<name>')
@ -35,8 +45,6 @@ def req():
rt = { rt = {
"username": Widg("username", "input", None), "username": Widg("username", "input", None),
"displayname": Widg("displayname", "input", None),
"prefer display name?": Widg("default_disp", "check", None),
"email for account lockout / registration confirmation (optional)": Widg("email", "input", None), "email for account lockout / registration confirmation (optional)": Widg("email", "input", None),
"SSH public key": Widg("pub_key", "textarea", None), "SSH public key": Widg("pub_key", "textarea", None),
"shell of choice": Widg("shell", "choice", [("bash", "/bin/bash"), ("ksh", "/bin/ksh")]), "shell of choice": Widg("shell", "choice", [("bash", "/bin/bash"), ("ksh", "/bin/ksh")]),
@ -44,7 +52,17 @@ def req():
}; };
# uhhh is this how you're supposed to do this? # uhhh is this how you're supposed to do this?
return render_template("req.html", req_tab = rt, widg_fun = widg_fun) return render_template("req.html", req_tab = rt, widg_fun = widg_fun, page_name="req")
def signup():
username = request.form["username"]
email = request.form["email"]
shell = request.form["shell"]
rule_read = request.form["rule_read"]
if(rule_read != "on"):
print("some fail condition")
def login(): def login():
if request.method == "POST": if request.method == "POST":
@ -55,7 +73,9 @@ def login():
if __name__=="__main__": if __name__=="__main__":
app.add_url_rule('/home2/<name>', 'home2', home2) app.add_url_rule('/home2/<name>', 'home2', home2)
app.add_url_rule('/rules', 'rules', rules)
app.add_url_rule('/success/<name>', 'success', success) app.add_url_rule('/success/<name>', 'success', success)
app.add_url_rule('/login', 'login', login, methods = ['POST', 'GET']) app.add_url_rule('/login', 'login', login, methods = ['POST', 'GET'])
app.add_url_rule('/req', 'req', req, methods = ['POST', 'GET']) app.add_url_rule('/req', 'req', req, methods = ['POST', 'GET'])
app.add_url_rule('/req/signup', 'req', req, methods = ['POST'])
app.run(host="104.248.118.130",debug=True) app.run(host="104.248.118.130",debug=True)

View File

@ -53,16 +53,11 @@ sub create($){
} }
system($cmd); system($cmd);
#system("mkdir /home/$username/.ssh");
#system("chmod 700 /home/$username/.ssh");
system("cat $FULL_PATH/$id.pub > /home/$username/.ssh/authorized_keys"); system("cat $FULL_PATH/$id.pub > /home/$username/.ssh/authorized_keys");
#system("mv $FULL_PATH/$id.pub /home/$username/.ssh/authorized_keys");
#system("chmod 600 /home/$username/.ssh/authorized_keys");
system("chmod 711 /home/$username"); system("chmod 711 /home/$username");
#system("chown $username:$username /home/$username/.ssh");
#system("chown $username:$username /home/$username/.ssh/authorized_keys");
system("rm $FULL_PATH/$id.ident"); system("rm $FULL_PATH/$id.ident");
system("rm $FULL_PATH/$id.pub"); system("rm $FULL_PATH/$id.pub");
system("echo $username >> user_list.txt");
} }
close FILE; close FILE;
} }

BIN
skel/public_html/empty.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

View File

@ -0,0 +1,19 @@
<html>
<head>
<style>
body {
background: black;
}
</style>
</head>
<body>
<div style="text-align: center;">
<div style="height:300px;"></div>
<img src="empty.gif"></img>
<h3 style="color: purple;">
there is nothing here... yet
</h3>
</div>
</body>
</html>

View File

@ -2,6 +2,15 @@ html {
background: #000; background: #000;
} }
h1{
text-align: center;
}
footer{
width: 800px;
margin: 0 auto;
}
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
@ -28,17 +37,17 @@ header h1.logo {
float: left; float: left;
} }
header h1.logo:hover { /* header h1.logo:hover { */
color: #fff; /* color: #fff; */
text-decoration: none; /* text-decoration: none; */
} /* } */
/* /*
* Center the body content * Center the body content
*/ */
.container { .container {
width: 1200px; width: 800px;
margin: 0 auto; margin: 0 auto;
} }

71
static/main_req.css Normal file
View File

@ -0,0 +1,71 @@
html {
background: #000;
background-image: url("req.png");
background-repeat: no-repeat;
}
h1{
text-align: center;
}
footer{
width: 800px;
margin: 0 auto;
}
body {
margin: 0;
padding: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #fff;
}
/*
* Formatting the header area
*/
header {
height: 35px;
width: 100%;
opacity: .9;
margin-bottom: 10px;
}
header h1.logo {
margin: 0;
font-size: 1.7em;
color: #fff;
text-transform: uppercase;
float: left;
}
/* header h1.logo:hover { */
/* color: #fff; */
/* text-decoration: none; */
/* } */
/*
* Center the body content
*/
.container {
width: 800px;
margin: 0 auto;
}
h2 {
font-size: 3em;
margin-top: 40px;
text-align: center;
letter-spacing: -2px;
}
h3 {
font-size: 1.7em;
font-weight: 100;
margin-top: 30px;
text-align: center;
letter-spacing: -1px;
color: #999;
}

BIN
static/req.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -4,13 +4,14 @@
<div class="home_blurb"> <div class="home_blurb">
<p>lingy.in is a public unix / tilde instance for lainons</p> <p>lingy.in is a public unix / tilde instance for lainons</p>
<p><b>current thread: </b><a href="https://lainchan.org/tech/res/34563.html">https://lainchan.org/tech/res/34563.html</a></p> <p><b>current thread: </b><a href="https://lainchan.org/tech/res/34563.html">https://lainchan.org/tech/res/34563.html</a></p>
<p>sign up</p> <p><a href="/req">sign up</a></p>
<p>rules</p> <p><a href="/rules">rules</a></p>
<p>git</p> <p><a href="https://git.lain.church/gashapwn/lyadmin">git</a></p>
<p>users</p> <p><h3>users</h3></p>
<ol> <ol>
<li>gashapwn</li> {% for user in u_list %}
<li>china probably</li> <li><a href="~{{user}}">{{user}}</a></li>
{% endfor %}
</ol> </ol>
</div> </div>
{%endblock%} {%endblock%}

View File

@ -1,13 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<head> <head>
<title>userreq</title> <title>LAINTILDE0</title>
<link rel="stylesheet" href="{{url_for('static',filename='main.css')}}"> <link rel="stylesheet" href="{{url_for('static',filename='main.css')}}">
</head> </head>
<h1>铃音</h1> <h1>lingy.in</h1>
<body> <body>
<div class="container"> <div class="container">
{%block content%} {%block content%}
{%endblock%} {%endblock%}
</div> </div>
</body> </body>
<footer>admin: <a href="email:gashapwn@protonmail.com">gashapwn@protonmail.com</a></footer>
</html> </html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<head> <head>
<title>LAINTILDE0</title> <title>LAINTILDE0</title>
<link rel="stylesheet" href="{{url_for('static',filename='main_home.css')}}"> <link rel="stylesheet" href="{{url_for('static',filename='main_' + page_name + '.css')}}">
</head> </head>
<h1>lingy.in</h1> <h1>lingy.in</h1>
<body> <body>

View File

@ -1,4 +1,4 @@
{%extends "layout.html"%} {%extends "main_layout.html"%}
{%block content%} {%block content%}
<p> <p>
@ -26,14 +26,4 @@
<p> <p>
<p>
A requested feature is to have to allow users to have a unicode username since unicode allows for more interesting aesthics
</br>
If you enter a unicode display name, the system will try to display your unicode name when possbile. It will also be your default in terminal prompt, chat and your tilde path
</br>
the linux os only sees your true ascii username. so your ssh login, file permissions etc will user your true username
</br>
feedback on this feature welcome
</p>
{%endblock%} {%endblock%}

23
templates/rules.html Normal file
View File

@ -0,0 +1,23 @@
{%extends "layout.html"%}
{%block content%}
<p>
<h3>Rules</h3>
<ol>
<li>you must 18 or older to use lingy.in</li>
<li>since this is multiuser system, show good judgement with the server resources (ie dont start mining crypto)</li>
<li>don't damage/delete others work</li>
<li>don't upload child pornography to lingy.in</li>
<li>don't use lingy.in to distribute malware</li>
<li>be smart with your data (fwiw, when i use a shared system like this i assume all data i have on the box is effecitvely comprimised)</li>
</ol>
</br>
<h3>some things to consider:</h3>
<ol>
<li>relax and try not to take the things others say too seriously.</li>
<li>no implementation is perfect. so i encourage you to make your own tilde with different rules and designs</li>
<li>On your first login throw something fun in your index.html even if its just placeholder.</li>
</ol>
<p>
{%endblock%}