Unpacking modules

This commit is contained in:
Yusur 2019-10-23 21:09:51 +02:00
parent 1e7787e24e
commit a9006bf1bc
36 changed files with 971 additions and 822 deletions

7
app/templates/404.html Normal file
View file

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block body %}
<h2>Not Found</h2>
<p><a href="/">Back to homepage.</a></p>
{% endblock %}

34
app/templates/about.html Normal file
View file

@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block body %}
<h1>About {{ site_name }}</h1>
<p>{{ site_name }} {{ version }} &ndash; Python {{ python_version }} &ndash;
Flask {{ flask_version }}</p>
<p>Copyright &copy; 2019 Sakuragasaki46.</p>
<h2>License</h2>
<p>Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<p>Source code for this site: <a
href="https://github.com/sakuragasaki46/coriplus/">
https://github.com/sakuragasaki46/coriplus/</a>
{% endblock %}

43
app/templates/base.html Normal file
View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ site_name }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/static/style.css">
<meta name="og:title" content="Cori+">
<meta name="og:description" content="A simple social network. Post text statuses, optionally with image.">
</head>
<body>
<div class="header">
<h1><a href="{{ url_for('website.homepage') }}">{{ site_name }}</a></h1>
<div class="metanav">
{% if current_user.is_anonymous %}
<a href="{{ url_for('website.login', next=request.full_path) }}">log in</a>
<a href="{{ url_for('website.register', next=request.full_path) }}">register</a>
{% else %}
<a href="{{ url_for('website.user_detail', username=current_user.username) }}">{{ current_user.username }}</a>
{% set notification_count = current_user.unseen_notification_count() %}
{% if notification_count > 0 %}
<a href="{{ url_for('website.notifications') }}">(<strong>{{ notification_count }}</strong>)</a>
{% endif %}
-
<a href="{{ url_for('website.public_timeline') }}">explore</a>
<a href="{{ url_for('website.create') }}">create</a>
<a href="{{ url_for('website.logout') }}">log out</a>
{% endif %}
</div>
</div>
<div class="content">
{% for message in get_flashed_messages() %}
<div class="flash">{{ message }}</div>
{% endfor %}
{% block body %}{% endblock %}
</div>
<div class="footer">
<p class="copyright">&copy; 2019 Sakuragasaki46.
<a href="/about/">About</a> - <a href="/terms/">Terms</a> -
<a href="/privacy/">Privacy</a></p>
</div>
<script src="/static/lib.js"></script>
</body>
</html>

18
app/templates/create.html Normal file
View file

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block body %}
<h2>Create</h2>
<form action="{{ url_for('website.create') }}" method="POST" enctype="multipart/form-data">
<dl>
<dt>Message:</dt>
<dd><textarea name="text" placeholder="What's happening?" class="create_text">{{ request.args['preload'] }}</textarea></dd>
<dd id="fileInputContainer"><a href="javascript:attachFileInput();">Add a file...</a>
<dd><select name="privacy">
<option value="0">Public - everyone in your profile or public timeline</option>
<option value="1">Unlisted - everyone in your profile, hide from public timeline</option>
<option value="2">Friends - only people you follow each other</option>
<option value="3">Only you</option>
</select></dd>
<dd><input type="submit" value="Create" /></dd>
</dl>
</form>
{% endblock %}

17
app/templates/edit.html Normal file
View file

@ -0,0 +1,17 @@
{% extends "base.html" %}
{% block body %}
<h2>Edit</h2>
<form action="{{ url_for('website.edit', id=message.id) }}" method="POST" enctype="multipart/form-data">
<dl>
<dt>Message:</dt>
<dd><textarea name="text" required="" class="create_text">{{ message.text }}</textarea></dd>
<dd><select name="privacy">
<option value="0"{% if message.privacy == '0' %} selected{% endif %}>Public - everyone in your profile or public timeline</option>
<option value="1"{% if message.privacy == '1' %} selected{% endif %}>Unlisted - everyone in your profile, hide from public timeline</option>
<option value="2"{% if message.privacy == '2' %} selected{% endif %}>Friends - only people you follow each other</option>
<option value="3"{% if message.privacy == '3' %} selected{% endif %}>Only you</option>
</select></dd>
<dd><input type="submit" value="Save" /></dd>
</dl>
</form>
{% endblock %}

View file

@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block body %}
<h2>Edit Profile</h2>
<form method="POST">
<dl>
<dt>Username:</dt>
<dd><input type="text" class="username-input" name="username" required value="{{ current_user.username }}" autocomplete="off"></dd>
{% if not profile %}
{% set profile = current_user.profile %}
{% endif %}
<dt>Full name:</dt>
<dd><input type="text" name="full_name" value="{{ profile.full_name }}"></dd>
<dt>Biography:</dt>
<dd><textarea class="biography_text" name="biography">{{ profile.biography }}</textarea></dd>
<dt>Location:</dt>
<dd>{% include "includes/location_selector.html" %}</dd>
<dt>Generation:</dt>
<dd>
<input type="checkbox" class="before-toggle" name="has_year" value="1" {% if profile.year %}checked{% endif %}>
<input type="number" name="year" value="{{ profile.year or 2000 }}">
</dd>
<dt>Website:</dt>
<dd><input type="text" name="website" value="{{ profile.website or '' }}"></dd>
<dt>Instagram:</dt>
<dd><input type="text" name="instagram" value="{{ profile.instagram or '' }}"></dd>
<dt>Facebook:</dt>
<dd><input type="text" name="facebook" value="{{ profile.facebook or '' }}"></dd>
<dt>Telegram:</dt>
<dd><input type="text" name="telegram" value="{{ profile.telegram or '' }}"></dd>
<dd><input type="submit" value="Save"></dd>
</dl>
</form>
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block body %}
<h2>Explore</h2>
<ul>
{% for message in message_list %}
<li id="{{ message.id }}">{% include "includes/message.html" %}</li>
{% endfor %}
</ul>
{% include "includes/pagination.html" %}
{% endblock %}

View file

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block body %}
<h2>Hello</h2>
<p>{{ site_name }} is made by people like you. <br/>
<a href="{{ url_for('website.login') }}">Log in</a> or <a href="{{ url_for('website.register') }}">register</a> to see more.</p>
{% endblock %}

View file

@ -0,0 +1,35 @@
{% set profile = user.profile %}
<div class="infobox">
<h3>{{ profile.full_name }}</h3>
<p>{{ profile.biography|enrich }}</p>
{% if profile.location %}
<p><span class="weak">Location:</span> {{ profile.location|locationdata }}</p>
{% endif %}
{% if profile.year %}
<p><span class="weak">Year:</span> {{ profile.year }}</p>
{% endif %}
{% if profile.website %}
{% set website = profile.website %}
{% set website = website if website.startswith(('http://', 'https://')) else 'http://' + website %}
<p><span class="weak">Website:</span> {{ profile.website|urlize }}</p>
{% endif %}
{% if profile.instagram %}
<p><span class="weak">Instagram:</span> <a href="https://www.instagram.com/{{ profile.instagram }}">{{ profile.instagram }}</a></p>
{% endif %}
{% if profile.facebook %}
<p><span class="weak">Facebook:</span> <a href="https://facebook.com/{{ profile.facebook }}">{{ profile.facebook }}</a></p>
{% endif %}
{% if profile.telegram %}
<p><span class="weak">Telegram:</span> <a href="https://t.me/{{ profile.facebook }}">{{ profile.telegram }}</a></p>
{% endif %}
<p>
<strong>{{ user.messages|count }}</strong> messages
-
<a href="{{ url_for('website.user_followers', username=user.username) }}"><strong>{{ user.followers()|count }}</strong></a> followers
-
<a href="{{ url_for('website.user_following', username=user.username) }}"><strong>{{ user.following()|count }}</strong></a> following
</p>
{% if user == current_user %}
<p><a href="/edit_profile/">Edit profile</a></p>
{% endif %}
</div>

View file

@ -0,0 +1,6 @@
<select name="location">
<option value="0">Not Applicable</option>
{% for k, v in locations.items() %}
<option value="{{ k }}">{{ v }}</option>
{% endfor %}
</select>

View file

@ -0,0 +1,27 @@
<p class="message-content">{{ message.text|enrich }}</p>
{% if message.uploads %}
<div class="message-visual">
<img src="/uploads/{{ message.uploads[0].filename() }}">
</div>
{% endif %}
<p class="message-footer">
<a href="{{ url_for('website.user_detail', username=message.user.username) }}">{{ message.user.username }}</a>
-
{% set message_privacy = message.privacy %}
{% if message.privacy in (0, 1) %} Public
{% elif message.privacy == 2 %} Friends
{% elif message.privacy == 3 %} Only me
{% endif %}
-
<time datetime="{{ message.pub_date.isoformat() }}" title="{{ message.pub_date.ctime() }}">{{ message.pub_date | human_date }}</time>
-
<a href="javascript:void(0);" onclick="showHideMessageOptions({{ message.id }});" class="message-options-showhide"></a>
</p>
<ul class="message-options">
{% if message.user == current_user %}
<li><a href="/edit/{{ message.id }}">Edit or change privacy</a></li>
<!--li><a href="/confirm_delete/{{ message.id }}">Delete</a></li-->
{% else %}
<!--li><a href="/report/{{ message.id }}">Report</a></li-->
{% endif %}
</ul>

View file

@ -0,0 +1,13 @@
{% set detail = json.loads(notification.detail) %}
{% if notification.type == 'follow' %}
{% set user = User[detail['user']] %}
<p><a href="/+{{ user.username }}">{{ user.username }}</a> started following you.</p>
{% elif notification.type == 'mention' %}
{% set user = User[detail['user']] %}
<p><a href="/+{{ user.username }}">{{ user.username }}</a> mentioned you in a message.</p>
{% else %}
<p>Unknown Notification</p>
{% endif %}
<small>{{ notification.pub_date | human_date }}</small>

View file

@ -0,0 +1,6 @@
{% if page > 1 %}
<a class="prev" href="?page={{ page - 1 }}">Previous</a>
{% endif %}
{% if page < pages %}
<a class="next" href="?page={{ page + 1 }}">Next</a>
{% endif %}

35
app/templates/join.html Normal file
View file

@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block body %}
<h2>Join {{ site_name }}</h2>
<form action="{{ url_for('website.register') }}" method="POST">
<dl>
<dt>Username:</dt>
<dd><input type="text" class="username-input" name="username" autocomplete="off"></dd>
<dt>Full name:</dt>
<dd>
<small class="field_desc">If not given, defaults to your username.</small>
<input type="text" name="full_name">
</dd>
<dt>Password:</dt>
<dd><input type="password" name="password"></dd>
<dt>Email:</dt>
<dd><input type="text" name="email"></dd>
<dt>Birthday:</dt>
<dd>
<small class="field_desc">Your birthday won't be shown to anyone.</small>
<input type="text" name="birthday" placeholder="yyyy-mm-dd">
</dd>
{% if not current_user.is_anonymous %}
<dd>
<input type="checkbox" name="confirm_another" value="1">
<label for="confirm_another">I want to create another account</label>
</dd>
{% endif %}
<dd>
<input type="checkbox" name="legal" value="1">
<label for="legal">I've read the <a href="/terms/">Terms of Service</a> and <a href="/privacy/">Privacy Policy</a>.</label>
</dd>
<dd><input type="submit" value="Join">
</dl>
</form>
{% endblock %}

21
app/templates/login.html Normal file
View file

@ -0,0 +1,21 @@
{% extends "base.html" %}
{% block body %}
<h2>Login</h2>
{% if error %}<p class=error><strong>Error:</strong> {{ error }}{% endif %}
<form method="POST">
<dl>
<dt>Username or email:
<dd><input type="text" name="username">
<dt>Password:
<dd><input type="password" name="password">
<dt>Remember me for:
<dd><select name="remember">
<option value="0">This session only</option>
<option value="7">A week</option>
<option value="30">A month</option>
<option value="365">A year</option>
</select></dd>
<dd><input type="submit" value="Login">
</dl>
</form>
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block body %}
<h2>Notifications</h2>
<ul>
{% for notification in notification_list %}
<li>{% include "includes/notification.html" %}</li>
{% endfor %}
</ul>
{% include "includes/pagination.html" %}
{% endblock %}

View file

@ -0,0 +1,47 @@
{% extends "base.html" %}
{% block body %}
<h1>Privacy Policy</h1>
<p>At {{ site_name }}, accessible from {{ request.host }}, one of our main priorities is the privacy of our visitors. This Privacy Policy document contains types of information that is collected and recorded by {{ site_name }} and how we use it.</p>
<p>If you have additional questions or require more information about our Privacy Policy, do not hesitate to contact us through email at sakuragasaki46@gmail.com</p>
<h2>Log Files</h2>
<p>{{ site_name }} follows a standard procedure of using log files. These files log visitors when they visit websites. All hosting companies do this and a part of hosting services' analytics. The information collected by log files include internet protocol (IP) addresses, browser type, Internet Service Provider (ISP), date and time stamp, referring/exit pages, and possibly the number of clicks. These are not linked to any information that is personally identifiable. The purpose of the information is for analyzing trends, administering the site, tracking users' movement on the website, and gathering demographic information.</p>
<h2>Cookies and Web Beacons</h2>
<p>Like any other website, {{ site_name }} uses 'cookies'. These cookies are used to store information including visitors' preferences, and the pages on the website that the visitor accessed or visited. The information is used to optimize the users' experience by customizing our web page content based on visitors' browser type and/or other information.</p>
<h2>Privacy Policies</h2>
<P>You may consult this list to find the Privacy Policy for each of the advertising partners of {{ site_name }}. Our Privacy Policy was created with the help of the <a href="https://www.privacypolicygenerator.info">Privacy Policy Generator</a> and the <a href="https://www.generateprivacypolicy.com">Generate Privacy Policy Generator</a>.</p>
<p>Third-party ad servers or ad networks uses technologies like cookies, JavaScript, or Web Beacons that are used in their respective advertisements and links that appear on {{ site_name }}, which are sent directly to users' browser. They automatically receive your IP address when this occurs. These technologies are used to measure the effectiveness of their advertising campaigns and/or to personalize the advertising content that you see on websites that you visit.</p>
<p>Note that {{ site_name }} has no access to or control over these cookies that are used by third-party advertisers.</p>
<h2>Third Party Privacy Policies</h2>
<p>{{ site_name }}'s Privacy Policy does not apply to other advertisers or websites. Thus, we are advising you to consult the respective Privacy Policies of these third-party ad servers for more detailed information. It may include their practices and instructions about how to opt-out of certain options. You may find a complete list of these Privacy Policies and their links here: Privacy Policy Links.</p>
<p>You can choose to disable cookies through your individual browser options. To know more detailed information about cookie management with specific web browsers, it can be found at the browsers' respective websites. What Are Cookies?</p>
<h2>Children's Information</h2>
<p>Another part of our priority is adding protection for children while using the internet. We encourage parents and guardians to observe, participate in, and/or monitor and guide their online activity.</p>
<p>{{ site_name }} does not knowingly collect any Personal Identifiable Information from children under the age of 13. If you think that your child provided this kind of information on our website, we strongly encourage you to contact us immediately and we will do our best efforts to promptly remove such information from our records.</p>
<h2>Online Privacy Policy Only</h2>
<p>This Privacy Policy applies only to our online activities and is valid for visitors to our website with regards to the information that they shared and/or collect in {{ site_name }}. This policy is not applicable to any information collected offline or via channels other than this website.</p>
<h2>Consent</h2>
<p>By using our website, you hereby consent to our Privacy Policy and agree to its Terms and Conditions.</p>
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block body %}
<h2>Your Timeline</h2>
<ul>
{% for message in message_list %}
<li id="{{ message.id }}">{% include "includes/message.html" %}</li>
{% endfor %}
</ul>
{% include "includes/pagination.html" %}
{% endblock %}

7
app/templates/terms.html Normal file
View file

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block body %}
<h1>Terms of Service</h1>
{% endblock %}

View file

@ -0,0 +1,27 @@
{% extends "base.html" %}
{% block body %}
{% include "includes/infobox_profile.html" %}
<h2>Messages from {{ user.username }}</h2>
{% if not current_user.is_anonymous %}
{% if user.username != current_user.username %}
{% if current_user|is_following(user) %}
<form action="{{ url_for('website.user_unfollow', username=user.username) }}" method="post">
<input type="submit" class="follow_button following" value="- Un-follow" />
</form>
{% else %}
<form action="{{ url_for('website.user_follow', username=user.username) }}" method="post">
<input type="submit" class="follow_button" value="+ Follow" />
</form>
{% endif %}
<p><a href="/create/?preload=%2B{{ user.username }}">Mention this user in a message</a></p>
{% else %}
<a href="/create/">Create a message</a>
{% endif %}
{% endif %}
<ul>
{% for message in message_list %}
<li id="{{ message.id }}">{% include "includes/message.html" %}</li>
{% endfor %}
</ul>
{% include "includes/pagination.html" %}
{% endblock %}

10
app/templates/user_list.html Executable file
View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block body %}
<h1>{{ title }}</h1>
<ul>
{% for user in user_list %}
<li><a href="/+{{ user.username }}">{{ user.username }}</a></li>
{% endfor %}
</ul>
{% endblock %}