peterberbec / yourls-keyword_charset_length Goto Github PK
View Code? Open in Web Editor NEWAllows simple charset hook override
Allows simple charset hook override
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.
Dear @peterberbec,
when we set the value of character is 6, does it mean by minimum system will get 6 characters keyword? or limit to only 6 characters keyword?
Thank you.
Fahmi Paridin
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.
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?
Hello,
How can I set the Minimum character for the custom link?
I didn't find any option with this plugin!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.