diff --git a/Dockerfile b/Dockerfile index 65232123..42bfc8d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ CMD ["echo", "NEXT_PUBLIC_SHORT_DOMAIN=$NEXT_PUBLIC_SHORT_DOMAIN"] WORKDIR /app COPY package.json yarn.lock prisma .env scripts/update_ip_db.sh ./ RUN npm install +# add sharp for image production +RUN npm install sharp # Update IP Database # ENV GEOLITE2_LICENSE_KEY ${GEOLITE2_LICENSE_KEY} # RUN ./update_ip_db.sh diff --git a/README.md b/README.md index 05ad8e46..c4e33672 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,26 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). +# Clickdi - URL Shortener -## Getting Started +Lightweight web application for shortening URLs, along with real-time click tracking, differentiate between real and unique clicks, free to use and modify. -First, run the development server: +## What's this -```bash -npm run dev -# or -yarn dev -``` +- **Shortening URLs**: Shorten link to 3 unique hash xxx (clid.top/xxx), link saved by IP, no sign in required tracking shortened link goes publicly, unless set new password -docker run -p 6379:6379 -d redis -docker exec -it ... sh +- **Detect Uniqe Clicks**: Tracks clicks on the shortened URLs in real-time (polling) +- **Detect Human Clicks**: Distinguish genuine clicks from bots or automated scripts -Open [http://localhost:5000](http://localhost:5000) with your browser to see the result. +- **Free to Use**: Free to clone, modify, and distribute. -You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. +## How to Build -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:5000/api/hello](http://localhost:5000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. +*To be updated* -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. +## Contact -## Learn More +For any further questions or inquiries, you can reach out to the maintainers of this project: -To learn more about Next.js, take a look at the following resources: +- Maintainer Name: Dolph +- Maintainer Email: dolph.pham@gmail.com -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. - - -gpg --symmetric --cipher-algo AES256 .env.production +If you read this. Thank you & happy coding. diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 2daf84da..33cf44c4 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -23,7 +23,7 @@ "country": "Country", "userAgent": "User Agent", "date": "Date", - "clickedByHuman": "Unique click", + "clickedByHuman": "Total click", "copyRawInfo": "copy raw info", "trackingLive": "Live link tracking", "shareFacebook": "Share Facebook", diff --git a/public/locales/vi/common.json b/public/locales/vi/common.json index 2547ca79..78353bc4 100644 --- a/public/locales/vi/common.json +++ b/public/locales/vi/common.json @@ -23,7 +23,7 @@ "country": "Quốc gia", "userAgent": "User Agent", "date": "Thời gian", - "clickedByHuman": "Click thật", + "clickedByHuman": "Số lượt click", "copyRawInfo": "copy đầy đủ", "trackingLive": "Theo dõi link trực tiếp", "shareFacebook": "Chia sẻ Facebook", diff --git a/rabbitmq/consumer.ts b/rabbitmq/consumer.ts deleted file mode 100644 index e64c86b5..00000000 --- a/rabbitmq/consumer.ts +++ /dev/null @@ -1,27 +0,0 @@ -// @ts-nocheck -export = {}; -// const { AMQPClient } = require('@cloudamqp/amqp-client'); - -// async function initRabbitMQ() { -// try { -// const amqp = new AMQPClient(process.env.RABBITMQ_URL); -// const conn = await amqp.connect(); -// const channel = await conn.channel(); -// const queue = await channel.queue('shortened'); // RabbitMQChannel.SHORTENED -// await queue.subscribe({ noAck: true }, consumer); -// console.log('RabittMQ is running'); -// } catch (error) { -// console.error('RabittMQ', error); -// error.connection.close(); -// } -// } - -// const consumer = async (msg) => { -// // console.log('RabittMQ received: ', msg.bodyToString()); -// console.log(JSON.parse(msg.bodyToString())); -// await setTimeout(() => { -// console.log('processed', msg.bodyToString()); -// }, 5000); -// // await consumer.cancel(); -// }; -// module.exports = { initRabbitMQ }; diff --git a/rabbitmq/index.ts b/rabbitmq/index.ts deleted file mode 100644 index c3c2a30e..00000000 --- a/rabbitmq/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { publish } from './producer'; - -export const RabbitMQService = { - publish: publish, -}; - -export type MessagePayload = { - type: MessageType; - data: any; -}; - -export enum MessageType { - FORWARD = 'FORWARD', -} diff --git a/rabbitmq/producer.ts b/rabbitmq/producer.ts deleted file mode 100644 index 6a868592..00000000 --- a/rabbitmq/producer.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { AMQPClient } from '@cloudamqp/amqp-client'; -import { MessagePayload } from 'rabbitmq'; -import { RabbitMQChannel } from 'types/constants'; - -export const publish = async (payload: MessagePayload) => { - const amqp = new AMQPClient(process.env.RABBITMQ_URL || ''); - const conn = await amqp.connect(); - const channel = await conn.channel(); - const queue = await channel.queue(RabbitMQChannel.SHORTENED); - await queue.publish(JSON.stringify(payload), { deliveryMode: 2 }); - await conn.close(); -};