Giter Club home page Giter Club logo

yourls-keyword_charset_length's People

Contributors

cgmckeever avatar peterberbec avatar plablo avatar plttn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

yourls-keyword_charset_length's Issues

autoadjusting number of characters when character combinations run out

This plugin fails when the number of character combinations available runs out. E.g. if using the default YOURLS 36-character set (leaving the custom charset blank in the plugin settings) and then setting the plugin to randomly generate 1-character links, the plugin will fail when the 37th link is created (since there are only 36 possible links using 1 character in a 36-character set). While starting off with a larger number of characters for shortlinks will allow a larger number of possible combinations, in order for the plugin to be arbitrarily scalable, and also have the shortest possible links, it would be better to autoadjust the number of characters for shortlinks when the maximum number of link combinations is reached (i.e. increase the number of characters for shortlinks by one when there are no more shortlinks available).

As it is now, the plugin is appreciably well-behaved when the character combinations run out, and it is simply a matter of manually increasing the number of characters for shortlinks by one in order to continue being able to create random shortlinks.

Security issue regarding direct call to the plugin

Hi! Your plugin is amazing, it's doing really well.

I checked the plugin basic security by calling it directly, in a logout environment, with a POST request, giving an error at runtime.

I'm going to make a pull request with the small change so it doesn't have to worry about this.

DB Access

per http://berb.ec/m8nbq

cgmckeever commented 13 days ago
@peterberbec Awesome! code looks good ... we arent actively using it much now - we were having volume issues and killing the DB when we'd try to make them too quickly :(

Is there some part of my code that is particularly DB intensive?

As I read it, all the plugin does is pass a pre-set length, the option '0' to enforce limited charset, and the limited charset into yourls_rnd_string(), forcing it into the 1st option of this case statement: http://berb.ec/67ade

From what I see, the case statement resolves to an assignment statement, no matter what option is given. The one we go through has a ?: test, but that is at worst one additional in-memory comparison. The extra database access could be occurring because $link_length and $charset_liste need to be read every link creation. This may cause two extra reads DB per link creation.

Is it possible, necessary and/or a good idea to force $link_length and $charset_liste to remain in RAM? This would remove two potential DB hits per link.

Comments, suggestions?

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.