Git Product home page Git Product logo

urlhub's Introduction

screenshot

LaravelVersion PHPVersion GitHub license Build Status Coverage Status
MadeWithLaravel.com shield

Whatever your idea, feel free to send a pull request 😃

UrlHub was created, and is maintained by Budi Hermawan, and is an open-source, easy-to-use but powerful URL shortener. It allows you to host your own URL shortener, and gives you many useful features.

Features

  • Reliable link shortner: Does the job really well and it is very consistent. UrlHub is definitely one of the most reliable self-hosted URL shortener out there. Would recommend easily.
  • Custom URLs (ex: example.com/laravel): Allows users to create more descriptive short URLs rather than a randomly generated mix of letters and numbers.
  • QR code generator for each short link: The fastest way to access to this data is most likely opening the link from a phone. Though short URLs are handy for typing, a more convenient approach to transfer a web link to a mobile phone is through QR codes scanning.
  • Edit or delete your links: You can change both the address and the destination URL. You can even delete your URL, a feature that is not available with most shorteners.
  • View where link goes: It's nice to see where the link goes before clicking on it so you can avoid sketchy links.
  • Power of customisation: Do you want your site to be just for your use, so no one can register? No problem. It's in the configuration. Users must be registered to create Short URL? That's okay. It's in the configuration. From configuration file, you can edit pretty everything of your website. The choice is yours.
  • Sortable list of shortened URLs.
  • Modern and simple interface.
  • Made with ❤️ & ☕.

Requirements

UrlHub is a Laravel application. That means it requires this setup:

  • PHP 8.2 or newer
  • A web server like Apache or Nginx
  • MySQL / MariaDB / SQLite

Quick Start

Installation Instructions

  1. Rename .env.example file to .env or run cp .env.example .env.

    Update .env to your specific needs.

  2. Run composer install.

  3. Run php artisan key:generate.

  4. Run php artisan migrate --seed.

  5. Run php artisan serve.

  6. Login

    Email Username Password Access
    [email protected] admin admin Admin Access
    [email protected] user user User Access

Bundle application's assets

  1. npm install

  2. # Run the Vite development server...
    npm run dev
    
    # Build and version the assets for production...
    npm run build

Contributing

The people who contribute to UrlHub do so for the love of open source, our users and ecosystem, and most importantly, pushing the web forward together. Developers like you can help by contributing to rich and vibrant documentation, issuing pull requests to help us cover niche use cases, and to help sustain what you love about UrlHub.

Anybody can help by doing any of the following:

  • Ask your employer to use UrlHub in projects.
  • Contribute to the core repository.

Running Tests

From the projects root folder run

  • php artisan test
  • or composer test
  • or ./vendor/bin/phpunit

screenshot

Bug Report

If you've found a problem in UrlHub which is not a security risk, do a search on GitHub under Issues in case it has already been reported. If you are unable to find any open GitHub issues addressing the problem you found, your next step will be to open a new one.

Your issue should contain a title and a clear description of the issue. You should also include as much relevant information as possible and a code sample that demonstrates the issue.

The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix. Remember, bug reports are created in the hope that others with the same problem will be able to collaborate with you on solving it.

Do not expect that the bug report will automatically see any activity or that others will jump to fix it. Creating a bug report serves to help yourself and others start on the path of fixing the problem.

License

UrlHub is an open-source software licensed under the MIT license.

urlhub's People

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  avatar  avatar  avatar

urlhub's Issues

[BUG] A xss security vulnerability in `app/Livewire/Table/AllUlrTable.php` and PR provided

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Register an account.
  2. Login and create an URL shorten data.
  3. Edit the URL shorted, input a title with <script> code or onload onerror event listeners.
  4. Try access admin account, find the allUlrTable, go to page which contains the URL shorten created by new user, view is browser executed code.

Expected behavior
Escape the code from execution.

Actual behavoir
Trigger a javascript code execution.

Screenshots
WX20231013-214105@2x

Additional Information
Security point:
https://github.com/realodix/urlhub/blob/e1dd2ba/app/Livewire/Table/AllUlrTable.php#L91-L102

                return
                    '<span title="'.htmlspecialchars($url->title).'">'
                        .Str::limit($url->title, self::STR_LIMIT).
                    '</span>
                    ....

The title was output directly without nothing escape but string limits for 60 chars.
And if the title was insecure content(which contains javascript), it shall trigger the XSS.

By my team's examination, the title is insecure because logged in user can edit it and without escaping.


Here is my team's PR: #916

[REQUEST] RBAC and OIDC support

Could you add RBAC (Role Based Access Control)? Like admin can view all link and manage setting, editor only can create, view and manage link he create.

It would lovely if this can integrate seamlessly with OIDC provider like keycloak.

Thanks in advance.

Cannot add foreign key constraint

SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table urls add constraint urls_user_id_foreign foreign key (user_id) references users (id) on delete casca de)

Need tests

Without tests, we can't ensure changes doesn't break the existing system. If you can make up a testing environment as you have more experience on the whole architecture, I can try adding more and more features. + Tests

Edit link

Another feature can be edit url, so i can move people to another url using same link and qr code.

What is the process to update?

To install it, download it with wget in an ubuntu instance, download the latest version they released and unzip it. I wanted to know if there is any other process and if I have to run something from composer

Frontend build - powergrid

Describe the bug
Seems to be an issue building the frontend. Appears tired to the powergrid components.

To Reproduce
Steps to reproduce the behavior:

  1. npm install
  2. npm run dev

Expected behavior
Frontend builds

Actual behavoir

╰─$ npm run dev 

> dev
> npm run development


> development
> mix


✖ Mix
  Compiled with some errors in 1.37s

ERROR in ./resources/css/main.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: Cannot find module './vendor/power-components/livewire-powergrid/tailwind.config.js'
Require stack:
- /home/nathanr/Code/urlhub/tailwind.config.js
- /home/nathanr/Code/urlhub/node_modules/tailwindcss/lib/lib/setupTrackingContext.js
- /home/nathanr/Code/urlhub/node_modules/tailwindcss/lib/plugin.js
- /home/nathanr/Code/urlhub/node_modules/tailwindcss/lib/index.js
- /home/nathanr/Code/urlhub/webpack.mix.js
- /home/nathanr/Code/urlhub/node_modules/laravel-mix/setup/webpack.config.js
- /home/nathanr/Code/urlhub/node_modules/webpack-cli/lib/webpack-cli.js
- /home/nathanr/Code/urlhub/node_modules/webpack-cli/lib/bootstrap.js
- /home/nathanr/Code/urlhub/node_modules/webpack-cli/bin/cli.js
- /home/nathanr/Code/urlhub/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
    at Function.Module._load (node:internal/modules/cjs/loader:833:27)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/nathanr/Code/urlhub/tailwind.config.js:11:5)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at getTailwindConfig (/home/nathanr/Code/urlhub/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:68:53)
    at /home/nathanr/Code/urlhub/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:97:92
    at /home/nathanr/Code/urlhub/node_modules/tailwindcss/lib/processTailwindFeatures.js:46:11
    at plugins (/home/nathanr/Code/urlhub/node_modules/tailwindcss/lib/plugin.js:38:63)
    at LazyResult.runOnRoot (/home/nathanr/Code/urlhub/node_modules/postcss/lib/lazy-result.js:339:16)
    at LazyResult.runAsync (/home/nathanr/Code/urlhub/node_modules/postcss/lib/lazy-result.js:393:26)
    at LazyResult.async (/home/nathanr/Code/urlhub/node_modules/postcss/lib/lazy-result.js:221:30)
    at LazyResult.then (/home/nathanr/Code/urlhub/node_modules/postcss/lib/lazy-result.js:206:17)
    at processResult (/home/nathanr/Code/urlhub/node_modules/webpack/lib/NormalModule.js:760:19)
    at /home/nathanr/Code/urlhub/node_modules/webpack/lib/NormalModule.js:862:5
    at /home/nathanr/Code/urlhub/node_modules/loader-runner/lib/LoaderRunner.js:400:11
    at /home/nathanr/Code/urlhub/node_modules/loader-runner/lib/LoaderRunner.js:252:18
    at context.callback (/home/nathanr/Code/urlhub/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
    at Object.loader (/home/nathanr/Code/urlhub/node_modules/postcss-loader/dist/index.js:142:7)

Screenshots
If applicable, add screenshots to help explain your problem.

image

image

Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.

error when going to admin

Argument 1 passed to App\Helpers\NumHlp::readable_int() must be of the type int, float given, called in C:\xampp\htdocs\blog\app\Helpers\Helpers.php on line 79 (View: C:\xampp\htdocs\blog\resources\views\backend\partials\stat.blade.php) (View: C:\xampp\htdocs\blog\resources\views\backend\partials\stat.blade.php)

[BUG] The menu fails to open

Describe the bug
I followed the installation steps without encountering any errors. However, upon accessing the app, I found that the main menu isn't functional. When I checked the browser console, numerous errors were logged

To Reproduce
Steps to reproduce the behavior:

  1. Go to the site
  2. Log in
  3. Attempt to click on the menu to access the admin dashboard.

Expected behavior
The menu should open and allow navigation.

Actual behavoir
The menu fails to open.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Additional Information
I suspect the issue might be related to Livewire or something else.

How can I fix the error "Undefined array key 1"

ErrorException

Undefined array key 1

at C:\urlhub\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:309
305▕ : '/^[([^\]]+)]/';
306▕
307▕ preg_match($regex, $line, $matches);
308▕
➜ 309▕ return Carbon::createFromFormat('D M d H:i:s Y', $matches[1]);
310▕ }
311▕
312▕ /**
313▕ * Get the request port from the given PHP server output.

1 C:\urlhub\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:309
Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap{closure}("Undefined array key 1", "C:\urlhub\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php")

2 C:\urlhub\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:255
Illuminate\Foundation\Console\ServeCommand::getDateFromLine(" Feb 17 19:53:16 2023] 10.8.50.18:51838 Accepted")

[REQUEST]Can you add a Docker deployment method?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional Information
Add any other context or screenshots about the feature request here.

Would like to contribute.

Hey Guys, Really appreciate the work. I would like to dedicate some of my time to this project. would like to point to some issues I can take a look?

Change the screenshot

In the past, we called this project with Plur. Now we have found a new name, so the screenshot needs to be replaced.

[BUG]I encountered an error message

Describe the bug
Call to a member function prepare() on null

To Reproduce
Steps to reproduce the behavior:

  1. [First Step]

php artisan migrate --seed
image

  1. See error

image
image

[REQUEST] Options to disable anonymous shorten links and disable register new users

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
Add an option, i.e. UH_GUEST_SHORTEN [true|false] in order to enable/disable guest users to shorten links.
And add an option in .env file, i.e. UH_ALLOW_REGISTER [true|false] in order to enable/disable to register new users, or UH_ALLOW_INVITATION [true|false] in order to allow only users who have an invitation code to register.

Describe alternatives you've considered
None. I look into source codes but I'm clueless because I don't know Laravel.

Additional Information
Now guest users can shorten any links and anyone can register, but I'd like to restrict them.

Change user password

Hi guys,
there an issue i've found on user change password page.
this should not ask for current password, i cannot know user password when i need to change it, this field must be removed.

Thanks
Alex

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.