An image host with thumbnails, a dashboard, thumbnails, 2fa, url shortening and more.
Go to file
Sylver e56d700d2e fix: let otp errors propogate to prevent redirects 2024-02-26 03:39:22 +08:00
.github/workflows build: use buildx 2022-07-19 02:14:18 +08:00
.vscode chore: eslint with strict type imports 2024-02-12 19:04:42 +08:00
example update readme 2024-01-07 11:33:19 +08:00
packages fix: let otp errors propogate to prevent redirects 2024-02-26 03:39:22 +08:00
.dockerignore build: smaller docker images 2022-07-05 18:39:30 +08:00
.gitignore build: use tsup instead of ncc for prod builds 2023-04-05 07:39:02 +08:00
.pnpmfile.cjs feat: replace nextjs with preact+vite+vike 2024-01-28 06:48:06 +08:00
.prettierrc feat: use file embed for pastes 2022-06-21 07:20:53 +08:00
.syncpackrc update deps, move to atlas configs 2024-01-07 12:19:16 +08:00
Dockerfile chore: unused patches dir 2024-02-12 19:19:35 +08:00
LICENSE chore: switch to agpl 2024-02-12 04:41:13 +08:00
README.md feat: replace nextjs with preact+vite+vike 2024-01-28 06:48:06 +08:00
compose.yml feat(web): use pandora for ui 2022-07-26 05:59:19 +08:00
package.json chore: eslint with strict type imports 2024-02-12 19:04:42 +08:00
pnpm-lock.yaml feat: change password page 2024-02-15 19:20:35 +08:00
pnpm-workspace.yaml feat: mikroorm, convert to monorepo 2021-10-02 22:17:05 +00:00
turbo.json chore: eslint with strict type imports 2024-02-12 19:04:42 +08:00
wrapper.sh fix: forgot that was necessary 2024-02-11 12:59:27 +08:00

README.md


🔵 discord 🟢 hosted instance

micro

A vanity file sharing service with support for ShareX. You can see a preview at https://micro.sylo.digital

features

  • ShareX Support
  • Video and image thumbnails
  • Config generation
  • Encrypted pastes
  • File name preservation
  • Video, image, text and markdown previews
  • Syntax highlighting for supported files
  • Deletion URLs
  • Dashboard
  • Permissions
  • Invite links
  • URL Shortening
  • Mobile support
  • EXIF metadata removal
  • Conversions (GIF>WebM, WebP>PNG, etc.)
  • Purging of old and/or large files (config.purge).
  • 2FA support

screenshots

Sign In Page Dashboard
Upload Page Text Preview
Paste Page 2FA setup

installation

[!NOTE] If you need help, join the discord server. This guide assumes you are on linux with a basic understanding of linux and docker.

[!TIP] If you are already familiar with docker, you can look at the compose file and config file to get setup quickly. The below is a more detailed guide for inexperienced users.

  1. Install git and docker
  2. Download the files in this repository, git clone https://github.com/sylv/micro.git
  3. Copy the example configs to the current directory, cp ./micro/example/* ./
  4. Fill out .microrc.yaml, Caddyfile and docker compose.yml. It is extremely important you read through each of the 3 files and make sure you understand what they do. Specifically, .microrc.yaml contains a secret that handles authentication, if it is not a secure random string everyone can sign in as anyone they want without a password.
  5. Run docker compose up -d to start the database and micro.
  6. Get the startup invite by doing docker compose logs micro and copying the invite URL that should be somewhere towards the end of the log. Go to that URL to create the first account.

Setup is now complete and your instance should be working. To add another user, sign in then go to /api/invite and copy the URL it gives you. This will be improved in the future.

configuration

micro uses venera to load configuration files. Configuration files are validated on startup, and may log errors if invalid setups are detected. The venera page has more information, but tl;dr:

  • .microrc.yaml is the main configuration file.
  • You can override any config value with an environment variable. The key hosts.0.url would be set as MICRO_HOSTS__0__URL
  • You can use other file formats, like JSON or TOML.

updating

You should take a full database backup before updating, but you won't, will you? The database will be automatically migrated on startup.

  1. docker compose pull micro
  2. docker compose up -d micro

development

You can pull the repo and then pnpm install, after that everything should be good to go. You can start the packages/api/packages/web with pnpm watch.

web package notes

[!IMPORTANT] tl;dr, web is quirky and some packages that depend on react may break. if they do, try adding them to noExternal in vite.config.ts and they'll probably work.

The web package is a little weird. It uses vike in place of what might normally be nextjs, preact in place of react and vite to build it all. Unlike nextjs, we have much more control over rendering, SSR, routing, etc. It's much faster, and much more fun. Of course, nothing is free - some hacky workarounds are required to get it working.

Preact is smaller, faster, and more fun than react. It's a drop-in replacement, but actually dropping it in is the hard part. The main problem is that in SSR mode, vite does not bundle dependencies, which means aliasing react to preact does not work because it's not transforming the packages to replace the react imports. You can force it to bundle dependencies, but then it chokes on some node dependencies like fastify. The only way I've found to get around this is to:

  • Alias react to preact in node_modules using .pnpmfile.cjs
  • Add some packages that still complain to noExternal in vite.config.ts, which forces them to be bundled and appears to resolve any remaining issues.

tsup is used as a final build step to bundle everything together. Vite breaks doing this, but not doing it results in much larger docker images.

todo

  • Ratelimiting
  • Admin UI
  • Deletion URLs for pastes/links
  • Password recovery via emails
  • SQLite support
  • Private email aliases like firefox relay (might be difficult/expensive)

support

sylo.digital