Compare commits
23 Commits
c295d52520
...
master
Author | SHA1 | Date | |
---|---|---|---|
950c9a6aea | |||
414c300b41 | |||
a5ac19a2a4 | |||
78c0895418 | |||
8cbe7eecd3 | |||
9090da987f | |||
650e77210e | |||
16a45c495d | |||
08ae04a154 | |||
78384a31fb | |||
60280917c6 | |||
8f8c0c1401 | |||
979adc3b13 | |||
619ce9b0bd | |||
bcec5d05c8 | |||
71f8ff967c | |||
d61fd3bb2c | |||
234230c14a | |||
a22c1a4e1e | |||
51693a7860 | |||
8f95303d11 | |||
92b314623a | |||
1c6293fda3 |
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,7 +1,8 @@
|
||||
gitea/
|
||||
gitea
|
||||
.env
|
||||
pmb-pf/
|
||||
pmb-pf
|
||||
venv
|
||||
zapp.db
|
||||
db/bu
|
||||
tor/hidden_service/
|
||||
tor/hidden_service
|
||||
sshtun/oilykey
|
||||
|
@ -18,7 +18,7 @@ def send_email(subject, sender, recipients, text_body, html_body):
|
||||
def send_password_reset_email(user):
|
||||
token = user.get_reset_password_token()
|
||||
hostname = app.config['REAL_HOSTNAME']
|
||||
send_email('[Blog] Reset Password',
|
||||
send_email('reset oily password',
|
||||
sender=app.config['ADMINS'][0],
|
||||
recipients=[user.email],
|
||||
text_body=render_template('email/reset_password.txt', hostname=hostname, user=user, token=token),
|
||||
|
@ -51,7 +51,7 @@ class ResetPasswordRequestForm(FlaskForm):
|
||||
submit = SubmitField('Request Password Reset')
|
||||
|
||||
class PostForm(FlaskForm):
|
||||
post = TextAreaField('Post:', validators=[DataRequired(), Length(min=1, max=140)])
|
||||
post = TextAreaField('Post', validators=[DataRequired(), Length(min=1, max=140)])
|
||||
submit = SubmitField('Submit')
|
||||
|
||||
class EmptyForm(FlaskForm):
|
||||
|
@ -66,7 +66,7 @@ class User(UserMixin, db.Model):
|
||||
'#5000FF',
|
||||
'#FF0030']
|
||||
|
||||
background = '#151515'
|
||||
background = '#030303'
|
||||
|
||||
digest = hashlib.md5(self.email.lower().encode('utf-8')).hexdigest()
|
||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
@ -37,18 +37,19 @@ def index():
|
||||
next_url = url_for('index', page=posts.next_num) if posts.has_next else None
|
||||
prev_url = url_for('index', page=posts.prev_num) if posts.has_prev else None
|
||||
|
||||
return render_template('index.html', title='Home', form=form, posts=posts.items, next_url=next_url, prev_url=prev_url)
|
||||
return render_template('index.html', title='oily home', form=form, posts=posts.items, next_url=next_url, prev_url=prev_url)
|
||||
|
||||
@app.route('/explore')
|
||||
@login_required
|
||||
def explore():
|
||||
query = sa.select(Post).order_by(Post.timestamp.desc())
|
||||
page = request.args.get('page', 1, type=int)
|
||||
posts = db.paginate(query, page=page, per_page=app.config['POSTS_PER_PAGE'], error_out=False)
|
||||
ppp = app.config['POSTS_PER_PAGE'] * 2
|
||||
posts = db.paginate(query, page=page, per_page=ppp, error_out=False)
|
||||
next_url = url_for('explore', page=posts.next_num) if posts.has_next else None
|
||||
prev_url = url_for('explore', page=posts.prev_num) if posts.has_prev else None
|
||||
|
||||
return render_template('explore.html', title='Explore', posts=posts.items, next_url=next_url, prev_url=prev_url)
|
||||
return render_template('explore.html', title='oily explore', posts=posts.items, next_url=next_url, prev_url=prev_url)
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
@ -65,7 +66,7 @@ def login():
|
||||
if not next_page or urlsplit(next_page).netloc != '':
|
||||
next_page = url_for('index')
|
||||
return redirect(next_page)
|
||||
return render_template('login.html', title='Sign In', form=form)
|
||||
return render_template('login.html', title='oily sign in', form=form)
|
||||
|
||||
@app.route('/logout')
|
||||
def logout():
|
||||
@ -76,6 +77,9 @@ def logout():
|
||||
def register():
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('index'))
|
||||
if not app.config['ALLOW_REGISTRATION'] == "true":
|
||||
flash('Registration temporarily disabled.')
|
||||
return redirect(url_for('login'))
|
||||
form = RegistrationForm()
|
||||
if form.validate_on_submit():
|
||||
user = User(username=form.username.data, email=form.email.data)
|
||||
@ -85,7 +89,7 @@ def register():
|
||||
#user.gen_avatar()
|
||||
flash('User has been created.')
|
||||
return redirect(url_for('login'))
|
||||
return render_template('register.html', title='Register', form=form)
|
||||
return render_template('register.html', title='oily register', form=form)
|
||||
|
||||
@app.route('/reset_password/<token>', methods=['GET', 'POST'])
|
||||
def reset_password(token):
|
||||
@ -107,6 +111,7 @@ def reset_password(token):
|
||||
@login_required
|
||||
def user(username):
|
||||
user = db.first_or_404(sa.select(User).where(User.username == username))
|
||||
shortname = (current_user.username[:10] + '...') if len(current_user.username) > 14 else current_user.username
|
||||
page = request.args.get('page', 1, type=int)
|
||||
query = user.posts.select().order_by(Post.timestamp.desc())
|
||||
posts = db.paginate(query, page=page, per_page=app.config['POSTS_PER_PAGE'], error_out=False)
|
||||
@ -114,12 +119,13 @@ def user(username):
|
||||
prev_url = url_for('user', username=user.username, page=posts.prev_num) if posts.has_prev else None
|
||||
|
||||
form = EmptyForm()
|
||||
return render_template('user.html', user=user, posts=posts.items, next_url=next_url, prev_url=prev_url, form=form)
|
||||
return render_template('user.html', title='oily profile - '+shortname, user=user, posts=posts.items, next_url=next_url, prev_url=prev_url, form=form)
|
||||
|
||||
@app.route('/edit_profile', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def edit_profile():
|
||||
form = EditProfileForm(current_user.username)
|
||||
shortname = (current_user.username[:10] + '...') if len(current_user.username) > 14 else current_user.username
|
||||
if form.validate_on_submit():
|
||||
current_user.username = form.username.data
|
||||
current_user.about_me = form.about_me.data
|
||||
@ -129,7 +135,7 @@ def edit_profile():
|
||||
elif request.method == 'GET':
|
||||
form.username.data = current_user.username
|
||||
form.about_me.data = current_user.about_me
|
||||
return render_template('edit_profile.html', title='Edit Profile', form=form)
|
||||
return render_template('edit_profile.html', title='oily edit profile - '+shortname, form=form)
|
||||
|
||||
@app.route('/follow/<username>', methods=['POST'])
|
||||
@login_required
|
||||
@ -180,6 +186,6 @@ def reset_password_request():
|
||||
send_password_reset_email(user)
|
||||
flash('Password reset sent.')
|
||||
return redirect(url_for('login'))
|
||||
return render_template('reset_password_request.html', title='Reset Password', form=form)
|
||||
return render_template('reset_password_request.html', title='oily password reset', form=form)
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>File Not Found</h1>
|
||||
<p><a href="{{ url_for('index') }}">Back</a></p>
|
||||
<h2>File Not Found</h1>
|
||||
<p><a href="{{ url_for('index') }}">Back</a></p>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>An unexpected error has occurred.</h1>
|
||||
<p>Administrator has been notified.</p>
|
||||
<p><a href="{{ url_for('index') }}">Back</a></p>
|
||||
<h2>An unexpected error has occurred.</h1>
|
||||
<p>Administrator has been notified.</p>
|
||||
<p><a href="{{ url_for('index') }}">Back</a></p>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,13 +1,11 @@
|
||||
<table>
|
||||
<tr style="vertical-align: top;">
|
||||
<td style="vertical-align: middle; width: 60px;">
|
||||
<img style="vertical-align: middle; width: 40px;" src="data:image/png;base64,{{ post.author.gen_avatar(write_png=False) }}">
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('user', username=post.author.username) }}">
|
||||
{{ post.author.username }}
|
||||
</a> says:<br>
|
||||
{{ post.body }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr style="vertical-align: top;">
|
||||
<td style="vertical-align: middle; width: 60px;">
|
||||
<img style="vertical-align: middle; width: 40px;" src="data:image/png;base64,{{ post.author.gen_avatar(write_png=False) }}">
|
||||
</td>
|
||||
<td style="word-break: break-word;">
|
||||
<a href="{{ url_for('user', username=post.author.username) }}">
|
||||
{{ post.author.username }}
|
||||
</a> says:<br>
|
||||
{{ post.body }}
|
||||
</td>
|
||||
</tr>
|
||||
|
14
backend/app/templates/_postnav.html
Normal file
14
backend/app/templates/_postnav.html
Normal file
@ -0,0 +1,14 @@
|
||||
<div>
|
||||
{% if prev_url %}
|
||||
<a class="button" href="{{ prev_url }}">Newer</a>
|
||||
{% else %}
|
||||
<a class="button" aria-disabled=true>Newer</a>
|
||||
{% endif %}
|
||||
|
||||
{% if next_url %}
|
||||
<a class="button" href="{{ next_url }}">Older</a>
|
||||
{% else %}
|
||||
<a class="button" aria-disabled=true>Older</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -1,42 +1,44 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='simple.css') }}">
|
||||
{% if title %}
|
||||
<title>{{ title }} - blogpage</title>
|
||||
{% else %}
|
||||
<title>Welcome to blog.</title>
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a {% block indexcurrent %}{% endblock %} href="{{ url_for('index') }}">home</a>
|
||||
<a {% block explorecurrent %}{% endblock %} href="{{ url_for('explore') }}">explore</a>
|
||||
{% if current_user.is_anonymous %}
|
||||
<a {% block logincurrent %}{% endblock %} href="{{ url_for('login') }}">login</a>
|
||||
{% else %}
|
||||
<a {% block profilecurrent %}{% endblock %} href="{{ url_for('user', username=current_user.username) }}">profile</a>
|
||||
<a href="{{ url_for('logout') }}">logout</a>
|
||||
{% endif %}
|
||||
<head>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='simple.css') }}">
|
||||
{% if title %}
|
||||
<title>{{ title }}</title>
|
||||
{% else %}
|
||||
<title>oily page</title>
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a {% block indexcurrent %}{% endblock %} href="{{ url_for('index') }}">home</a>
|
||||
<a {% block explorecurrent %}{% endblock %} href="{{ url_for('explore') }}">explore</a>
|
||||
{% if current_user.is_anonymous %}
|
||||
<a {% block logincurrent %}{% endblock %} href="{{ url_for('login') }}">login</a>
|
||||
{% else %}
|
||||
<a {% block profilecurrent %}{% endblock %} href="{{ url_for('user', username=current_user.username) }}">profile</a>
|
||||
<a href="{{ url_for('logout') }}">logout</a>
|
||||
{% endif %}
|
||||
<a href="https://gut.oily.dad/explore/repos">
|
||||
<img style="vertical-align: middle; horizontal-align: center; height: 22px" src="https://gut.oily.dad/assets/img/logo.svg" alt="Logo" aria-hidden="true">
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
</nav>
|
||||
<h1>oily.dad</h1>
|
||||
<h4>destroy me</h4>
|
||||
</header>
|
||||
<hr>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul>
|
||||
{% for message in messages %}
|
||||
<p class="notice">{{ message }}</p>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<h2>oily.dad</h2>
|
||||
</header>
|
||||
<hr>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul>
|
||||
{% for message in messages %}
|
||||
<p class="notice">{{ message }}</p>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Edit Profile</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.username.label }}
|
||||
{{ form.username(size=32) }}
|
||||
{% for error in form.username.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.about_me.label }}
|
||||
{{ form.about_me(cols=50, rows=4) }}
|
||||
{% for error in form.about_me.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit }}</p>
|
||||
</form>
|
||||
<h2>Edit Profile</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.username.label }}
|
||||
{{ form.username(size=32) }}
|
||||
{% for error in form.username.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.about_me.label }}
|
||||
{{ form.about_me(cols=50, rows=4) }}
|
||||
{% for error in form.about_me.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit }}</p>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,10 +1,10 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<p>User {{ user.username }} requested password reset.</p>
|
||||
<p>Reset link:</p>
|
||||
<p><a href="{{ hostname }}{{ url_for('reset_password', token=token) }}">click here</a>
|
||||
<p>If you did not request this, ignore this message.</p>
|
||||
</body>
|
||||
<body>
|
||||
<p>User {{ user.username }} requested password reset.</p>
|
||||
<p>Reset link:</p>
|
||||
<p><a href="{{ hostname }}{{ url_for('reset_password', token=token) }}">click here</a>
|
||||
<p>If you did not request this, ignore this message.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -3,25 +3,26 @@
|
||||
{% block explorecurrent %}class="current"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Hello, {{ current_user.username }}!</h1>
|
||||
{% if form %}
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.post.label }}
|
||||
{{ form.post(cols=32, rows=4) }}
|
||||
{% for error in form.post.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% for post in posts %}
|
||||
{% include '_post.html' %}
|
||||
{% endfor %}
|
||||
{% if prev_url %}<a href="{{ prev_url }}">Newer Posts</a>{% endif %}
|
||||
{% if next_url %}<a href="{{ next_url }}">Older Posts</a>{% endif %}
|
||||
{% if form %}
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.post.label }}
|
||||
{{ form.post(cols=32, rows=4) }}
|
||||
{% for error in form.post.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
{% endif %}
|
||||
<table>
|
||||
{% for post in posts %}
|
||||
{% include '_post.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% include '_postnav.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
@ -3,25 +3,26 @@
|
||||
{% block indexcurrent %}class="current"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Hello, {{ current_user.username }}!</h1>
|
||||
{% if form %}
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.post.label }}
|
||||
{{ form.post(cols=32, rows=4) }}
|
||||
{% for error in form.post.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% for post in posts %}
|
||||
{% include '_post.html' %}
|
||||
{% endfor %}
|
||||
{% if prev_url %}<a href="{{ prev_url }}">Newer Posts</a>{% endif %}
|
||||
{% if next_url %}<a href="{{ next_url }}">Older Posts</a>{% endif %}
|
||||
{% if form %}
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.post.label }}
|
||||
{{ form.post(cols=32, rows=4) }}
|
||||
{% for error in form.post.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
{% endif %}
|
||||
<table>
|
||||
{% for post in posts %}
|
||||
{% include '_post.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% include '_postnav.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
@ -3,31 +3,31 @@
|
||||
{% block logincurrent %}class="current"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Sign In</h1>
|
||||
<form action="" method="post" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.username.label }}<br>
|
||||
{{ form.username(size=32) }}<br>
|
||||
{% for error in form.username.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password.label }}<br>
|
||||
{{ form.password(size=32) }}<br>
|
||||
{% for error in form.password.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.remember_me() }} {{ form.remember_me.label }}</p>
|
||||
<p>
|
||||
{{ form.submit }}
|
||||
<a class="button" href="{{ url_for('register') }}">Register</a>
|
||||
</p>
|
||||
</form>
|
||||
<h2>Sign In</h1>
|
||||
<form action="" method="post" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.username.label }}<br>
|
||||
{{ form.username(size=32) }}<br>
|
||||
{% for error in form.username.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password.label }}<br>
|
||||
{{ form.password(size=32) }}<br>
|
||||
{% for error in form.password.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.remember_me() }} {{ form.remember_me.label }}</p>
|
||||
<p>
|
||||
{{ form.submit }}
|
||||
<a class="button" href="{{ url_for('register') }}">Register</a>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<p><a href="{{ url_for('reset_password_request') }}">Reset Password</a></p>
|
||||
<p><a href="{{ url_for('reset_password_request') }}">Reset Password</a></p>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
@ -2,39 +2,39 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Register</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.username.label }}<br>
|
||||
{{ form.username(size=32) }}<br>
|
||||
{% for error in form.username.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.email.label }}<br>
|
||||
{{ form.email(size=64) }}<br>
|
||||
{% for error in form.email.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password.label }}<br>
|
||||
{{ form.password(size=64) }}<br>
|
||||
{% for error in form.password.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password2.label }}<br>
|
||||
{{ form.password2(size=64) }}<br>
|
||||
{% for error in form.password2.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit }}</p>
|
||||
</form>
|
||||
<h2>Register</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.username.label }}<br>
|
||||
{{ form.username(size=32) }}<br>
|
||||
{% for error in form.username.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.email.label }}<br>
|
||||
{{ form.email(size=64) }}<br>
|
||||
{% for error in form.email.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password.label }}<br>
|
||||
{{ form.password(size=64) }}<br>
|
||||
{% for error in form.password.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password2.label }}<br>
|
||||
{{ form.password2(size=64) }}<br>
|
||||
{% for error in form.password2.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit }}</p>
|
||||
</form>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
@ -2,25 +2,25 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Reset Your Password</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.password.label }}
|
||||
{{ form.password(size=32) }}
|
||||
{% for error in form.password.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password2.label }}
|
||||
{{ form.password2(size=32) }}
|
||||
{% for error in form.password2.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
<h2>Reset Your Password</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.password.label }}
|
||||
{{ form.password(size=32) }}
|
||||
{% for error in form.password.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{{ form.password2.label }}
|
||||
{{ form.password2(size=32) }}
|
||||
{% for error in form.password2.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,17 +1,17 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Reset Password</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.email.label }}<br>
|
||||
{{ form.email(size=64) }}<br>
|
||||
{% for error in form.email.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
<h2>Reset Password</h1>
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.email.label }}<br>
|
||||
{{ form.email(size=64) }}<br>
|
||||
{% for error in form.email.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -3,45 +3,40 @@
|
||||
{% block profilecurrent %}class="current"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td style="vertical-align: middle; text-align: center;">
|
||||
<img style="vertical-align: middle;" src="data:image/png;base64,{{ user.gen_avatar(write_png=False) }}">
|
||||
</td>
|
||||
<td>
|
||||
<h1>User: {{ user.username }}</h1>
|
||||
<h1>CUdebug: {{ current_user }}</h1>
|
||||
<h1>Udebug: {{ user }}</h1>
|
||||
{% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
|
||||
{% if user.last_seen %}<p>Last activity:{{ user.last_seen }}</p>{% endif %}
|
||||
{% if user == current_user %}
|
||||
<p><a href="{{ url_for('edit_profile') }}">Edit Profile</a></p>
|
||||
{% elif not current_user.is_following(user) %}
|
||||
<p>
|
||||
<form action="{{ url_for('follow', username=user.username) }}" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ form.submit(value='Follow') }}
|
||||
</form>
|
||||
</p>
|
||||
{% else %}
|
||||
<p>
|
||||
<form action="{{ url_for('unfollow', username=user.username) }}" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ form.submit(value='Unfollow') }}
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
<article>
|
||||
<h2>
|
||||
<img style="vertical-align: middle; width: 60px;" src="data:image/png;base64,{{ user.gen_avatar(write_png=False) }}">
|
||||
User: {{ user.username }}
|
||||
</h2>
|
||||
{% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
|
||||
{% if user.last_seen %}<p>Last activity: {{ user.last_seen }}</p>{% endif %}
|
||||
{% if user == current_user %}
|
||||
<p><a class="button" href="{{ url_for('edit_profile') }}">Edit Profile</a></p>
|
||||
{% elif not current_user.is_following(user) %}
|
||||
<p>
|
||||
<form action="{{ url_for('follow', username=user.username) }}" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ form.submit(value='Follow') }}
|
||||
</form>
|
||||
</p>
|
||||
{% else %}
|
||||
<p>
|
||||
<form action="{{ url_for('unfollow', username=user.username) }}" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ form.submit(value='Unfollow') }}
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
</article>
|
||||
<hr>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
{% for post in posts %}
|
||||
{% include '_post.html' %}
|
||||
{% endfor %}
|
||||
{% if prev_url %}<a href="{{ prev_url }}">Newer Posts</a>{% endif %}
|
||||
{% if next_url %}<a href="{{ next_url }}">Older Posts</a>{% endif %}
|
||||
<table>
|
||||
{% for post in posts %}
|
||||
{% include '_post.html' %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% include '_postnav.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
@ -16,6 +16,7 @@ class Config:
|
||||
ADMINS = [os.environ.get('DOTENV_ADMIN_EMAIL')]
|
||||
FROM_ADDRESS = os.environ.get('DOTENV_FROM_ADDRESS')
|
||||
REAL_HOSTNAME = os.environ.get('DOTENV_REAL_HOSTNAME')
|
||||
ALLOW_REGISTRATION = os.environ.get('DOTENV_ALLOW_REGISTRATION')
|
||||
|
||||
|
||||
DC_LOGGING = True
|
||||
|
23
compose.yaml
23
compose.yaml
@ -44,6 +44,7 @@ services:
|
||||
- DOTENV_FROM_ADDRESS=${FLASK_MAIL_FROM}
|
||||
- DOTENV_JWT_PHRASE=${FLASK_JWT_PHRASE}
|
||||
- DOTENV_REAL_HOSTNAME=${FLASK_REAL_HOSTNAME}
|
||||
- DOTENV_ALLOW_REGISTRATION=${ALLOW_REGISTRATION}
|
||||
#ports:
|
||||
# - 8000:8000
|
||||
expose:
|
||||
@ -76,8 +77,10 @@ services:
|
||||
- GITEA__mailer__SMTP_PORT=25
|
||||
- GITEA__service__REGISTER_EMAIL_CONFIRM=true
|
||||
- GITEA__service__ENABLE_NOTIFY_MAIL=true
|
||||
- GITEA__server__LANDING_PAGE=explore
|
||||
- GITEA__ui__REACTIONS="+1, -1, fu, heart, laugh, confused, hooray, eyes, gun, boom, poop, kiss"
|
||||
# To disable new users after setup:
|
||||
#- GITEA__service__DISABLE_REGISTRATION=false
|
||||
- GITEA__service__DISABLE_REGISTRATION=true
|
||||
networks:
|
||||
- backnet
|
||||
- frontnet
|
||||
@ -99,8 +102,8 @@ services:
|
||||
- /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro
|
||||
- /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
@ -134,6 +137,20 @@ services:
|
||||
networks:
|
||||
- backnet
|
||||
|
||||
sshtun:
|
||||
build:
|
||||
context: sshtun
|
||||
dockerfile: Dockerfile
|
||||
restart: on-failure
|
||||
environment:
|
||||
- USE_TUN=${USE_TUN}
|
||||
ports:
|
||||
- "22222:22"
|
||||
expose:
|
||||
- "11112"
|
||||
networks:
|
||||
- frontnet
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
pmb-root:
|
||||
|
@ -44,6 +44,7 @@ services:
|
||||
- DOTENV_FROM_ADDRESS=${FLASK_MAIL_FROM}
|
||||
- DOTENV_JWT_PHRASE=${FLASK_JWT_PHRASE}
|
||||
- DOTENV_REAL_HOSTNAME=${FLASK_REAL_HOSTNAME}
|
||||
- DOTENV_ALLOW_REGISTRATION=${ALLOW_REGISTRATION}
|
||||
#ports:
|
||||
# - 8000:8000
|
||||
expose:
|
||||
@ -77,7 +78,7 @@ services:
|
||||
- GITEA__service__REGISTER_EMAIL_CONFIRM=true
|
||||
- GITEA__service__ENABLE_NOTIFY_MAIL=true
|
||||
# To disable new users after setup:
|
||||
#- GITEA__service__DISABLE_REGISTRATION=false
|
||||
- GITEA__service__DISABLE_REGISTRATION=true
|
||||
networks:
|
||||
- backnet
|
||||
- frontnet
|
||||
@ -99,8 +100,8 @@ services:
|
||||
# - /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro
|
||||
# - /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
@ -117,12 +118,12 @@ services:
|
||||
- frontnet
|
||||
|
||||
pmb:
|
||||
build:
|
||||
args:
|
||||
GPG_PP: $BUILD_GPG_PP
|
||||
context: pmb-pf
|
||||
dockerfile: Dockerfile
|
||||
#image: site_pmb:latest
|
||||
#build:
|
||||
# args:
|
||||
# GPG_PP: $BUILD_GPG_PP
|
||||
# context: pmb-pf
|
||||
# dockerfile: Dockerfile
|
||||
image: site_pmb:latest
|
||||
expose:
|
||||
- "25"
|
||||
env_file:
|
||||
@ -134,6 +135,20 @@ services:
|
||||
networks:
|
||||
- backnet
|
||||
|
||||
sshtun:
|
||||
build:
|
||||
context: sshtun
|
||||
dockerfile: Dockerfile
|
||||
restart: on-failure
|
||||
environment:
|
||||
- USE_TUN=${USE_TUN}
|
||||
ports:
|
||||
- "22222:22"
|
||||
expose:
|
||||
- "11112"
|
||||
networks:
|
||||
- frontnet
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
pmb-root:
|
||||
|
@ -44,6 +44,7 @@ services:
|
||||
- DOTENV_FROM_ADDRESS=${FLASK_MAIL_FROM}
|
||||
- DOTENV_JWT_PHRASE=${FLASK_JWT_PHRASE}
|
||||
- DOTENV_REAL_HOSTNAME=${FLASK_REAL_HOSTNAME}
|
||||
- DOTENV_ALLOW_REGISTRATION=${ALLOW_REGISTRATION}
|
||||
#ports:
|
||||
# - 8000:8000
|
||||
expose:
|
||||
@ -76,8 +77,10 @@ services:
|
||||
- GITEA__mailer__SMTP_PORT=25
|
||||
- GITEA__service__REGISTER_EMAIL_CONFIRM=true
|
||||
- GITEA__service__ENABLE_NOTIFY_MAIL=true
|
||||
- GITEA__server__LANDING_PAGE=explore
|
||||
- GITEA__ui__REACTIONS="+1, -1, fu, heart, laugh, confused, hooray, eyes, gun, boom, poop, kiss"
|
||||
# To disable new users after setup:
|
||||
#- GITEA__service__DISABLE_REGISTRATION=false
|
||||
- GITEA__service__DISABLE_REGISTRATION=true
|
||||
networks:
|
||||
- backnet
|
||||
- frontnet
|
||||
@ -99,8 +102,8 @@ services:
|
||||
- /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro
|
||||
- /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
@ -117,12 +120,12 @@ services:
|
||||
- frontnet
|
||||
|
||||
pmb:
|
||||
build:
|
||||
args:
|
||||
GPG_PP: $BUILD_GPG_PP
|
||||
context: pmb-pf
|
||||
dockerfile: Dockerfile
|
||||
#image: site_pmb:latest
|
||||
#build:
|
||||
# args:
|
||||
# GPG_PP: $BUILD_GPG_PP
|
||||
# context: pmb-pf
|
||||
# dockerfile: Dockerfile
|
||||
image: site_pmb:latest
|
||||
expose:
|
||||
- "25"
|
||||
env_file:
|
||||
@ -134,6 +137,20 @@ services:
|
||||
networks:
|
||||
- backnet
|
||||
|
||||
sshtun:
|
||||
build:
|
||||
context: sshtun
|
||||
dockerfile: Dockerfile
|
||||
restart: on-failure
|
||||
environment:
|
||||
- USE_TUN=${USE_TUN}
|
||||
ports:
|
||||
- "22222:22"
|
||||
expose:
|
||||
- "11112"
|
||||
networks:
|
||||
- frontnet
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
pmb-root:
|
||||
|
32
dotenv
32
dotenv
@ -1,30 +1,34 @@
|
||||
# Example .env file
|
||||
DOTENV_MYSQL_ROOT_PASSWORD_OLD=rootp
|
||||
DOTENV_MYSQL_ROOT_PASSWORD=rootp
|
||||
DOTENV_MYSQL_ROOT_PASSWORD_OLD="rootp"
|
||||
DOTENV_MYSQL_ROOT_PASSWORD="rootp"
|
||||
|
||||
DOTENV_MYSQL_GITEA_PASSWORD=giteap
|
||||
DOTENV_MYSQL_FLASK_PASSWORD=flaskp
|
||||
DOTENV_MYSQL_GITEA_PASSWORD="giteap"
|
||||
DOTENV_MYSQL_FLASK_PASSWORD="flaskp"
|
||||
|
||||
GITEA_MAIL_FROM="git@e.e"
|
||||
GITEA_MAIL_FROM="git@aaa"
|
||||
|
||||
# Build ARG GPG_PP. May still need to be empty to avoid breakage.
|
||||
BUILD_GPG_PP=
|
||||
|
||||
# Tor:
|
||||
# true/false
|
||||
# true/false:
|
||||
USE_TOR=false
|
||||
# SSH Tun:
|
||||
# true/false:
|
||||
USE_TUN=false
|
||||
|
||||
# Backend:
|
||||
|
||||
FLASK_SECRET_KEY="flaskkey"
|
||||
# Inconsequential token: minimal inconvenience if exposed
|
||||
FLASK_TOKEN_I=dti
|
||||
|
||||
FLASK_TOKEN_I="dti"
|
||||
# Consequential token: protect
|
||||
FLASK_TOKEN_C=dtc
|
||||
|
||||
FLASK_MAIL_FROM="git@e.e"
|
||||
FLASK_TOKEN_C="dtc"
|
||||
# true/false:
|
||||
ALLOW_REGISTRATION=true
|
||||
FLASK_MAIL_FROM="git@aaa"
|
||||
# admin email must be valid send from with mail subsystem
|
||||
FLASK_ADMIN_EMAIL="git@e.e"
|
||||
FLASK_JWT_PHRASE="tphrase"
|
||||
FLASK_ADMIN_EMAIL="git@aaa"
|
||||
FLASK_JWT_PHRASE="jwtphrase"
|
||||
FLASK_REAL_HOSTNAME="localhost"
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@ server {
|
||||
root /var/www/html;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
add_header Onion-Location http://oilydada7ckiseinkbeathsefwgkvjrce743xy7x7iiybkuxh4vheead.onion$request_uri;
|
||||
|
||||
location / {
|
||||
proxy_pass http://backend:8000/;
|
||||
|
@ -22,6 +22,7 @@ server {
|
||||
root /var/www/html;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
add_header Onion-Location http://oilydada7ckiseinkbeathsefwgkvjrce743xy7x7iiybkuxh4vheead.onion$request_uri;
|
||||
|
||||
location / {
|
||||
proxy_pass http://backend:8000/;
|
||||
|
18
sshtun/Dockerfile
Normal file
18
sshtun/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
FROM debian:12-slim
|
||||
|
||||
RUN apt update && apt install -y openssh-server socat
|
||||
|
||||
RUN adduser --disabled-password --gecos "" finn
|
||||
|
||||
RUN mkdir /home/finn/.ssh
|
||||
|
||||
# only one pubkey -- wildcard to conceal filename
|
||||
COPY ./oilykey/*.pub /home/finn/.ssh/authorized_keys
|
||||
|
||||
RUN mkdir /var/run/sshd
|
||||
RUN echo "PermitRootLogin no" >> /etc/ssh/sshd_config
|
||||
RUN echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
|
||||
|
||||
COPY ./entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
14
sshtun/entrypoint.sh
Executable file
14
sshtun/entrypoint.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Container goal: egress
|
||||
# first: physical_box$ autossh -N -R 11111:localhost:11434 -i sshtun/oilykey/<SOMEKEY> -p 22222 <rem_vps_url>
|
||||
# will forward rem_c_port:physical_box:physical_box_port ...some args... rem_vps_p rem_vps_url
|
||||
# then: frontnet_c$ curl sshtun.frontnet:11112 --> physical_box:11434
|
||||
|
||||
if $USE_TUN ; then
|
||||
echo "@@@@@@@@@@ SSH TUNNEL ENABLED BY ENV"
|
||||
nohup socat TCP-LISTEN:11112,fork TCP:localhost:11111 &
|
||||
/usr/sbin/sshd -De
|
||||
else
|
||||
echo "@@@@@@@@@@ SSH TUNNEL DISABLED BY ENV"
|
||||
fi
|
||||
|
@ -1,8 +1,8 @@
|
||||
FROM debian:12-slim
|
||||
FROM alpine
|
||||
|
||||
RUN adduser --disabled-password --gecos "" tor
|
||||
|
||||
RUN apt update && apt install -y tor curl
|
||||
RUN apk update && apk add tor
|
||||
|
||||
COPY hidden_service /hidden_service
|
||||
COPY torrc /etc/tor/torrc
|
||||
@ -10,6 +10,7 @@ COPY entrypoint.sh /
|
||||
|
||||
RUN chown -R tor /etc/tor
|
||||
RUN chown -R tor /hidden_service
|
||||
RUN chown -R tor /entrypoint.sh
|
||||
RUN chmod -R go-rwx /etc/tor
|
||||
RUN chmod -R go-rwx /hidden_service
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
#!/bin/ash
|
||||
|
||||
if $USE_TOR ; then
|
||||
echo "@@@@@@@@@@ TOR ENABLED BY ENV"
|
||||
exec tor
|
||||
exec /usr/bin/tor
|
||||
else
|
||||
echo "@@@@@@@@@@ TOR DISABLED BY ENV"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user