Git Product home page Git Product logo

nayamamarshe / maglit Goto Github PK

View Code? Open in Web Editor NEW
508.0 5.0 50.0 1.22 MB

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

Home Page: https://maglit.me

License: GNU Affero General Public License v3.0

JavaScript 94.67% CSS 3.26% Dockerfile 2.06%
privacy encryption linkshortener free open-source foss nextjs self-hosted

maglit's Introduction

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

PREPARE

MagLit uses Firebase Firestore as a database. You must first create a new Firebase project, then a file with the name .env.local in root directory of the project and fill the details as mentioned in .env.local.example.

This step is a hard requeriment and any change to this file, requires a rebuild to the project from scratch (either through npm install/npm run dev or by using the docker steps)

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:

Important

Make sure the .env.local file is available before the build.

#  BUILD AND RUN IMAGE USING NPM
npm run docker:build
# RUN IMAGE
npm run docker
# OR RUN IN DETACHED MODE
npm run docker: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

bmc-button

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

maglit's People

Contributors

dependabot[bot] avatar diegonicacio avatar nayamamarshe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

maglit's Issues

Add QR Code support

  • Add an option in settings for 'Create QR Code'
  • Show QR Code in a popup after lighting up a link
  • Show option for QR Code in Lit Links Database

Click on link

Any possibility to see the number of clicks on a shortened url on the one hosted on your site?

Can you add it pls even if it's by adding /r in front if the shorten url would be good

NEXT_PUBLIC_BASE_URL needs to be loaded after build

This means that the application has to be built with the NEXT_PUBLIC_BASE_URL already set, instead of allowing it to be filled later.
Such practice, prevents users from using the already built application (being it inside/outside of docker).

How to reproduce:

1 - Make sure you're working on a clean environment (identical to repo)

git clean -fdxd

2 - Build the application

npm install
npm run build

3 - Create your .env.local file with the your configs (firebase and public url)

cat >> .env.local << EOF

NEXT_PUBLIC_BASE_URL="http://127.0.0.1.xip.io:3000/"

RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false
SECRET_KEY=""
STORAGE_BUCKET="blablabla.appspot.com"
PROJECT_ID="blablabla"
AUTH_DOMAIN="balblabla.firebaseapp.com"
MEASUREMENT_ID="G-BLABLABLA"
APP_ID="9:999999999999:web:9a9a9a9a9a9a9a9a9a9a"
MESSAGING_SENDER_ID="999999999999"
API_KEY="asdadasdasdsadasd_asdasdasdasd-123asd123"
EOF

4 - Start the application

npm run start

Expected

1 - Navigate to http://127.0.0.1.nip.io:3000/
2 - Open preferred Developer tools and go to the network tab
3 - Fill in any URL on the webpage and click on the button Light It Up πŸ”₯
4 - A POST request is shown on the network tab aimed at http://127.0.0.1.xip.io:3000/

Actual

1 - Navigate to http://127.0.0.1.nip.io:3000/
2 - Open preferred Developer tools and go to the network tab
3 - Fill in any URL on the webpage and click on the button Light It Up πŸ”₯
4 - A POST request is shown on the network tab aimed at http://localhost:3000/

Temporary workaround

While this issue doesn't get fixed, might be worth it to change documentation to:

Application

Instruct users to build application with the .env.local already created and filled as first step.

Docker

Stop distributing ready-to-use docker image and change docker-compose to force user to build its own docker-image

How long the shorten link work?

I know this i not a real issue, but for how long the link works?

I am putting QR codes with shortened links on the calendars of my association of volunteers, I hope they stay online for at least one year πŸ˜‰

(Thank you by the way, I have donated πŸ‘ )

Add support for curl

Add an option for "curling" the website

In example: curl maglit.me "link" password=12345

I would love to see this option

Firestore connection error: INVALID_ARGUMENT

Self-built docker image and setup with current instructions. When creating a slug, the following error spams the log.

(Leading prefix is from docker-compose)

maglit_1  | [2023-05-14T13:04:58.181Z]  @firebase/firestore: Firestore (9.15.0): Connection GRPC stream error. Code: 3 Message: 3 INVALID_ARGUMENT: Invalid resource field value in the request.
maglit_1  | [2023-05-14T13:04:58.183Z]  @firebase/firestore: Firestore (9.15.0): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=invalid-argument]: 3 INVALID_ARGUMENT: Invalid resource field value in the request.
maglit_1  | This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
maglit_1  | Database Error [FirebaseError: Failed to get document because the client is offline.] {
maglit_1  |   code: 'unavailable',
maglit_1  |   customData: undefined,
maglit_1  |   toString: [Function (anonymous)]
maglit_1  | }
maglit_1  | [2023-05-14T13:04:58.467Z]  @firebase/firestore: Firestore (9.15.0): Connection GRPC stream error. Code: 3 Message: 3 INVALID_ARGUMENT: Invalid resource field value in the request.
maglit_1  | Database Error [FirebaseError: Failed to get document because the client is offline.] {
maglit_1  |   code: 'unavailable',
maglit_1  |   customData: undefined,
maglit_1  |   toString: [Function (anonymous)]
maglit_1  | }

Show password in lit links

Currently lighting up a link doesn't tell you if it's password protected or not. People might forget their password so it's better to keep the password available in local storage.

Generate Random Slug on Server Side

Users can run the following script in browser console to create short links with custom slugs

fetch("https://maglit.ml/api/create", {
    "headers": {
        "accept": "application/json, text/plain, */*",
        "accept-language": "en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7,af;q=0.6,mr;q=0.5",
        "content-type": "application/json",
        "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"100\", \"Google Chrome\";v=\"100\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Windows\"",
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-origin"
    },
    "referrer": "https://maglit.ml/",
    "referrerPolicy": "strict-origin-when-cross-origin",
    "body": "{\"slug\":\"customslug\",\"password\":\"\",\"link\":\"https://eample.com\"}",
    "method": "POST",
    "mode": "cors",
    "credentials": "omit"
});

Generate Random Slug on Server Side to prevent users from generating custom slug

Tutorial / Docker image?

Hi there!

I wanted to see if you had any plans for a tutorial of setting this up.

I want to try self-hosting this so much! I got as far as running the maglit container via Portainer, and even set up a web app in a new Firebase project. I input all the variables that I got from Firebase, but it would just keep saying "Failed to fetch". The url would always be "localhost:3000/". I tried making the .env.local file, but I didn't know where or how to upload it to firebase project.

I guess it must be easy for more experienced techies, but unfortunately I couldn't get it to work.

And of course, I know you're already making a docker image, I just wanted to see how that's coming along. :)

Thank you! I can't wait to be able to try this on my own system :)

Database Error

Hello, i have filled in alle details of firebase correctly but when i want to create a short link I will get spamed with a 502 when i go to: the "api/available" site it says:

{"message":"Database Error, Please try again..."}

What can i do to fix this?
What is the SECRET_KEY?

Allow TLDs with more than 8 chars.

Using a domain name with a Top Level Domain of more than 8 chars (I had issues with ".education", but a lot more are allowed) results in an error. The message is misleading "Please make sure your link starts with 'http://' or 'https://' or 'magnet://'".
I think the issue stems from the regexp used to test the links.

FAQ Dark Mode Black Text

While the website is available in dark mode, the FAQ page still displays with black text, making them very hard to read.

Unable to Install PWA on Desktop

Currently,

The PWA can be added to Android devices by selecting "Add to Home screen," but it lacks an "Install" button.

On desktop browsers, the PWA feature is absent. The URL bar doesn't show an installation badge (icon), and there's no "install" item in the browser's drop-down menu.

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.