Likho’s microblog.py
Updated 2023 Jun 03 by Likho (licho@firemail.cc)
microblog.py
is a simple microblog generation
script written in under 500 lines of Python.
If you use it, let me know. I can also add you to my webring.
git:https://notabug.org/likho/microblog.py
example: https://likho.neocities.org/microblog/
Features:
- pagination
- tag cloud
- webring
- configuration file
- sorting (backdating)
- mini-galleries
Perks over social media platforms.
- less drama
- not “software-as-a-service”
- self-stewardship of data
- no moderator abuse
- viewable on older computers and browsers
- low requirements
- doesn’t get invoked each visit (unlike f/CGI)
- doesn’t need to be run 24/7 (unlike web server application)
- doesn’t involve a relational database system
- doesn’t need javascript
Usage
microblog.py
assumes the user has a basic
understanding of HTML and CSS. There is no code specific to an
operating system, but Linux users would have the least trouble
running it.
See also https://notabug.org/likho/microblog.py#usage.
Getting Started
These are the sequence of commands to get started.
git clone https://notabug.org/likho/microblog.py microblog
cd microblog
cp example/Makefile .
make
This means to:
- download the program using a git client into a folder called
microblog
- enter the folder
microblog
- copy and paste the file
example/Makefile
into the current folder. - invoke
make
This should generate an example page named
result.html
which can be opened in a web browser for
preview. It should also avail the files template.tpl
,
timeline.css
, settings.toml
, and
content.txt
.
content.txt
is the user contentsettings.toml
is the configuration filetemplate.tpl
is the html page templatetimeline.css
is the style sheet that defines the layout and proportions of page elements; by default, it minimally defines color.
To help discern which elements are which, some borders in
result.html
are color-coded in red, blue, and
green.
If you don’t want to use Gnu Make…
make
is only there for convenience. If you want to
use another interface, this is the page generation command:
python microblog.py ./template.tpl ./content.txt > result.html
You can rename the files content.txt
,
template.tpl
, and result.html
however you
wish. THese are only names provided by example.
Enable webring
Assuming you have the program already downloaded by git.
git checkout syndication
Reference example/settings.toml
or online at https://notabug.org/likho/microblog.py/src/syndication/example/settings.toml#L33.
Note, I don’t consider the webring branch finalized as of May 6, 2023. Updates to the branch may involve changes to the settings file.
Adding to webring
The followers list is an array of strings.1
list= ["https://likho.neocities.org/microblog/meta.json"]
An array can also be broken into multiple lines.
list = [
"https://likho.neocities.org/microblog/meta.json",
"https://somewhere.else/microblog/meta.json"
]
See https://toml.io/en/v1.0.0#array for acceptable syntax.
You can add someone on an alternate DNS root like OpenNIC as long as your computer resolves the URL. Just don’t expect that same URL to resolve for everyone else visiting your page.
Disclosures
The project uses pycurl and urllib for web requests.2
neouploader.py
, to upload files in bulk to
neocities, handles password using getpass.3
microblog.py
on the branch syndication
uses HTTP connections only to fetch data.4`
Proxy Behavior
Proxy support has been added to microblog.py
on
branch syndication
in commit e4af5bbd6aca8f06baa6e29d57090481eb208193.
By the default behavior of
urllib.request.ProxyHandler
,5
the script will respond to environment variables such as
http_proxy
or https_proxy
.
Tor support can be enabled by setting either
http_proxy=socks://127.0.0.1:9050
https_proxy=socks://127.0.0.1:9050
As a result, the full script invocation will look like:
https_proxy=socks://127.0.0.1:9050 python microblog.py
Why I’m not using the Fediverse
The foremost alternative to Twitter or Tumblr was the Fediverse, and I lost interest in the Fediverse for reasons as complex as the Fediverse is. But an approximation is that it is very easy to find poor administration or overbearing moderation in the Fediverse. The visibility of content is also subject to arbitrary white/blacklisting set by the administrator.6
I originally had profiles on gnusocial.no
and
sendero.social
. Both sites are offline now. However, I
also found myself a misfit in a culture of people who want
information delivered on a timeline.
https://notabug.org/likho/microblog.py/src/syndication/example/settings.toml#L44↩︎
https://notabug.org/likho/microblog.py/src/v0.1.0/neouploader.py#L2↩︎
https://notabug.org/likho/microblog.py/src/v0.1.0/neouploader.py#L39↩︎
https://notabug.org/likho/microblog.py/src/syndication/microblog.py#L378↩︎
https://docs.python.org/3/library/urllib.request.html?highlight=urllib%20proxy#urllib.request.ProxyHandler↩︎