Giter Club home page Giter Club logo

smartyurl's Introduction

SmartyURL

SmartyURL, a powerful & open-source URL management tool, empowers businesses and individuals they need self-hosted tool to customize, track, shorten URLs, and manage their URLs for marketing, analytics, and reporting.

You can utilize SmartyURL to generate redirect links to the final URL, considering various variables like the visitor's geographical location or user device information.

image

For instance, you can create a unified link for mobile app downloads, dynamically adjusting the destination URL based on the user's device, whether it runs on Android or iOS. This ensures users are directed to the appropriate download link from the official store, tailored to their operating system.

Likewise, you can also generate intelligent links to route visitors to specific URLs based on their location. For instance, users from the United States will be redirected to one link, while those from Saudi Arabia will be directed to another

In addition to shortening URLs (based on domain that you use), SmartyURL also offers a variety of other features, such as:

  • Space-saving and improved readability
  • Smart URL redirects.
  • Tracking and analytics
  • Customization

Installation

Currently, as SmartyURL is in its early stages, you can only install it using Composer. In future releases, we may support other installation methods.

See Developers Guide for more information about how to install SmartyURL.

Certainly, please refer to the documentation for detailed instructions How configure, and effectively use SmartyURL for comprehensive guidance.

Documentation

Please take a look to SmartyURL documentation for detailed installation, configuration, and usage instructions.

Visitors IP Country detection

SmartyURL uses the ip2location/ip2location-php library to determine visitors country based on their IP addresses. It includes the free "IP2Location™ LITE IP-COUNTRY Database" for both personal and commercial use. For enhanced geographical redirect conditions with more accurate and up-to-date IP-based country data or if you need more accuracy consider purchasing a licensed IP2Location database. Refer to IP2Location Database Docs for more details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Every open-source project depends on its contributors to be a success. Thanks to:

Also We would like to acknowledge the following resources and contributors for their valuable assistance and support in the development of this project:

PhpStorm logo. MassarCloud Company: We would like to express our gratitude to MassarCloud LLC for their valuable support in providing hosting services during the development of this project.
PhpStorm logo. JetBrains s.r.o We would like to express our gratitude to JetBrains s.r.o for their valuable support in providing Open Source development license.

SmartyURL Legal Notice

For more information, please refer to the Legal Notice.

smartyurl's People

Contributors

mshannaq avatar dependabot[bot] avatar datamweb avatar

Stargazers

 avatar Rolling avatar Matthew Clark avatar  avatar Matteo Piotto avatar Jon avatar Chris Palmer avatar Robert avatar  avatar Foxfyre avatar  avatar アリフリュウ avatar

Watchers

 avatar

smartyurl's Issues

List and Manage Users

We must develop:

  • List System Users. (Design users list page).
  • Activate User account or deactivate user account. (that means user verify his email or not).
  • Add New User.
  • Edit User Account (including his password). and the ability to change his user group.
  • Delete User.
  • Ban/Unban user.

Feat: view times in user timezone

As users and system users may be located in various time zones, it is essential to implement a feature that allows users to set their preferred time zone. and show times for each user in his time-zone.

This customization will enhance the overall user experience and ensure accurate time-related information across the system.

Add New URL: Add Redirect Condition is hidden even if there is no condition chosen

When adding a new URL, if there is an error in the form and the page reloads, the form should be displayed again with 'Add Redirect Condition' co so that the user can make changes.

However, the choose condition button is hidden even if there is no condition chosen. This should be changed, and the Add Redirect Condition should always be visible if there is no condition chosen.

image

getting assist/newurl.js & assist/smartyurl.js make error in nginx

While SmartyURL generates JavaScript codes through the CodeIgniter Controllers , I noticed that this caused an HTTP 404 error on the nginx server if the file extension of the included file remained ending with the .js extension.

image

While tested locally on nginx too (using Homestead) works fine but in some nginx servers return 404 file not found for example:

<script src="<?= site_url('assist/smartyurl.js') ?>"></script>

<script src="<?= site_url('assist/newurl.js') ?>"></script>

If I remove the .js from the filename it works fine, but if keep the .js it will shown 404 file not found on some nginx servers.

It may be necessary to change the Nginx configuration, but to improve software compatibility without complicating installation, I recommend removing the .js extension from the file name.

The nginx server which return 404 error was on CloudPanel using proxy on port 80 , but if Try to get the .js file on port 8080 it wil rendered normally.
image

and this is the nginx configuration:

server {
  listen 80;
  listen [::]:80;
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  {{ssl_certificate_key}}
  {{ssl_certificate}}
  server_name go.extendy.link;
  {{root}}

  {{nginx_access_log}}
  {{nginx_error_log}}

  if ($scheme != "https") {
    rewrite ^ https://$host$uri permanent;
  }

  location ~ /.well-known {
    auth_basic off;
    allow all;
  }

  {{settings}}
  
  

  location / {
    {{varnish_proxy_pass}}
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_hide_header X-Varnish;
    proxy_redirect off;
    proxy_max_temp_file_size 0;
    proxy_connect_timeout      720;
    proxy_send_timeout         720;
    proxy_read_timeout         720;
    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;
    proxy_temp_file_write_size 256k;
  }

  location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {
    add_header Access-Control-Allow-Origin "*";
    expires max;
    access_log off;
  }

  if (-f $request_filename) {
    break;
  }

}

server {
  listen 8080;
  listen [::]:8080;
  server_name examplesmartyurl.link;
  {{root}}

  try_files $uri $uri/ /index.php?$args;
  index index.php index.html;

  location ~ \.php$ {
    include fastcgi_params;
    fastcgi_intercept_errors on;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    try_files $uri =404;
    fastcgi_read_timeout 3600;
    fastcgi_send_timeout 3600;
    fastcgi_param HTTPS "on";
    fastcgi_pass 127.0.0.1:{{php_fpm_port}};
    fastcgi_param PHP_VALUE "{{php_settings}}";
  }

  if (-f $request_filename) {
    break;
  }
}

I did not test it on ther web servers like apache.

We must investigate this problem thoroughly and find a solution that does not require special Nginx or web server configuration changes.

http://example.com?dldld is not valid url??

when adding new url if I add http://andriod.com/?dldld in url error The original URL is not A valid URL; please ensure that the link conforms to URLs standards. shown while http://andriod.com?dldld it is valid url.

If I try http://andriod.com?dldld it accepted.

so it must be checked.

Feat: Optimize URL View Page for Improved User Experience

Issue Description:
The URL View page would benefit from several optimizations to enhance its overall usability and visual appeal.

Proposed Enhancements:

  1. Improving Basic Information Block:
    The basic information block about the URL should be visually enhanced for a more appealing and user-friendly display. This could include improved formatting, icons, and additional details.

  2. Geographical Redirect Conditions:
    When dealing with geographical redirect conditions, it would be more user-friendly to display country names instead of country codes. This change would provide a clearer understanding of the conditions.

  3. Last 25 Visits Block:
    In the "Last 25 Visits" block, consider replacing generic labels like 'computer,' 'mobile,' and 'tablet' with corresponding device icons. This change can make the information more visually appealing and easier to interpret at a glance.

Expected Outcome:
These enhancements aim to improve the user experience by making the URL View page more visually appealing, user-friendly, and informative. Users will find it easier to understand the geographical conditions, and the last 25 visits block will be more intuitive with device icons.

Please provide additional guidance or specific requirements for implementing these optimizations if needed.

Comment Lines // in JavaScript Not Removed When Minifying

When the smartyurl.minifyHtmloutput setting is enabled (set to true), comment lines in JavaScript code that use // are not removed during the minification process. For example:

<script> // set the redirectCondition var redirectCondition = document.getElementById("redirectCondition"); redirectCondition.value = "device"; </script>

This can result in errors in the JavaScript code.

Suggested Solution:

If you're a SmartyURL developer or creating tools and UI for SmartyURL, we recommend using /* */ for comments in JavaScript output instead of // while we address this issue. This ensures proper comment handling during the minification process.

We appreciate your understanding, and we'll address this issue in an upcoming update.

feat: Ability to see Recent URL Visits globally for all URLs

It is good to add a page that list recent visits to all URLs.

I recommend implementing a dynamic page that compiles a list of recent visits to all URLs. To enhance user experience, consider incorporating an auto-refresh feature, updating the page every few seconds. This ensures users can effortlessly stay informed about the latest visits without manually refreshing the page.

This may need new permission or just use admin.manageotherurls for this feature. think about it.

Optimize QR Code Version Selection Based on URL Length

Issue Description:
Currently, SmartyURL relies on a static QR Code version defined in the configuration file as Smartyurl.qrCodeVersion, with a default value of 7. However, it would be beneficial to dynamically determine the QR Code version based on the length of the URL.

Proposed Solution:
We should modify the function smarty_smart_detect_qrversion() located in Helpers/smarty_helper.php to automatically detect the length of the URL and select an appropriate QR Code version between 1 and 40. This dynamic approach will ensure that both short and long URLs are optimally encoded in QR Codes.

Steps to Implement:

  1. In the Helpers/smarty_helper.php file, update the smarty_smart_detect_qrversion() function to take the URL length into account.
  2. Calculate the length of the URL and use a conditional structure to determine the appropriate QR Code version.
  3. Ensure that the selected QR Code version is within the range of 1 to 40.
  4. Update the QR Code generation logic to use the dynamically determined version.

Expected Outcome:
By implementing this dynamic QR Code version selection based on URL length, we can optimize the QR Code generation process to accommodate both short and long URLs effectively.

Additional Information:

  • Consider testing the modified function with various URL lengths to validate its effectiveness.
  • Review and update the documentation to reflect these changes for future reference.

Please let me know if there are any additional details or specific guidelines for implementing this enhancement.

duplicated tag in tags cloud

in New URL form when showing tags cloud and if urltags_shared_between_users set to true then if there is same tag name for more than one user then the tag cloud shown duplicated tags:

See:
image

While this isn't problematic as each tag has its unique id, we should enhance performance by displaying only one tag, eliminating duplicates.

Feat: link user utls when showing username in list urls

Now when list all users URLs you will see all users urls. and if you expand any url you will see it is owner like that:

image

it will be nice to link the username with a link to list all URLs for that user.

also in URL view page also:

image

Feat: support for customizing QR Code colors and adding logos

Currently, SmartyURL generates QR Codes with a standard black and white color scheme. While this is sufficient for basic scanning purposes, it would be beneficial to provide users with more control over the appearance of QR Codes. This would allow users to customize QR Codes to match their brand or to make them more visually appealing.

Specifically, I propose implementing the following features:

  • Color customization: Allow users to specify the color of the QR Code modules (the black squares and white spaces).
  • Logo insertion: Allow users to insert a logo into the center of the QR Code. This would allow users to brand their QR Codes and make them more recognizable. The logo image should be transparent and should not interfere with the scannability of the QR Code.

These features would provide users with more flexibility and control over the appearance of QR Codes, making them more versatile and visually appealing.

Error: Editing URL with Reserved Identifiers will Creates a New URL

When attempting to edit a URL with a reserved identifier and providing a new URL identifier, the system creates a new URL instead of updating the existing one. This behavior should be corrected to enable proper URL editing.

image

The submit button should be Update URL and post to the correct action, instead of showing `Create Smarty link' and point to the create action.

URL identifiers should not exist on CodeIgniter valid routes

When creating a new URL identifier, the identifier should not already exist as a valid CodeIgniter route. This is because if a URL identifier exists as a valid route, then it will conflict with the route, and the route will not be able to be accessed.

Steps to reproduce:

  1. Create a new CodeIgniter route.
  2. Try to create a new URL with identifier with the same value as the route.

Expected behavior:

An error message should be displayed indicating that the URL identifier already exists as a valid route or smoething like that.

Additional information:

This issue is important because it could lead to problems if users try to create URL identifiers that already exist as valid routes.

smartyurl.minifyHtmloutput = true makes js error

When enable minify Html output using

smartyurl.minifyHtmloutput = true

will cause a javascript error in many js files newurl

The error:

Uncaught SyntaxError: Unexpected end of input

if we check the file we can see all js code is on one line and commited like this

image

Design the URL View Page

The URL View page: url/view/(:num)

  • make sure from the router and controller is defined and only for logged in users.
  • make sure from the URL is exists or not.
  • make sure from current user permission can see the URL view page.
  • getting the data about URL including URL Tags.
  • design the view to show all URL info.
  • show the data into view
  • Get ready to show URL hits traffic data.
  • add the QR Code feature to the view url page. #78

Bug: url shown in encoded format

The url stoered in db as encoded format.

this will show the url in encoded format like this:
image

we must make sure to decode it before show. in view url page and in url hits list page.
or we can store it in database with decoded format.

QR code generator for URL

We should explore open-source tools for generating QR codes for URLs. The selected tool should offer the following capabilities:

  • The tool must be capable of generating PNG or SVG QR codes in various sizes (SVG Preferred).
  • It would be advantageous if we could have control over the appearance of the generated QR code, allowing customization such as changing colors and, if possible, adding images to it.
  • While it's not a requirement, it would be advantageous if the tool could also generate QR codes in PDF format.

Note that:
When generating a QR code for a URL, it's essential to include a query string segment to track visits originating from the QR code.

Why yo generate QR Code for every URL

Generating a QR code for every shortened URL in SmartyURL can be a valuable feature for several reasons:

  1. Accessibility and Convenience: QR codes provide a convenient way for users to quickly access the shortened URL, especially on mobile devices. Users can scan the code instead of manually typing the URL.

  2. Enhanced User Experience: Offering QR codes can enhance the user experience, making it easier for people to interact with the URLs you've shortened. This can be particularly beneficial for marketing campaigns, where users may need to access URLs on physical materials (e.g., posters, flyers).

  3. Tracking and Analytics: If SmartyURL generates unique QR codes for each shortened URL, it can also track and provide analytics on QR code scans. This data can be valuable for businesses and marketers to measure the effectiveness of their campaigns.

  4. Sharing and Distribution: QR codes simplify the process of sharing URLs. Users can easily share URLs by sharing the QR code image, which can be embedded in print materials, presentations, or online content.

  5. Promotional Use: For businesses, QR codes can be used in promotional materials, linking customers to special offers, product details, or loyalty programs. This can increase customer engagement and conversions.

  6. Multi-Platform Compatibility: QR codes are widely supported on various devices and platforms, making them accessible to a broad audience.

  7. Branding and Customization: SmartyURL can provide options for customizing QR codes with branding elements, such as logos or colors, to align with a company's visual identity.

Overall, integrating QR code generation into SmartyURL can improve accessibility, user experience, and analytics, making it a valuable feature for both individual users and businesses. It's a versatile tool that can be used in various scenarios to simplify URL sharing and tracking.

Add <noscript> tag to UI

As the application relies on JavaScript in various parts, we must include a tag to notify users that JavaScript needs to be enabled in their web browser for full functionality.

Bug: permitted User can edit his account

Describe the bug
if user is permitted then he can edit his account (while listing users) and then he can deactivate his account or block himself by mistake and that is not logic.

To Reproduce

  1. login as super admin
  2. list all users
  3. try to edit your account

Expected behavior
is not logic to let the user edit his account that way.

it happend in

  • SmartyURL Version: v0.0.0-dev-dnd.6 while below that edit user not available yet.

URL identifier unique ?

Are URL identifiers case-sensitive? For example, are the following two identifiers the same:

secure_wordpress
secure_WORDPRESS
If they are different, then this could lead to problems if two users try to create resources with the same identifier, but different cases.

Bug: when long url shown

when long url shown
image

this will create bad UI , also when show toe tooltip.

we must create a function to show less of the URL instead of all URL. with the ability to expand it if applicable.

rate limit notice

I've noticed the presence of a rate-limit across all SmartyURL, which is undoubtedly beneficial for safeguarding URL Go Controller and URL identifiers.

However, it appears that when we utilize 10 requests, the rate limit affects regular users (error 429 appear to me when using Add New URL). Would it be possible to increase the rate limit for all site-related activities while retaining it at 10 for user login forms and Go controller, without the need for a shield core change?

If this isn't possible, could we consider applying the rate-limit exclusively to the URL Go controller and shield only, and removing the rate limit for all other requests?

Your insights and guidance on this matter would be greatly appreciated.

Feat: add @ and # in search while listing URLS without big touch to code?

Consider enhancing the URL listing feature by introducing the capability to search for user URLs using the "@" symbol and for tag URLs using the "#" symbol. We should explore implementation options but without big changes to the core code?

for example @admin for searching in admin URLS.
or #internal for searching in internal tag

or if we want to make more performance we can

#internal register link will search for word register link in internal tag

#admin register link will search for word register link in admin user URLs.

Feat: delete URL

The app does not provide any way to delete the URL.

The User should have the ability to delete URLs.

refactor: Store user groups definition in the database.

If we want to let the administrators control the usergroups permissions and update it from the portal instead of Editing the config files that mean we should store the AuthGroups.php $groups and AuthGroups.php $matrix into database. while we will keep the permissions $permissions in file because there is no need to let the admin add or modify permissions itself.

We're shifting control of user groups and theirs permissions to administrators via the portal, that eliminating the need to modify configuration files. To facilitate this transition, we must store user group definitions and their permissions in the database.

Completed in the database migration file app/Database/Migrations/2023-11-16-171158_AddDefaultSettings1.php. (that need php spark migrate for updating to this version from old SmartyURL versions).

Next, we'll manage user groups using the CodeIgniter settings library. Grateful for CodeIgniter's efficient handling of settings.

CodeIgniter shield automatically uses setting to try to get the user groups and matrix.

get maxTags in assist/newurl from settings

it is best to get the maxTags in assist/newurl from settings instead to use a static number. and check other variables also.

maxTags: 10,
dropdown: {
maxItems: 20, // <- mixumum allowed rendered suggestions
classname: "tags-look", // <- custom classname for this dropdown, so it could be targeted
enabled: 0, // <- show suggestions on focus
closeOnSelect: false // <- do not hide the suggestions dropdown once an item has been selected

this will give the admin the opportunity to set what he needs.

SmartyURL has error sending email in live env.

SmartyURL has error sending email in live env.
testing for login with smart link in shiled

<[email protected]>: host gmail-smtp-in.l.google.com[google.ip.ip.ip] said:
    550-5.7.26 This mail is unauthenticated, which poses a security risk to the
    550-5.7.26 sender and Gmail users, and has been blocked. The sender must
    550-5.7.26 authenticate with at least one of SPF or DKIM. For this message,
    550-5.7.26 DKIM checks did not pass and SPF check for [massarcloud.sa] did
    not 550-5.7.26 pass with ip: [!!!!!smarty_hostingip_why_not_the_smpip!!!!!]. The sender should visit
    550-5.7.26  https://support.google.com/mail/answer/81126#authentication for
    550 5.7.26 instructions on setting up authentication.
    m15-20020aa7c2cf000000b00532c440746fsi9441448edp.178 - gsmtp (in reply to
    end of DATA command)

the bounce email was show the hosting IP , not the used SMTP IPs.

this should be tested again.

spark migrate does not work if DBPrefix defned

if config variable DBPrefix or .env vairable DBPrefix is defined so php spark migrate will not work and wil give

CodeIgniter v4.4.1 Command Line Tool - Server Time: 2023-09-25 14:32:43 UTC+00:00

Running all new migrations...

[CodeIgniter\Database\Exceptions\DatabaseException]

migration should be changed to support DBPrefix

Feat: Allow downloading QR Code in multiple formats

Description:

Current Behavior:

The current version of SmartyURL only allows downloading QR Code in SVG format.

Desired Behavior:

It would be beneficial to have the ability to download QR Code in multiple formats, not limited to just SVG. This could include commonly used formats such as PNG, JPEG, or others.

Steps to Reproduce (if applicable):

  1. Attempt to download the QR Code in a format other than SVG

Sharing URLs Between Users

Discussed in https://github.com/Extendy/SmartyURL/discussions/67

Is sharing URLs between users a valuable addition to SmartyURL?

I think yes it is. This feature proves especially beneficial for companies with global links and need employees to list that links without need to push every employee to create his own link for the same URLs.

So the admin or one of employees an create a link and choose that link is shared , then all employees can see that link from their account. but sure only the owner can modify or delete it unless the user is super user or have the rights to manage other urls.

I believe that if we intend to enable URL sharing among users, it should align with the following policy:

Firstly, there should be a system setting that can be toggled to specify whether users are allowed to share URLS or not. and also the group must have permission that can create sharable link.

Secondly, when a user creates a new link, they should have the option to designate whether the link is shareable among users or not.

This policy allows management to determine whether links are generally shareable and provides users the opportunity to specify if a link can be shared among users or not when creating it.

Consequently, if management disables link sharing among users, the option to share a link won't be available to the user when creating the link.

Feat: Implement feature to distinguish between direct URL visits and QR Code requests

Currently, SmartyURL does not provide a way to distinguish between requests to 'Go' Controller originating from direct link visit and those originating from QR Codes. This can be a limitation for scenarios where it is important to know the source of the request, such as when tracking user behavior or implementing targeted promotions.

To address this limitation, we propose implementing a feature that allows SmartyURL to identify the source of each request. This can be done by parsing the HTTP referrer header or by adding additional query string to QR Image to determine when someone is coming from QR by analyzing the query string. If the referrer header contains a QR Code URL, we can assume that the request originated from a QR Code scan.

The ability to distinguish between direct URL and QR Code requests would provide several benefits, including:

  • Improved user tracking: By knowing the source of a request, we can better track user behavior and understand how users are interacting with the URLs.
  • Targeted promotions: We can use the source of a request to target promotions and other content to specific users or groups of users.

I believe that this feature would be a valuable addition to SmartyURL and would greatly enhance its functionality.

Implementation:

The proposed feature can be implemented by parsing the HTTP referer header in the incoming request. If the referer header contains a QR Code URL, the request can be identified as originating from a QR Code scan (with known query string that added to QR Image). then store the his as QR Code hit.

URLs Statics in Dashboard

in Dashboard a block for URL statics contains

(depends on user permissions show All Users URLs or just for his URLs).

  • Total URLs.
  • New URLs This Month.
  • New Today URLs.

URLs visits (depends on user permissions show All Users URLs or just for his URLs).

  • Total Visits
  • This Month Visits
  • Today Visits (daily visit Count)

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.