fdfd
This commit is contained in:
parent
b8359c7bf8
commit
3a4a6e7523
12 changed files with 279 additions and 17 deletions
|
@ -507,6 +507,22 @@ def archiveorg(url):
|
|||
except Exception as e: print(e)
|
||||
|
||||
|
||||
@app.route("/embed/post/<pid>", methods=["GET"])
|
||||
def embed_post_pid(pid):
|
||||
|
||||
post = get_post(pid)
|
||||
|
||||
return render_template("embeds/post.html", p=post)
|
||||
|
||||
|
||||
@app.route("/embed/comment/<cid>", methods=["GET"])
|
||||
def embed_comment_cid(cid, pid=None):
|
||||
|
||||
comment = get_comment(cid)
|
||||
|
||||
return render_template("embeds/comment.html", c=comment)
|
||||
|
||||
|
||||
@app.post("/submit")
|
||||
@limiter.limit("6/minute")
|
||||
@is_not_banned
|
||||
|
@ -789,7 +805,7 @@ def submit_post(v):
|
|||
|
||||
url = url.replace("https://mobile.twitter.com", "https://twitter.com")
|
||||
|
||||
if url.startswith("https://old.reddit.com/") and '/comments/' in url and '?sort=' not in url: url += "?sort=controversial"
|
||||
# if url.startswith("https://old.reddit.com/") and '/comments/' in url and '?' not in url: url += "?sort=controversial"
|
||||
|
||||
title_html = sanitize(title, linkgen=True, flair=True)
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="{% block pagedesc %}{{"SITE_NAME" | app_config}} - the free speech social platform{% endblock %}">
|
||||
<meta name="description" content="{% block pagedesc %}{{"SITE_NAME" | app_config}}{% endblock %}">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>{% block pagetitle %}{{"SITE_NAME" | app_config}} - the open, free-speech social platform{% endblock %}</title>
|
||||
<title>{% block pagetitle %}{{"SITE_NAME" | app_config}}{% endblock %}</title>
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
|
||||
|
||||
|
|
|
@ -9,15 +9,6 @@
|
|||
{% block content %}
|
||||
<div class="">
|
||||
|
||||
<h1>Whoops!</h1>
|
||||
<p class="text-left">Although {{"SITE_NAME" | app_config}} puts your freedom of speech first, there are a few things that we don't allow here:</p>
|
||||
<ul>
|
||||
<li>Digitally malicious content</li>
|
||||
<li>URL shorteners</li>
|
||||
<li>Copyright infringement</li>
|
||||
<li>Spam</li>
|
||||
</ul>
|
||||
|
||||
<p>Please remove the following link(s) from your comment, and then you will be able to post it:</p>
|
||||
|
||||
<ul>
|
||||
|
|
130
files/templates/embeds/comment.html
Normal file
130
files/templates/embeds/comment.html
Normal file
|
@ -0,0 +1,130 @@
|
|||
{% extends "embeds/embed_default.html" %}
|
||||
|
||||
{% set score=c.score_fuzzed %}
|
||||
|
||||
{% block title %}
|
||||
<title>@{{ c.author.username }} comments in +{{ c.board.name }} on "{{ c.post.title }}"</title>
|
||||
<meta name="description" content="{{ c.body }}">
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<div class="post-info font-weight-bold">
|
||||
<span class="align-top"><a href="{{ c.permalink }}?context=1">{{ c.post.title | safe }}</a></span>
|
||||
</div>
|
||||
|
||||
<div id="comment-{{ c.base36id }}" class="comment rounded">
|
||||
|
||||
<span class="mr-2 d-block d-md-none"><a href="{{ c.author.permalink }}"><img src="{{ c.author.profile_url }}" class="profile-pic-25"></a></span>
|
||||
|
||||
<span class="comment-collapse d-md-block d-none" onclick="collapse_comment('{{ c.base36id }}')"></span>
|
||||
|
||||
<div class="comment-body">
|
||||
|
||||
<div id="comment-{{ c.base36id }}-only">
|
||||
|
||||
<div class="user-info">{% if c.over_18 %}<span class="badge badge-danger">nsfw</span> {% endif %}{% if c.author.title and c.author.title.is_before %}<span style="color:#{{ c.author.title.color }}">{{ c.author.title.text }}</span> {% endif %}<a href="{{ c.author.permalink }}" class="user-name {% if c.post.author_id==c.author_id %}text-info{% endif %}">{{ c.author.username }}</a>{% if c.author.title and not c.author.title.is_before %}<span style="color:#{{ c.author.title.color }}">{{ c.author.title.text }}</span>{% endif %}
|
||||
{% if c.distinguish_level or c.author_id==c.post.author_id %}
|
||||
<span> </span>
|
||||
{% if c.distinguish_level %}
|
||||
<i class="fas fa-shield text-admin" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Administrator, speaking officially"></i>
|
||||
{% endif %}
|
||||
{% if c.post.author_id==c.author_id %}
|
||||
<i class="fas fa-microphone-stand text-info" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Submitter"></i>
|
||||
{% endif %}
|
||||
<span> </span>
|
||||
{% endif %}
|
||||
<span class="time-stamp" data-toggle="tooltip" data-placement="bottom" data-delay='{"show":"700", "hide":"300"}' title="{{ p.created_datetime }}"><span>·</span> {{ c.age_string }}</span>
|
||||
{% if c.edited_utc %}
|
||||
<span class="time-edited" data-toggle="tooltip" data-placement="bottom" data-delay='{"show":"700", "hide":"300"}' title="{{ p.edited_datetime }}"><span>·</span> <span class="font-italic">Edited {{ c.edited_string }}</span></span>
|
||||
{% endif %}
|
||||
|
||||
<span class="comment-collapse d-md-none" onclick="collapse_comment('{{ c.base36id }}')"></span>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="comment-text-{{ c.base36id }}" class="comment-text">
|
||||
{{ c.body_html | safe }}
|
||||
</div>
|
||||
|
||||
|
||||
<div id="comment-{{ c.base36id }}-actions" class="comment-actions">
|
||||
<ul class="list-inline text-right text-md-left">
|
||||
|
||||
|
||||
|
||||
<li id="comment-{{ c.base36id }}-up" class="list-inline-item arrow-up d-none d-md-inline-block mr-2">
|
||||
</li>
|
||||
|
||||
|
||||
<li class="list-inline-item d-none d-md-inline-block mr-2">
|
||||
<span id="comment-{{ c.base36id }}-score-none"class="d-none text-black">{{ score }}</span> </li>
|
||||
|
||||
{% if not c.board.downvotes_disabled %}
|
||||
|
||||
|
||||
|
||||
<li id="comment-{{ c.base36id }}-down" class="list-inline-item arrow-down d-none d-md-inline-block">
|
||||
</li>
|
||||
|
||||
{% endif %}
|
||||
<li class="list-inline-item text-muted d-none d-md-inline-block"><a href="javascript:void(0);" role="button" class="copy-link" data-clipboard-text="{{ c.permalink | full_link}}"><i class="fas fa-link"></i><span>Copy link</span></a>
|
||||
</li>
|
||||
<li class="list-inline-item d-none d-md-inline-block">
|
||||
<div class="dropdown show">
|
||||
<a href="#" role="button" id="dropdownMoreLink" data-toggle="dropdown" aria-haspopup="true"
|
||||
aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu border-0 shadow" aria-labelledby="dropdownMoreLink">
|
||||
<a class="dropdown-item" href="{{ c.parent.permalink }}"><i class="fas fa-dna"></i>Parent</a>
|
||||
<a class="dropdown-item d-none" href="#"><i class="fas fa-save"></i>Save</a>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-inline-item d-inline-block d-md-none">
|
||||
<a href="#" data-toggle="modal" data-target="#actionsModal-{{ c.base36id }}" data-focus="false"><i class="fas fa-ellipsis-h"></i></a>
|
||||
</li>
|
||||
|
||||
<li id="comment-{{ c.base36id }}-up" class="list-inline-item arrow-up d-inline-block d-md-none mr-2">
|
||||
</li>
|
||||
<li class="list-inline-item d-inline-block d-md-none mr-2">
|
||||
<span id="comment-{{ c.base36id }}-score-none" class="d-none text-black">{{ score }}</span>
|
||||
</li>
|
||||
|
||||
<li id="comment-{{ c.base36id }}-down" class="list-inline-item arrow-down d-inline-block d-md-none">
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Comment Actions Modal -->
|
||||
<div class="modal fade d-md-none" id="actionsModal-{{ c.base36id }}" tabindex="-1" role="dialog" aria-labelledby="actionsModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title h6">More options</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="list-group comment-actions">
|
||||
<li class="list-group-item"><a href="javascript:void(0);" role="button" class="d-block copy-link" data-dismiss="modal" data-clipboard-text="{{ c.permalink | full_link}}"><i class="fas fa-link"></i><span>Share</span></a>
|
||||
<li class="list-group-item"><a class="d-block" href="{{ c.parent.permalink }}"><i class="fas fa-dna"></i>Parent</a></li>
|
||||
<li class="list-group-item d-none"><a href="#" class="d-block"><i class="fas fa-save"></i>Save</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
104
files/templates/embeds/embed_default.html
Normal file
104
files/templates/embeds/embed_default.html
Normal file
|
@ -0,0 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<meta name="author" content="">
|
||||
|
||||
{% block title %}
|
||||
{% endblock %}
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
|
||||
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||
|
||||
|
||||
{% block stylesheets %}
|
||||
<link id="css-link" rel="stylesheet" href="/assets/style/main.css">
|
||||
{% endblock %}
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link href="/assets/fontawesome/css/all.css" rel="stylesheet"> <!--load all styles -->
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body id="{% block pagetype %}frontpage{% endblock %}" class="p-1">
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="row justify-content-around" id="main-content-row">
|
||||
|
||||
<div class="col h-100 custom-gutters" id="main-content-col">
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Clipboard Toast -->
|
||||
|
||||
<div class="toast clipboard" id="toast-success" role="alert" aria-live="assertive" aria-atomic="true" data-animation="true" data-autohide="true" data-delay="5000">
|
||||
<div class="toast-body text-center">
|
||||
<i class="fas fa-check-circle text-success mr-2"></i>Link copied to clipboard
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast clipboard" id="toast-error" role="alert" aria-live="assertive" aria-atomic="true" data-animation="true" data-autohide="true" data-delay="5000">
|
||||
<div class="toast-body text-center">
|
||||
<i class="fas fa-exclamation-circle text-danger mr-2"></i>Unable to copy link
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "bootstrap.html" %}
|
||||
|
||||
|
||||
|
||||
<!-- ClipboardJS -->
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
|
||||
|
||||
<!-- Instantiate clipboard by passing a string selector -->
|
||||
<script type="text/javascript">
|
||||
var clipboard = new ClipboardJS('.copy-link');
|
||||
clipboard.on('success', function(e) {
|
||||
|
||||
jQuery(function($) {
|
||||
$('#toast-success').toast('show');
|
||||
})
|
||||
console.log(e);
|
||||
});
|
||||
clipboard.on('error', function(e) {
|
||||
|
||||
jQuery(function($) {
|
||||
$('#toast-error').toast('show');
|
||||
})
|
||||
console.log(e);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
{% block enlargeThumbJS %}
|
||||
{% endblock %}
|
||||
|
||||
{% block toggleView %}
|
||||
{% endblock %}
|
||||
|
||||
{% block embedJS %}
|
||||
{% endblock %}
|
||||
|
||||
{% block formatJS %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
<script src="/assets/js/all_js.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
21
files/templates/embeds/post.html
Normal file
21
files/templates/embeds/post.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends "embeds/embed_default.html" %}
|
||||
|
||||
{% block title %}
|
||||
<title>{{ p.title | safe}}</title>
|
||||
<meta name="description" content="posted {{ p.age_string }} by @{{ p.author.username }} in +{{ p.board.name }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block pagetype %}thread{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<div class="row no-gutters mt-md-3">
|
||||
<div class="col-12">
|
||||
<div class="posts" id="posts">
|
||||
{% with listing = [p] %}
|
||||
{% include "submission_listing.html" %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -25,7 +25,7 @@
|
|||
<meta name="twitter:image" content="{{'/assets/images/preview.png' | full_link}}" />
|
||||
<meta name="twitter:url" content="{{request.host}}" />
|
||||
|
||||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{"SITE_NAME" | app_config}}{% else %}{{"SITE_NAME" | app_config}}: the open, free-speech social platform{% endif %}</title>
|
||||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{"SITE_NAME" | app_config}}{% else %}{{"SITE_NAME" | app_config}}{% endif %}</title>
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
|
||||
|
||||
|
|
|
@ -267,13 +267,13 @@
|
|||
{{p.realbody(v) | safe}}
|
||||
|
||||
{% if p.domain == "twitter.com" and (v and v.theme.split("_")[0] in ["light", "coffee", "4chan"]) %}
|
||||
{% include "site_embeds/twitterlight.html" %}
|
||||
{% include "embeds/twitterlight.html" %}
|
||||
{% elif "twitter.com" in p.domain %}
|
||||
{% include "site_embeds/twitter.html" %}
|
||||
{% include "embeds/twitter.html" %}
|
||||
{% elif "youtu" in p.domain %}
|
||||
{% include "site_embeds/youtube.html" %}
|
||||
{% include "embeds/youtube.html" %}
|
||||
{% elif "instagram.com" in p.domain %}
|
||||
{% include "site_embeds/instagram.html" %}
|
||||
{% include "embeds/instagram.html" %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue