Giter VIP home page Giter VIP logo

just-moh-it / pckd Goto Github PK

View Code? Open in Web Editor NEW
772.0 13.0 91.0 15.25 MB

The โšก๏ธ analytics-intensive, self-hostable link-shortener with a beautiful UI | AKA free bit.ly alternative ๐Ÿš€

Home Page: https://docs.pckd.me/

License: MIT License

HTML 8.12% JavaScript 89.11% Shell 1.82% Dockerfile 0.96%
customizable react nodejs redux bitly javascript url-shortener graphql self-hosted tracking url reactjs link-shortener

pckd's People

Contributors

itzderock avatar just-moh-it avatar petrleocompel avatar rizwan95 avatar sujith46 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pckd's Issues

Add subdomain support

Proposal, to a setting to automatically allocate custom subdomain to new users (like https://mohit.pckd.me). The users could then choose to shorten links using the classic root domain, or their user-subdomain.

Adding Sponsors to Readme

Proposing to have a sponsors' section on the GitHub Readme and the under-construction landing page. Will be added soon

Allowing tracking to be disabled on Certain links

To prevent IP registry API usage, or to protect the privacy of users, while still being able to edit and delete links, the feature request makes sense. It will be implemented in the future once the project gains traction and enough users would want the feature. We plan to add it as a checkbox under the advanced options while creating links from the homepage.

Add pagination

Currently, the app loads all the data at once, even if fields include thousands of rows, which takes a toll on the backend API. Also, this would conflict with the query-cost limiting feature (#21), so both features need to be implemented at the same time

Prebuilt Docker image

For further use docker images would be amazing (that we do not have to build each version on our machnies).

So I made an example (even with 2 containers - better than nothing) in fork https://github.com/petrleocompel/Pckd

Result = 2 images
https://hub.docker.com/r/petrleocompel/pckd-client
https://hub.docker.com/r/petrleocompel/pckd-server

Used Github Actions + 2 Actions secrets DOCKERHUB_USERNAME and DOCKERHUB_TOKEN.
How to make a DockerHub token ->ย https://docs.docker.com/docker-hub/access-tokens/

I can make a pull request (only thing to tweak is change name of docker images).

Otherwise it is done.

Password-protected links

Create password protected links, where hitting up the short URL would show an authentication page... either just password or with full authentication supporting OAuth with external providers...

Docker build error

Server doesn't build.

$ docker-compose up

Sending build context to Docker daemon  7.613MB
Step 1/17 : FROM node:16-alpine as builder
 ---> 51405b97d471
Step 2/17 : WORKDIR /home/node/build
 ---> Using cache
 ---> 88d9a8e1c9ae
Step 3/17 : COPY package.json .
 ---> Using cache
 ---> 303eb67be26d
Step 4/17 : COPY package-lock.json .
 ---> Using cache
 ---> 7ede716cef2c
Step 5/17 : RUN npm install --include=dev
 ---> Running in 9606e6528fce
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!   peerOptional react@"^16.8.0 || ^17.0.0" from @apollo/[email protected]
npm ERR!   node_modules/@apollo/client
npm ERR!     @apollo/client@"^3.5.9" from the root project
npm ERR!   17 more (@reduxjs/toolkit, @testing-library/react, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.7 || ^15.0.0 || ^16.0.0" from [email protected]
npm ERR! node_modules/react-lottie
npm ERR!   react-lottie@"^1.2.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"^0.14.7 || ^15.0.0 || ^16.0.0" from [email protected]
npm ERR!   node_modules/react-lottie
npm ERR!     react-lottie@"^1.2.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-11-05T11_22_19_069Z-debug-0.log
1 error occurred:
        * Status: The command '/bin/sh -c npm install --include=dev' returned a non-zero code: 1, Code: 1

Add multiple domain support

I think it would be interesting to have the ability to manage multiple redirect domains from a single Pckw instance. For example, we could manage all domains of the instance as administrators from the panel (see issue #13). This can be useful in many situations, instead of having to host several instances for several domains.

Avoid using await before redirecting the target url

Hi Mohit,

I feel we can optimize and increase the speed more by avoiding the promise for updating the hit count, as it can happen asynchronously. It might not even make a big difference in terms of speed for now, but when the data gets too populated, this might be useful.

// Increses the hit count
await prisma.pckd.update({
where: {
id: data.id,
},
data: {
hitCount: data.hitCount + 1,
},
});
// Redirect to target
res.redirect(data.target);

But overall, amazing work.
Good day!

Add VPN detection

Allow detection of VPN using IP registry's new features. Even add an option to disable redirection to target link for such users.

Issues installing dependencies

Hey there, I've been having to reinstall Pckd (worked perfectly the first time) however I'm running into issues building dependencies and so on

Is anyone able to assist with this?

> [email protected] init
> npm i -D nodemon concurrently && concurrently "npm run server-install" "npm run client-install"


added 132 packages, and audited 133 packages in 8s

18 packages are looking for funding
  run `npm fund` for details

5 moderate severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
[0] 
[0] > [email protected] server-install
[0] > cd server && mv .env.example .env && npm install
[0] 
[1] 
[1] > [email protected] client-install
[1] > cd client && mv .env.example .env && npm install
[1] 
[1] npm ERR! code ERESOLVE
[1] npm ERR! ERESOLVE could not resolve
[1] npm ERR! 
[1] npm ERR! While resolving: [email protected]
[1] npm ERR! Found: [email protected]
[1] npm ERR! node_modules/react
[1] npm ERR!   react@"^17.0.2" from the root project
[1] npm ERR!   peerOptional react@"^16.8.0 || ^17.0.0" from @apollo/[email protected]
[1] npm ERR!   node_modules/@apollo/client
[1] npm ERR!     @apollo/client@"^3.5.9" from the root project
[1] npm ERR!   17 more (@reduxjs/toolkit, @testing-library/react, ...)
[1] npm ERR! 
[1] npm ERR! Could not resolve dependency:
[1] npm ERR! peer react@"^0.14.7 || ^15.0.0 || ^16.0.0" from [email protected]
[1] npm ERR! node_modules/react-lottie
[1] npm ERR!   react-lottie@"^1.2.3" from the root project
[1] npm ERR! 
[1] npm ERR! Conflicting peer dependency: [email protected]
[1] npm ERR! node_modules/react
[1] npm ERR!   peer react@"^0.14.7 || ^15.0.0 || ^16.0.0" from [email protected]
[1] npm ERR!   node_modules/react-lottie
[1] npm ERR!     react-lottie@"^1.2.3" from the root project
[1] npm ERR! 
[1] npm ERR! Fix the upstream dependency conflict, or retry
[1] npm ERR! this command with --force, or --legacy-peer-deps
[1] npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
[1] npm ERR! 
[1] npm ERR! See /home/phoenpc/.npm/eresolve-report.txt for a full report.
[1] 
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR!     /home/phoenpc/.npm/_logs/2022-07-01T12_40_09_221Z-debug-0.log
[1] npm run client-install exited with code 1
[0] 
[0] added 202 packages, and audited 203 packages in 7s
[0] 
[0] 12 packages are looking for funding
[0]   run `npm fund` for details
[0] 
[0] 5 vulnerabilities (2 moderate, 3 high)
[0] 
[0] To address all issues, run:
[0]   npm audit fix
[0] 
[0] Run `npm audit` for details.
[0] npm run server-install exited with code 0

2022-07-01T12_40_09_221Z-debug-0.log

BACKEND_URL & URL validation

Hi, I need help.

I already set REACT_APP_BACKEND_URL= in client .env but in the logs show backend_url not found.

And could you please add a validator to check in put URL as valid or not.

Thanks

Login Screen Flashing Glitch

After entering the login details and pressing the login button, upon successful login, during the redirect process, strange flashes appear, like:

Flashing Login Screen

This is a well known problem while dealing with local storage and React-Router at the same time, and will be fixed by implementing using the browser-native location API.

Pin Link, categorize or add tags

Allow users to create categories or tags ๐Ÿท for their links ๐Ÿ”—. Useful for those using this as a bookmark manager. ๐Ÿ“‘

Forward URI parameters

It'd be nice if pckd could forward URI parameters from the request. For example it'd be nice to create yayy.me/pckd-issue which forwards to this page to create a new issue, but then further allow the caller to manipulate the URI with something like ?title=some%20title (This is vaild: https://github.com/Just-Moh-it/Pckd/issues/new?title=some%20title)

At the moment if you create a link and then try to add parameters pckd throws the error Target not found

Add Geo Targeting To Links

The look and feel of this project is amazing. I would like to suggest a few things starting with the ability to add geo targeting to links.

If the shortlink was for an amazon product and you wanted to include the UK link, the US, AU, DE, FR etc when you visited the shortlink, it would determine your country geo location and then use the correct url for the country.

This ability would also be great for websites that have multiple languages (eg go to the FRENCH Language version if geo located in France).

Or even to redirect to the site that will load the fastest (eg. website.com/au or website.com/uk)

Not everyone would want this feature on every link either, but the ability to be able to have a "SmartLink" would be awesome!

Add IP info caching to prevent abuse

Add temporary caching to the backend, so that people who previously hit any link in the instance, and whose IP info has been looked up, do not over-use the host's credit by hitting links too often.

Cannot load from mysql.proc

Server version: 10.5.15-MariaDB-0+deb11u1 Debian 11

Install from code
https://docs.pckd.me/docs/install-from-code

Database created and .env changed with needed informations (dbuser,dbpassword,dbname,host,port)

If i do "npm run db-init" i get the error:

Error: Cannot load from mysql.proc. The table is probably corrupted
0: migration_core::api::SchemaPush
at migration-engine/core/src/api.rs:184

Feature Request - Stand-alone container

I looked at your docker compose file, and noticed you included the Nginx and Postgres. I already have Nginx running as reverse proxy and Postgres containers and don't want to spin up another one. Would it be possible for you to write docker-compose example for stand-alone pckd container?

Thank you.

Sync database with schema is failing

I followed all steps from to the installation guide. sync database with schema failing with below errors. please advise

Environment details:

OS : ubuntu 20.04
node version : v14.21.1
nom version : 6.14.17


root@pckd-server:~/Pckd# npm run db-init

[email protected] db-init /root/Pckd
cd server && npm run db-init

[email protected] db-init /root/Pckd/server
npx -y prisma db push

npx: installed 104 in 7.337s
command not found: db
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] db-init: npx -y prisma db push
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] db-init script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-11-14T08_42_13_175Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] db-init: cd server && npm run db-init
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] db-init script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-11-14T08_42_13_203Z-debug.log

App Crash while starting

npm start

[email protected] start
export NODE_ENV=production && cd server && npm start

[email protected] start
npm run dev

[email protected] dev
nodemon src/.

[nodemon] 2.0.20
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node src/.
/var/www/short.webport.at/public_html/server/src/utils/isp.js:11
type: data?.company?.type,
^

SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/var/www/short.webport.at/public_html/server/src/utils/hitInsert.js:1:13)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
[nodemon] app crashed - waiting for file changes before starting...

Can't generate short URL - app crashing

I'm unsure how I managed this but I seem to have trouble getting my instance to generate short URLs.

This started after I started from scratch when I did a full upgrade to Ubuntu Server 22.04.

In terminal, [nodemon] app crashed - waiting for file changes before starting... (stuck on this 5+mins)
image

On website after trying to generate a link,
Error! Error: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
image

Any ideas on how to possibly resolve this?

Adding forgotten password capabilites

Currently, this screen is shown when trying to reset the password:

reset

There are two solution proposed to this:

  • Adding email-verification and then resetting code
  • Using third party providers like Auth0

And it is not possible with these due to the following limitations

  • Users would have to set their own email-client or SMTP server, which is a hassle and email delivery is still not promised. Even if one sets up node mailer to work with Gmail, there are a lot of steps involved, like turning on less-secure-app access, or setting up Oauth2 credentials. Therefore, this approach is not likely to be adopted until these shortcomings are addressed.

  • Another approach, by using third party authentication services, defeats the purpose of this app, i.e. to make it totally open source and built upon free technologies. Though some providers have very generous free tiers, there still could be limitions in the future, like the number of signups supported per instance, number of logins, etc. and since authentication is such a crucial part of the application, it can't depend upon such vague factors.

Therefore, currently, the only way to reset forgotten password is to directly make changes into the database, until a better solution that users will not have to go through a hassle is proposed.

Add API Support

Thanks for making pckd! Do you have any plan to add API support for it?

Dark Mode

A dark mode ๐Ÿ–ค would be nice! If not for the front end, definitely for the back end or dashboard side. ๐Ÿš€

Create an admin panel

Hello! ๐Ÿ‘‹
First of all, thank you for offering this service for free!

I think it would be interesting to create an administration panel to manage all the URLs present on our server of the different users.
Moreover, it would be also interesting to make sure that anonymous users can't create links (for example, put an option in the admin panel to allow or not this).
Also, a system to manage the users present on our instance, to limit it to certain users only. For example, an approval system for users when they register on the panel could be a good idea.

If you have any questions about these ideas, please do not hesitate to contact me.
Thanks again to you, ๐Ÿ’ช
Ben.

`TypeError: x.timezone.offset is null` after first hit

Brand new installation in Docker. Created my first test short link with tracking enabled. Dashboard shows everything correctly.

After the first hit, when re-visiting the dashboard the page loads and then goes blank. Tried in both Firefox and Chrome - same behaviour.

Browser console shows:
TypeError: x.timezone.offset is null

PostgresDB entry shows:

pckd=# select * from "Hits";
            id             |          ip           | type | isp | timezoneName | timezoneOffset | timezoneId | timezoneAbbreviation | locationName | locationCity | locationPostal | locationCountryName | locationCountryCode | locationContinentName | locationContinentCode | browserName | browserVersion | O
SName | OSVersion |          pckdId           |        createdAt        |        updatedAt        
---------------------------+-----------------------+------+-----+--------------+----------------+------------+----------------------+--------------+--------------+----------------+---------------------+---------------------+-----------------------+-----------------------+-------------+----------------+--
------+-----------+---------------------------+-------------------------+-------------------------
 cl366nqzi0793ncqomtfyca0t | 10.0.9.254, 10.0.3.21 |      |     |              |                |            |                      |              |              |                |                     |                     |                       |                       | Firefox     | 100.0          | L
inux  | x86_64    | cl366mvmt0756ncqof4yd7dm1 | 2022-05-14 18:09:35.838 | 2022-05-14 18:09:35.839

Any ideas what might be going wrong?

Docker frontend crashing

Using either the latest docker image or building it myself, I get this error:

frontend_1  | 2022/06/04 12:57:12 [emerg] 1#1: no host in upstream ":4000" in /etc/nginx/conf.d/default.conf:16
frontend_1  | nginx: [emerg] no host in upstream ":4000" in /etc/nginx/conf.d/default.conf:16
frontend_1  | Starting NGINX...
pckd-url-shortener_frontend_1 exited with code 1

Which makes Pckd unreachable from the web.

pckd.me blacklisted domain

AT&T customers and Bitdefender users can't access pckd.me or docs.pckd.me without creating exceptions in their firewalls.

Allow `/` in short link

It'd be nice to able to have links that allow /. An example I just thought of could be something like:

yayy.me/github -> github
yayy.me/github/polds -> my profile
yayy.me/github/Just-Moh-it -> your profile

Analytics data now showing in Dashboard

Hi, Pckd installed successfully in localhost. However client start with yarn. NPM not worked for me.

In dashboard Info, Metrics, Edit, Trash element not visible. Also Insights, Location Map, All hits not visible. I have ipregistry API Key mentioned in .env.

Thanks Pckd.
dashboard

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.