Compare commits

...

8 Commits

Author SHA1 Message Date
raoul db16d9f57d Merge pull request 'Add license and link on about page' (#15) from add-url-to-about into master
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline failed Details
Reviewed-on: #15
2023-07-30 23:42:50 +00:00
Raoul Snyman 421303948a Add license and link on about page
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-07-30 16:40:35 -07:00
raoul bf20fd1a76 Merge pull request 'Force hypercorn to bind to 0.0.0.0:8000' (#14) from fix-hypercorn-listen-ip into master
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
Reviewed-on: #14
2023-07-30 05:33:14 +00:00
Raoul Snyman 7234b85394 Force hypercorn to bind to 0.0.0.0:8000
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
2023-07-29 22:30:56 -07:00
raoul 7fde570f87 Merge pull request 'Use Alpine images to reduce image size' (#13) from use-alpine-images into master
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
Reviewed-on: #13
2023-07-30 05:17:20 +00:00
Raoul Snyman f3b60f4c39 Use Alpine images to reduce image size
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
2023-07-29 22:15:13 -07:00
raoul eceffadf1a Merge pull request 'Fix various issues relating to the Docker image and running a container' (#12) from fix-various-docker-issues into master
ci/woodpecker/push/woodpecker Pipeline was successful Details
Reviewed-on: #12
2023-07-30 05:01:07 +00:00
Raoul Snyman c04b2a4102 Fix an issue with hypercorn not finding the application in the docker image; correct the README; fix a co-routine that wasn't being awaited
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
2023-07-29 21:58:59 -07:00
6 changed files with 19 additions and 8 deletions

View File

@ -1,9 +1,10 @@
FROM python:3.11
FROM python:3.11-alpine
WORKDIR /app
ADD . /app
RUN apk add git
RUN pip install -e .
RUN pip install hypercorn
EXPOSE 8000
CMD ["hypercorn", "codesmidgen.app"]
CMD ["hypercorn", "--bind", "0.0.0.0:8000", "codesmidgen.app:application"]

View File

@ -1,6 +1,6 @@
FROM python:3.11
FROM python:3.11-alpine
RUN pip install --extra-index-url https://git.snyman.info/api/packages/raoul/pypi/simple/ CodeSmidgen hypercorn
EXPOSE 8000
CMD ["hypercorn", "codesmidgen.app"]
CMD ["hypercorn", "--bind", "0.0.0.0:8000", "codesmidgen.app:application"]

9
LICENSE.txt Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2015-present Raoul Snyman <raoul@snyman.info>
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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.

View File

@ -26,7 +26,7 @@ The easiest way to install CodeSmidgen is via Docker and Docker Compose. Here's
image: git.snyman.info/raoul/codesmidgen:latest
env:
- SMIDGEN_SECRET_KEY=yoursecrethere
- SQLALCHEMY_DATABASE_URL=postgres://codesmidgen:codesmidgen@postgres/codesmidgen
- SQLALCHEMY_DATABASE_URI=postgresql://codesmidgen:codesmidgen@postgres/codesmidgen
restart: unless-stopped
ports:
- "127.0.0.1:8000:8000"

View File

@ -4,6 +4,7 @@
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<h2>About CodeSmidgen</h2>
<p>CodeSmidgen is a quick code paste application written in Python with Quartz, SQLAlchemy, Mako, Pygments and a few other Python libraries.</p>
<p>CodeSmidgen is open source under the MIT license, and is available from <a href="https://git.snyman.info/raoul/codesmidgen">https://git.snyman.info/raoul/codesmidgen</a></p>
</div>
</div>
{% endblock %}

View File

@ -101,7 +101,7 @@ async def save() -> Response:
session.commit()
return redirect('/' + note.url)
except Exception as e:
flash(str(e), 'danger')
await flash(str(e), 'danger')
session.rollback()
return redirect('/')
@ -115,7 +115,7 @@ async def view(note_url: str) -> Response | str:
"""
note = Smidgen.query.filter(Smidgen.url == note_url).first()
if not note:
flash('That note does not exist', 'danger')
await flash('That note does not exist', 'danger')
return redirect('/')
lexer = get_lexer_by_name(note.lexer)
@ -133,7 +133,7 @@ async def raw(note_url: str) -> Response | str:
"""
note = Smidgen.query.filter(Smidgen.url == note_url).scalar()
if not note:
flash('That note does not exist', 'danger')
await flash('That note does not exist', 'danger')
return redirect('/')
return await render_template('raw.html', source=note.source), 200, {'Content-Type': 'text/plain; charset=utf-8'}