um blog na tildelândia

Hacking a custom homepage for your Mastodon instance

19 de janeiro de 2023 — ~epifanio

Starting with version 4.0.0, Mastodon's homepage is not that great. It defaults to the "explore" page that basically shows the public timeline of that instance. If you want to know more you have to click on the "Learn more" button and then you're presented with the about page that shows the long description of the instance, the rules and the list of moderated servers. And it all shows up in a column centered on the page, which is kinda limiting.

You can add some html tags to the description of the instance. That is good. But you can't do it in the rules section, where you can't even add hyperlinks.

In our instance, Ciberlândia, we decided to hack a custom homepage:


Looks good, doesn't it? aiscarvalho and rlafuente did a great work with the design of the page.

We didn't want to mess with the Mastodon source code, so we did it all by hacking a few rules in the NGINX config.

First step: Create your homepage html

SSH to your server as the mastodon user (or sudo - mastodon if you're already logged in as root).

Create the directory where your html will be. We used /home/mastodon/live/custom-index/. Put your index.html, images and css files in there.

Second step: Add rules to NGINX config

In this step you have to be logged in as root.

Edit the file /etc/nginx/sites-available/mastodon and add these lines (don't forget to change you Content-Security-Policy according to your needs):


location /welcome {
  rewrite ^ /welcome/ redirect;

location /welcome/ {
  alias /home/mastodon/live/custom-index/;
  add_header Content-Security-Policy "default-src 'none'; font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'";
  add_header X-XSS-Protection "1; mode=block";
  add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';
  add_header X-Frame-Options "SAMEORIGIN";
  add_header X-Content-Type-Options nosniff;

location = / {                                                             
  if ($cookie__session_id = "") {
    rewrite ^/$ https://<**your instance url in here**>/welcome/ redirect;
  try_files $uri @proxy;                                                   


Final step: restart NGINX

Run this:

systemctl restart nginx

Now when a user tries to access the root of your site, NGINX will check if the user is logged in (checking the value of the cookie session_id) and redirect them to your custom page which is located at the /welcome/ path.

If the user is logged in, they will of course be served the default Mastodon interface.

[EDIT 2023-03-12] Added security headers

tags: mastodon, nginx, ciberlandia

O tilde.pt num verdadeiro computador retro

19 de maio de 2020 — ~epifanio

O HTML, quando bem feito e quando não precisa de muito mais do que apresentar informação textual, pode e deve ser feito de forma a que seja de fácil leitura no maior número de browsers e dispositivos: computadores tradicionais, tablets, telemóveis e até mesmo browsers sem suporte para CSS como terminais de texto ou browsers para invisuais.

A melhor forma de o fazer, tipicamente, é construir o HTML mais simples possível, que consiga ser de fácil leitura em software sem suporte para CSS. Só numa fase posterior é que se deverá dar maior atenção à componente visual, através de CSS e Javascript, para que seja apresentado de uma forma jeitosa num browser mais moderno.

Quis saber se o tilde.pt seria facilmente navegável na minha plataforma retro preferida: o Amiga. Como browser usei o IBrowse que, apesar de ter sido lançado há 23 anos atrás, teve uma actualização ainda este ano.

Foi uma surpresa agradável. O tilde.pt passou com distinção no teste. Vejamos a homepage:

homepage tilde.pt

O espaço do ~rlafuente também passou o teste:


E o ~marado provou que usar tables para construir o layout uma página html (em vez de divs) tem as suas vantagens. Vejam:


Como não há milagres, o Hotel (que é uma bela obra de arte) depende muito de CSS e é apresentado apenas como uma simples lista. Lanço o desafio à ~aiscarvalho para a construção de uma versão em ASCII art.


Uma nota final: o computador usado para este teste foi uma versão "moderna" do Amiga baseada em FPGA, uma Vampire V4 Standalone. O sistema operativo é o Amiga OS 3.9 que infelizmente continua a ser proprietário devido a intermináveis guerras sobre a propriedade intelectual do mesmo. Felizmente temos o AROS 68k que está a caminhar a passos largos para se tornar uma séria alternativa open-source ao velhinho Amiga OS.

tags: tilde.pt, html, css, retro, amiga

A Declaration of the Independence of Tildespace

09 de abril de 2020 — ~epifanio

Governments of the Industrial World, you weary giants of flesh and steel, I come from Tildeverse, the new home of Mind. On behalf of the future, I ask you of the past to leave us alone. You are not welcome among us. You have no sovereignty where we gather.

We have no elected government, nor are we likely to have one, so I address you with no greater authority than that with which liberty itself always speaks. I declare the global social space we are building to be naturally independent of the tyrannies you seek to impose on us. You have no moral right to rule us nor do you possess any methods of enforcement we have true reason to fear.

Governments derive their just powers from the consent of the governed. You have neither solicited nor received ours. We did not invite you. You do not know us, nor do you know our world. Tildeverse does not lie within your borders. Do not think that you can build it, as though it were a public construction project. You cannot. It is an act of nature and it grows itself through our collective actions.

You have not engaged in our great and gathering conversation, nor did you create the wealth of our marketplaces. You do not know our culture, our ethics, or the unwritten codes that already provide our society more order than could be obtained by any of your impositions.

You claim there are problems among us that you need to solve. You use this claim as an excuse to invade our precincts. Many of these problems don't exist. Where there are real conflicts, where there are wrongs, we will identify them and address them by our means. We are forming our own Social Contract. This governance will arise according to the conditions of our world, not yours. Our world is different.

Tildeverse consists of transactions, relationships, and thought itself, arrayed like a standing wave in the web of our communications. Ours is a world that is both everywhere and nowhere, but it is not where bodies live.

We are creating a world that all may enter without privilege or prejudice accorded by race, economic power, military force, or station of birth.

We are creating a world where anyone, anywhere may express his or her beliefs, no matter how singular, without fear of being coerced into silence or conformity.

Your legal concepts of property, expression, identity, movement, and context do not apply to us. They are all based on matter, and there is no matter here.

Our identities have no bodies, so, unlike you, we cannot obtain order by physical coercion. We believe that from ethics, enlightened self-interest, and the commonweal, our governance will emerge. Our identities may be distributed across many of your jurisdictions. The only law that all our constituent cultures would generally recognize is the Golden Rule. We hope we will be able to build our particular solutions on that basis. But we cannot accept the solutions you are attempting to impose.

In the United States, you have today created a law, the Telecommunications Reform Act, which repudiates your own Constitution and insults the dreams of Jefferson, Washington, Mill, Madison, DeToqueville, and Brandeis. These dreams must now be born anew in us.

You are terrified of your own children, since they are natives in a world where you will always be immigrants. Because you fear them, you entrust your bureaucracies with the parental responsibilities you are too cowardly to confront yourselves. In our world, all the sentiments and expressions of humanity, from the debasing to the angelic, are parts of a seamless whole, the global conversation of bits. We cannot separate the air that chokes from the air upon which wings beat.

In China, Germany, France, Russia, Singapore, Italy and the United States, you are trying to ward off the virus of liberty by erecting guard posts at the frontiers of Tildeverse. These may keep out the contagion for a small time, but they will not work in a world that will soon be blanketed in bit-bearing media.

Your increasingly obsolete information industries would perpetuate themselves by proposing laws, in America and elsewhere, that claim to own speech itself throughout the world. These laws would declare ideas to be another industrial product, no more noble than pig iron. In our world, whatever the human mind may create can be reproduced and distributed infinitely at no cost. The global conveyance of thought no longer requires your factories to accomplish.

These increasingly hostile and colonial measures place us in the same position as those previous lovers of freedom and self-determination who had to reject the authorities of distant, uninformed powers. We must declare our virtual selves immune to your sovereignty, even as we continue to consent to your rule over our bodies. We will spread ourselves across the Planet so that no one can arrest our thoughts.

We will create a civilization of the Mind in Tildeverse. May it be more humane and fair than the world your governments have made before.

Text "adapted" from John Perry Barlow's "A Declaration of the Independence of Cyberspace", 1996.

"Adapted" is a euphemism for this (in vim):


tags: internet, tildeverse, cyberspace