Git Product home page Git Product logo

universe's Introduction

universe

A minimal unmanaged blog app written in Flask

Note

This project seriously needs a rewrite. I'm not too proud of this code. However, I'm currently preoccupied with other projects at the moment. Feel free to rewrite this app on your own. If you do, please share a link with me so I can post it here. Otherwise I will get back to this project eventually. Thank you for reading.

Installation

git clone https://github.com/d3npa/universe.git && cd universe
pip install -r requirements.txt
python3 ./app.py | tee -a access.log

The app will run listen on 127.0.0.1:5000 by default.
You can (and should) proxy connections to it via Nginx, Relayd, Apache etc.

Usage

Files placed in the contents/ folder will be accessible from the web. The index file is located at contents/.index.txt. There is also a 404 message defined in contents/.404.txt.

File extensions matter!

  • .md and .markdown will be parsed by Markdown.
  • .txt will load as HTML, but with extra functionality such as inline bash commands (see below).
  • .html and .htm will load as regular HTML.
  • .png, .jpg, .mp3, .mp4, .pdf will load as their respective mimetypes.

Bash command parsing

Bash commands may be executed in-line as the file is viewed using the following syntax:

<h1>$(echo 'Title')</h1> <!-- All in regular HTML -->
<pre><code>$(echo 'Title' | hexdump -C)</code></pre>

Which turns into:

<h1>Title</h1> <!-- All in regular HTML -->
<pre><code>00000000  54 69 74 6c 65                                    |Title|
00000005
</code></pre>

!! Note: These commands are executed on the server whenever a user views the page.
!! It is the admin's responsibility to ensure commands are safe to execute.

RSS

There is minimal support for RSS feeds. Please not that newly created articles must be manually added to the RSS feed by adding a line in publications.txt for each article. This is a design choice - I create and delete files on my site on a whim, and don't need to be updating everyone everytime I do so. Here is an example publifications.txt file.

# Format:
# - One entry per line; URI:TITLE:DESCRIPTION
# - Lines starting with a '#' are ignored (comments)
# - Date is taken from file creation time
# - Colons ':' can be escaped: "\:"
/welcome.txt:Welcome to my blog:Just a test post!
/posts/myarticle.md:Articles in Markdown:I tried writing an article in Markdown!

Note: Also be sure to edit the base url to match your site in templates/rss.xml.jinja on lines 6, 14, 15.

Warning

If a Local File Inclusion (LFI) vulnerability were to be discovered, an access_log.txt file could be exploited to gain arbitrary remote code execution (RCE). Using any other extension, such as access.log, mitigates this problem, as only .txt files may contain executable bash commands. Consider doing the same with any other file written by the web server.

universe's People

Stargazers

 avatar agbt avatar Aliez avatar xiantang avatar  avatar zhouguangping avatar  avatar Sungbin Jo (조성빈) avatar Christian W. avatar Cosmo avatar Robert James Hernandez avatar

Watchers

James Cloos avatar

Forkers

pakeng hevi1991

universe's Issues

Add RSS/Atom

Supporting RSS/Atom is a necessary feature for a blog.

If you're like me and read a tonne of different blogs you're going to be using a RSS client otherwise you won't know when something new is posted.

Just hoping that a user will decide to "bookmark" your site isn't enough.

the <link rel="alternate"/> attribute should appear in the top of your source so that auto discovery can work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.