bdruth / MagLit

πŸ”₯ MagLit - Privacy Respecting Encrypted Link Shortener with Password Protection and Torrent Magnet Links support

Home Page:https://maglit.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MagLit has been sponsored by Vercel. Many thanks!

MagπŸ”₯Lit

πŸ”₯ MagLit - A super fast and easy-to-use Free and Open Source Privacy Respecting Encrypted Magnet/HTTP(s) Link Shortener with Password Protection πŸ”₯

πŸ”₯ Featured on Awesome Open Source and Awesome Privacy

MagLit Features

βœ… 100% Easy to use
βœ… 100% Free and Open Source
βœ… 100% Encrypted
βœ… 100% Private
βœ… 0% Personal Data stored

New Features
πŸ†• MagLit now supports custom links!
πŸ†• MagLit now lets you generate QR Codes for your lit links!

WYSIWYG: MagLit builds are fully verifiable: The code in this repository is the same code that's deployed on MagLit.me, Nothing added, nothing ripped, so you know it's 100% trusted ;)

Self Hosting

Firebase Setup

MagLit uses Firebase Firestore as a database. You must first create a new Firebase project as described below.

  1. Navigate to the Firebase Console (requires Google Sign-in)
  2. You should see a Welcome to Firebase! screen with a button to Create a project - this launches the 3-step wizard:
    1. Name your project, e.g. maglit
    2. Enable Google Analytics for the project
    3. Select an existing GA account or create a new one (likely) - name it something useful, like maglit.
  3. Google will now create your project, click Continue when ready.
  4. In the Firebase project console, add a "Web" app by clicking the appropriate icon (looks like </>)
  5. Give it a name ... maglit seems appropriate!
    1. Firebase Hosting is not required for this.
  6. Click Register app
  7. Firebase will now display all the keys and other configuration variables you need to run MagLit, copy everything provided in firebaseConfig - this will go in your .env.local or in your docker-compose.yml.
  8. Before Firebase | Firestore can be used, the Firestore API in the new project needs to be enabled
    1. Visit https://console.developers.google.com/apis/api/firestore.googleapis.com/overview?project=<messagingSenderId> - replace <messagingSenderId> with the appropriate value, or navigate to the Google Cloud Firestore API in the GCP console.
    2. Click Enable.
  9. You'll also need to create your Firestore DB or you'll get an error like The database (default) does not exist for project <projectId>
    1. Visit https://console.cloud.google.com/datastore/setup?project=<projectId> - replace <projectId> with the appropriate, e.g. maglit-aaaaa
    2. On the Select a Cloud Firestore mode page, click Select Native Mode, then select an appropriate location (e.g. us-east-4 for N. Virginia).
  10. Finally, you'll need to setup Firebase Rules to allow access to your Firestore - navigate to https://console.firebase.google.com/u/0/project/<projectId>/firestore/rules or:
    1. In the Firebase Console for your project, expand the Build left navigation and click Firestore Database
    2. In the tab navigation, click Rules
  11. Change if false to if true (TODO: this doesn't seem secure), click Publish to activate the change.

That's it, your Firebase | Firestore DB is now setup and ready to use.

Now, create a file with the name .env.local in root directory of the project and fill the details as mentioned in .env.local.example. Alternatively, fill out the docker-compose.yml ENV vars accordingly.

Build and Deploy

Clone the project and install dependencies using:

npm install

You need npm or yarn installed for this.

Then, run the development server:

npm run dev

DOCKER:

# TO BUILD IMAGE
npm run build-docker-image

# TO START THE DOCKER IMAGE SERVER
npm run start-docker-image

You can also use a pre-built image (supports amd64 and arm64), which contains the code that resides on main:

docker pull ghcr.io/nayamamarshe/maglit:main

The docker-compose file is setup to use the remote image. Just remember to fill the firebase environment variables. You can start using docker compose with:

docker compose up -d

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.js. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/xxxxxx. This endpoint can be edited in pages/api/xxxxxx.js.

The pages/api directory is mapped to /api/*. Read more about API routes.

If you like the project

ETH (ERC-20) Wallet: 0x14858f5334ea1014e68212c2d4b32792d137f256

bmc-button

πŸ”₯ https://maglit.me πŸ”₯

About

πŸ”₯ MagLit - Privacy Respecting Encrypted Link Shortener with Password Protection and Torrent Magnet Links support

https://maglit.me

License:GNU Affero General Public License v3.0


Languages

Language:JavaScript 92.9%Language:CSS 3.2%Language:Dockerfile 2.3%Language:Shell 1.6%