No upload from website.

This commit is contained in:
Julien Palard 2023-04-21 10:12:46 +02:00
parent a3365f3901
commit 8a5f3d2f14
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8
4 changed files with 41 additions and 67 deletions

View File

@ -0,0 +1,16 @@
html {
height: 100%;
}
body {
margin: 0;
height: 100%;
}
div {
height: 100%;
}
pre {
margin: 0;
}

View File

@ -5,28 +5,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% compress css %} {% compress css %}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<link href="/static/css/font-awesome.min.css" rel="stylesheet"> <link href="/static/css/font-awesome.min.css" rel="stylesheet">
<link href="/static/css/pygments-highlight.css" rel="stylesheet"> <link href="/static/css/pygments-highlight.css" rel="stylesheet">
{% endcompress %} {% endcompress %}
{% block extrastyle %}{% endblock %}
<title>{% block title %}{% endblock %} - {{ DISPLAY_NAME }}</title> <title>{% block title %}{% endblock %} - {{ DISPLAY_NAME }}</title>
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-light bg-light"> <div>
<a class="navbar-brand" href="{% url 'index' %}">{{ DISPLAY_NAME }}</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
{% block nav %}
<li class="{% if menu == 'index'%}active{% endif %}"><a class="nav-link" href="{% url 'index' %}">{% trans 'Paste something' %}</a></li>
{% endblock %}
</ul>
<span class="navbar-text">
{% trans 'powered by' %} <a class="navbar-link" href="https://github.com/setsuna-/pasteque"><b>{{ APP_NAME }}</b></a>
</span>
</div>
</nav>
<div class="container-fluid">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
{% block javascript %}{% endblock %} {% block javascript %}{% endblock %}

View File

@ -3,56 +3,27 @@
{% load compress %} {% load compress %}
{% block title %}{% trans 'Paste something' %}{% endblock %} {% block title %}{% trans 'Paste something' %}{% endblock %}
{% block content %} {% block content %}
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} <h1>Paf'Py</h1>
<form method="post" action="{% url 'index' %}"> Et Paf.
{{ form.non_field_errors }}
<div class="form-group">
<label for="id_content">{% trans 'Content' %}</label>
{{ form.content|add_class:"form-control"}}
{{ form.content.errors }}
</div>
<div class="form-row"> Ce « pastebin-like » ne peut être utilisé qu'en ligne de commande, soit avec <tt>curl</tt> :
{% if PASTE.has_title %}
<div class="col-auto">
<label class="sr-only" for="id_title"><span class="add-on"><i class="icon-tag"></i></span> {% trans 'Title' %}</label>
{{ form.title|add_class:"form-control" }}
{{ form.title.errors }}
</div>
{% endif %}
<div class="col-auto"> <div class="highlight"><pre><span></span>curl {{ absolute_index_url }} <span class="o">-F</span>python<span class="o">=</span>@hello.py
<label class="sr-only" for="id_language">{% trans 'Language' %}</label> </pre></div>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><span class="add-on"><i class="icon-file-alt"></i></span></div>
</div>
{{ form.language|add_class:"form-control" }}
</div>
{{ form.language.errors }}
</div>
<div class="col-auto"> <p>Le nom, entre <tt>-F</tt> et <tt>=</tt> sert à choisir la coloration syntaxique.</p>
<button class="btn btn-primary btn-lg" type="submit">{% trans 'Paste' %}</button>
</div>
</div> <p>Le mieux est de l'utiliser avec une fonction <tt>bash</tt> :</p>
{% csrf_token %} <div class="highlight"><pre><span></span>pafpy<span class="o">()</span>
<input type="hidden" id="max_characters" value="{{ max_characters }}"> <span class="o">{</span>
</form> curl {{absolute_index_url}} -F<span class="s2">&quot;</span><span class="si">${</span><span class="nv">1</span><span class="p">##*.</span><span class="si">}</span><span class="s2">=@</span><span class="nv">$1</span><span class="s2">&quot;</span>
<div class="d-flex p-2 bd-highlight"> <span class="o">}</span>
<div class="alert alert-info" role="alert">You can also use: </pre></div>
<pre>curl {{ absolute_index_url }} -Fpython=@hello.py</pre>
(attribute name is used for syntax highlighting, and shortcuts like "py" are allowed, see Language dropdown for language list.) Demo :
<br /><br />
You may even use a bash function: <div class="highlight"><pre><span></span>$ pafpy test.py
<pre>wyz() {{absolute_index_url}}D91F1CA
{ </pre></div>
curl https://wyz.fr/ -F"${1##*.}=@$1"
}</pre>
Like this:
<pre>wyz FILE_TO_UPLOAD</pre>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -1,9 +1,10 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block extrastyle %}
{% block title %} {{ title }}{% endblock %} <link href="/static/css//pasteque.css" rel="stylesheet">
{% block nav %}
<li><a class="nav-link" href="{% url 'paste' slug=slug renderer='raw' %}">View raw</a></li>
{% endblock %} {% endblock %}
{% block title %}{{ title }}{% endblock %}
{% block nav %}{% endblock %}
{% block content %} {% block content %}
{{ highlighted|safe }} {{ highlighted|safe }}
{% endblock %} {% endblock %}