Wedge

Public area => The Pub => Plugins => Topic started by: oOo--STAR--oOo on April 16th, 2012, 08:55 AM

Title: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 16th, 2012, 08:55 AM
Hey guys,

I been making a new script called Light URL and was thinking that maybe it could come in use here as like a plugin or something.
I only been playing with it for 3 days and this is what I come up.
Sorry if I am not allowed to post links here, just remove my post if that's the case.
http://l-url.com/

Anyway.. This is all designed and coded by me from scratch!.
I am not professional but I been coding in PHP and learnt myself for some time now ;)
So I can do a lot XD
Basically I am looking to include an API for this and could possibly build it into the forums here so that you can have tiny links of all topics maybe?

The script I am making will work on ANY web server..
Requires Javascript and PHP.

Its still under development while I add more features and maybe fix bugs if I can find any lol..

Thanks for reading....
Star.
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 16th, 2012, 09:27 AM
I think for auto-tiny urls it's best to offer something like:
Site.com/go/hash

Where hash would be a letter indicating content type (t for topic?) and the Id encoded to take less space (base64-like).
That would enable plugins to add more content types, too.
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 16th, 2012, 10:12 AM
Quote from Nao on April 16th, 2012, 09:27 AM
I think for auto-tiny urls it's best to offer something like:
Site.com/go/hash

Where hash would be a letter indicating content type (t for topic?) and the Id encoded to take less space (base64-like).
That would enable plugins to add more content types, too.
Yeah that sounds like a good idea... If I understand correctly, Starting the hash off with T for topic then hash for unique ID.
This can be installed in any directory and will give the short URL stating that directory.
So having like site.com/go/T-774h would suit, if I got it right lol.
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 16th, 2012, 11:48 AM
Yay another URL shortener.

If you're planning to offer something whereby sites can generate their own shortened URLs that don't rely on l-url.com (so that site.com makes site.com/go/hash automatically), you're going to have *SO* much fun with all the mutant configurations out there that won't support your routing scheme properly, especially given how hard it is to actually set up site.com/go/hash instead of site.com/go.php?hash...
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 16th, 2012, 12:43 PM
Quote from oOo--STAR--oOo on April 16th, 2012, 10:12 AM
Yeah that sounds like a good idea... If I understand correctly, Starting the hash off with T for topic then hash for unique ID.
Yes, and 'm' for the post ID, etc... (If we provide a post link shortener, obviously.)
Quote
This can be installed in any directory and will give the short URL stating that directory.
So having like site.com/go/T-774h would suit, if I got it right lol.
It would be site.com/go/t23 for site.com/?topic=127.0, or site.com/go/m1adC for site.com/?msg=277612, for instance. (This is based on a custom int-to-base62 encoding I've been testing secretly...)
Of course, it only saves 3 bytes even for a 6-byte-long post ID...
So I don't know if it's THAT cool in real conditions. But I certainly like having "/go/" because it perfectly complements the default "/do/" (which can be redefined) for action URLs ;)
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 16th, 2012, 08:14 PM
Quote from Arantor on April 16th, 2012, 11:48 AM
Yay another URL shortener.

If you're planning to offer something whereby sites can generate their own shortened URLs that don't rely on l-url.com (so that site.com makes site.com/go/hash automatically), you're going to have *SO* much fun with all the mutant configurations out there that won't support your routing scheme properly, especially given how hard it is to actually set up site.com/go/hash instead of site.com/go.php?hash...
Bro,
I made this script myself using the idea for not having to rely on apache or a certain server configuration to generate a small URL, that will redirect users. As I use nginx... Reason for making my own.
Obviously you won't be relying on l-url.com as it would be installed on wedge.com

That's just a random "cheap" domain I purchased for me to have fun on coding it.
Yes its another short url, but yes its also different, and doesn't require require apache.



Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 16th, 2012, 08:18 PM
Well done for quoting my post but missing my point. It won't work on 'all' webserver as you quote.
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 16th, 2012, 08:23 PM
Quote from Arantor on April 16th, 2012, 08:18 PM
Well done for quoting my post but missing my point. It won't work on 'all' webserver as you quote.
Feel free to correct me then on why?
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 16th, 2012, 08:31 PM
Keep cool, Pete :P
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 16th, 2012, 08:39 PM
Quote from oOo--STAR--oOo on April 16th, 2012, 08:23 PM
Quote from Arantor on April 16th, 2012, 08:18 PM
Well done for quoting my post but missing my point. It won't work on 'all' webserver as you quote.
Feel free to correct me then on why?
Because IIS (without special configuration) and some configurations of Apache will not work the way you expect them to.
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 16th, 2012, 08:40 PM
Quote from Arantor on April 16th, 2012, 08:39 PM
Quote from oOo--STAR--oOo on April 16th, 2012, 08:23 PM
Quote from Arantor on April 16th, 2012, 08:18 PM
Well done for quoting my post but missing my point. It won't work on 'all' webserver as you quote.
Feel free to correct me then on why?
Because IIS (without special configuration) and some configurations of Apache will not work the way you expect them to.
No quiet sure what you mean, but it doesn't use any rewrite/proxy_pass rules at all.
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 16th, 2012, 08:45 PM
I know that, but there are circumstances where the incorrect query string won't be passed to PHP properly at all on those servers.
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 16th, 2012, 08:51 PM
Quote from Arantor on April 16th, 2012, 08:45 PM
I know that, but there are circumstances where the incorrect query string won't be passed to PHP properly at all on those servers.
Thanks for the clarification. I have not used all web servers. So will remember that.
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 16th, 2012, 09:21 PM
Pete what's your opinion on the go thing then?
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 16th, 2012, 11:19 PM
It's an interesting concept but I'm not sure plugins will behave cleanly with it, I suspect unless it's managed pretty much automatically they won't use it.

Mind you, most plugins will only use PURLs features that are managed automatically (very few plugins for SMF ever cared, and those that did, were pretty much portals and/or PURLs type plugins in the first place), so if it can be done transparently and 'just work', plugins can use it but otherwise they probably won't.
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 16th, 2012, 11:30 PM
Quote from Arantor on April 16th, 2012, 11:19 PM
It's an interesting concept but I'm not sure plugins will behave cleanly with it, I suspect unless it's managed pretty much automatically they won't use it.
It doesn't matter that much, does it..?
Quote
Mind you, most plugins will only use PURLs features that are managed automatically (very few plugins for SMF ever cared, and those that did, were pretty much portals and/or PURLs type plugins in the first place), so if it can be done transparently and 'just work', plugins can use it but otherwise they probably won't.
They don't have to. They simply can...
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 16th, 2012, 11:35 PM
*shrug* The bottom line is that if you provide a system in the core, other plugins should generally adhere to it, but the harder you make it for them to use, the less likely they are to use it. So make it easy for plugins to do things - i.e. have it 'just work' and plugins will benefit without having to specifically code for it.

But if it's effort for plugins to support it, they won't, making the exercise a bit of a waste.
Title: Re: Light URL Plugin Maybe?
Post by: MultiformeIngegno on April 17th, 2012, 12:42 AM
I can't really understand all this interest on URL shorteners.. You still won't remember something like g.co/hyT&tR SO WHY CHANGE THE URL??

1. There's no benefit in memorabilty
2. Your link relies on a 3rd party server (if they change their URLs structure OR their server goes down OR their company fails OR for whatever reason the link doesn't work there's nothing you can do
3. Loading is slower (also if it's the speedest server on earth the loading will be slower than the original link because of the redirection)..

In short: I can't find a reason for an external url shortner to exist. For internal... dunno.. I'm ok with PURLs.. :P
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 17th, 2012, 01:27 AM
Quote from MultiformeIngegno on April 17th, 2012, 12:42 AM
I can't really understand all this interest on URL shorteners.. You still won't remember something like g.co/hyT&tR SO WHY CHANGE THE URL??

1. There's no benefit in memorabilty
2. Your link relies on a 3rd party server (if they change their URLs structure OR their server goes down OR their company fails OR for whatever reason the link doesn't work there's nothing you can do
3. Loading is slower (also if it's the speedest server on earth the loading will be slower than the original link because of the redirection)..

In short: I can't find a reason for an external url shortner to exist. For internal... dunno.. I'm ok with PURLs.. :P
No it won't be a 3rd party service.. This will be your script installed here and managed directly here!
There will be no 3rd party access, or control. This is just the script I made that you can install yourself!


My idea was to connect an API automatically to every post that is made and so forth.
So you will have a Light URL that you can simply click and share with other users.

So the Light URL will be displayed at the top or bottom of the message and you can simply give to your friends and they can navigate to the post/topic
I understand that what you see right now is an input box and yeah can be like time wasting to keep making Light URL's yourself.
So the idea is to make it automatic and provide a Light URL for every topic/post made, using Nao's idea for the t/m to display if its a topic/message.

I mean if you have boards/sub boards and long topic names, it could be convenient.

Your right on the fact about, will the user use it? Is it convenient.
Well the option is there, some will, some won't.
It is sure a cleaner way to share links and looks better.
Title: Re: Light URL Plugin Maybe?
Post by: nolsilang on April 17th, 2012, 04:37 AM
I'm sure this is why it's a plugin, it's optional.YMMV

WIll the shortlink can be linked to specific post? maybe something like example.com/go/thash#postnumber
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 17th, 2012, 02:20 PM
Quote
I mean if you have boards/sub boards and long topic names, it could be convenient.
That's the thing, it isn't convenient.

domain.com/go/b#1 is shorter than domain.com/index.php?board=1 yes (but it requires rewrites and you can't get around that) and I'm not sure it's more convenient or easy to follow.

I won't even get into the performance issues linked to having /go/b#1 being rerouted to index.php?board=1 (since there's by definition two separate routes, knowing that the #1 won't be passed to systems normally)

But you've all missed the point I went at great lengths to try and explain. I got the fact that it would be an automatic thing, but if you make it a plugin, you have to either side-swipe other plugins and rewrite all their URLs (on top of the code in Wedge itself), or you have to expect the plugins to support it through choice. The former requires a lot of work, and the latter just isn't going to happen.

Now, let's say for the sake of argument that you make it core, presumably in addition to Pretty URLs. Not only, then, do you have to spend more time testing it, it makes it harder for plugin authors to work with, because there's three schemes instead of two that they have to contend with. I don't even see authors making real use of PURLs as it is, let alone having to navigate multiple schemes of URL routing.
Title: Re: Light URL Plugin Maybe?
Post by: nolsilang on April 17th, 2012, 02:26 PM
Dumb question: Maybe integrate with bit.ly API?you can use custom domain too IIRC.
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 17th, 2012, 02:30 PM
And that goes back to what was said earlier about having a reliance on a third party. And even then there are still problems with doing it.
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 17th, 2012, 06:56 PM
Quote from 0x on April 17th, 2012, 04:37 AM
WIll the shortlink can be linked to specific post? maybe something like example.com/go/thash#postnumber
/go/mHASH would redirect to /?msg=unhashed, which in turns redirects to /msgXXX/#msgXXX... (Of course I'd be skipping the ?msg step, no need to redirect twice...)
Posted: April 17th, 2012, 06:53 PM
Quote from Arantor on April 17th, 2012, 02:20 PM
domain.com/go/b#1 is shorter than domain.com/index.php?board=1 yes (but it requires rewrites and you can't get around that)
Of course, there's no reason not to provide a /?go=tHASH alternative if you have problems with htaccess files... It's just one extra char ;)
Quote
But you've all missed the point I went at great lengths to try and explain. I got the fact that it would be an automatic thing, but if you make it a plugin, you have to either side-swipe other plugins and rewrite all their URLs (on top of the code in Wedge itself), or you have to expect the plugins to support it through choice. The former requires a lot of work, and the latter just isn't going to happen.
I'd really like to have this as core... (But disabled by default, probably. I can see the interest in doing that. I just don't know if it's useful everywhere.)
Quote
Now, let's say for the sake of argument that you make it core, presumably in addition to Pretty URLs. Not only, then, do you have to spend more time testing it, it makes it harder for plugin authors to work with, because there's three schemes instead of two that they have to contend with. I don't even see authors making real use of PURLs as it is, let alone having to navigate multiple schemes of URL routing.
I don't see where there's a problem with it...?
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 17th, 2012, 08:41 PM
For putting this in core, I'm not sure why this is useful as compared to having Pretty URLs in core, but maybe that's just me
Quote
I don't see where there's a problem with it...?
If you're creating short hashes that include t or b as references to topics and boards, that's fine - but how does that work for plugins? What hoops do plugins have to go through in order to work? Plugins will naturally just fall in with pretty URLs (e.g. domain.com/do/pluginaction) without any work, and if they want to use pretty URLs, they can declare extra filters, but even that is going to be more effort than it's usually worth, so they won't bother. If you not expect them to have to work with yet another URL routing scheme (optionally or otherwise), it's just more hassle for plugin authors, especially when people will ask them how to make it work.

More than one person asked how to make Aeva Media work with pretty URLs, and the same's going to be more and more true when it's more thoroughly implemented (since it's all in the core now)
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 18th, 2012, 05:16 PM
Quote from Arantor on April 17th, 2012, 08:41 PM
For putting this in core, I'm not sure why this is useful as compared to having Pretty URLs in core, but maybe that's just me
Hmm... Maybe because it's not very hard to implement, mostly... Although I haven't even added it to my to-do-list...
Quote
If you're creating short hashes that include t or b as references to topics and boards, that's fine - but how does that work for plugins?
They could just take another letter of the alphabet... :P
Or even several letters... (This would ensure their hashes are tested against in priority.)
Quote
What hoops do plugins have to go through in order to work? Plugins will naturally just fall in with pretty URLs (e.g. domain.com/do/pluginaction) without any work, and if they want to use pretty URLs, they can declare extra filters, but even that is going to be more effort than it's usually worth, so they won't bother.
I don't think they will, either.
Quote
If you not expect them to have to work with yet another URL routing scheme (optionally or otherwise), it's just more hassle for plugin authors, especially when people will ask them how to make it work.
Except that they don't have to use that scheme at all...
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 18th, 2012, 07:10 PM
Quote
Except that they don't have to use that scheme at all...
This is the problem: users are going to expect them to do so. Just as users even now bitch about the fact that Aeva doesn't properly support pretty URLs. The more complex the ways you make it accessible, the harder it is for plugins to do it.

Why, exactly, do we need another route to access content, when we already have index.php?action=something;param1=val1;param2=val2 and /do/something/whatever/whatever ?
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 18th, 2012, 07:42 PM
...Because it can then be used directly in tweets, things like that...?
Granted, it's of little use, but it's not of NO use at all. :)
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 18th, 2012, 07:48 PM
Except that Twitter will automatically shove its own shortener in there anyway for almost every URL, so in any case you're going via t.co/ to get to your site.

I'm not disputing that it has *some* use, but I'm disputing its use when alongside shortish URLs and pretty URLs.
Title: Re: Light URL Plugin Maybe?
Post by: Nao on April 18th, 2012, 08:07 PM
Didnt know that. Okay, not core then ;)
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 20th, 2012, 11:10 PM
Hey Arantor.

I really don't understand your terminology when you go about converting URL.
The routes it will take to get it and what needs to be done to make it.

To make this work for topics and posts requires one extra row with the hash of the short URL.
All you have to do is on every topic display pull that row out again and apply that to the link you want to display for the short link.

Then okay navigating to it, so simple, 1st you would do a check to see if it is a short URL they have entered, then link that to the topic for navigation.

I mean you can spare one IF statement right?
You make it sound really complicated.To me it sounds like an easy process to do this.

I'm just having fun making scripts lol.
Hey Arantor, don't take offence o.k ;)

I spoken to you a few times, over at SMF when i required help and you always get a lil hot headed.. Chill man.
Passes a spliff :P

Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 20th, 2012, 11:51 PM
OK, let me explain a few things.

Routing is the process of getting from a URL to the right PHP file(s) to make it work. When the URL directly has index.php in it, it usually works out OK, the webserver calls index.php with the rest of the URL as parameters. Anything that deviates from the norm in ANY fashion is going to be unreliable.

Using index.php?stuff where you're not using index.php?stuff=stuff is going to be unreliable at best.

The other problem is that applying this to Wedge is a fucking nightmare, to put it bluntly. How many places are there index.php?topic=x but that it forms part of something else? Even cases like index.php?topic=1.0 is not the same as index.php?topic=1.15 which still has to be converted and processed, before you get into the realms of index.php?action=dlattch;attach=1;topic=1 for something else.
Quote
I mean you can spare one IF statement right?
You make it sound really complicated.To me it sounds like an easy process to do this.
That's because it is really complicated.

It's not just about the fact you have multiple URLs going to the same place, it's the fact you also have to serve up those forms of URL too. What's the point of using index.php?do/txxxxx when nothing else uses that? So then you get into the realms of rewriting URLs on the fly (unless you REALLY want to rewrite every single place where topic URLs are generated), which brings me back to the aforementioned problem.

Then you're still talking about yet more ifs that have to be run every single page view. Which means for a feature I don't want, I don't like, I'd still have to cope with the load of it in the core, and before anyone says about how it's 'just an if', it's still an if plus all the related code that is loaded every page view that I don't want to cope with.
Quote
I spoken to you a few times, over at SMF when i required help and you always get a lil hot headed.. Chill man.
Passes a spliff :P
Have you ever had to deal with people who are addicted to drugs? Have you ever been attacked by people who are trying to mug you for their next drug fix? Until you have, please do not tell me how I should approach my life.

In any case, the reason I'm "making this so difficult" is because I know how much of a nightmare this is to actually use in real life, as opposed to a script operating in a vacuum. If something like this gets added to the core, you won't be the person supporting it, I will be. And if it's a plugin, it's still going to be my problem because people will use that plugin and other plugins I write (since I'm likely to write the most plugins for Wedge) and will complain when plugins don't play nicely together, so again it's still going to be my problem.

This is why I'm hot headed, because I'm usually the one that has to pick up the mess others leave behind. Never mind the tens of thousands of hours I've spent learning my trade. I'm not actively making a living at this precise moment in time having just moved house and broken up with my long term girlfriend after ten years, but once I get sorted out here, I'll be back to making my living writing code, something a lot of people actually forget about me. They forget that I'm not just some cantankerous hermit doing it in my spare time, it's what puts food on my table. So yes, when I deal with people who think they know better than me, I will be short with them until they can demonstrate they actually are, because they're invariably not depending on it to put food on their table.
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 21st, 2012, 12:15 AM
Takes another toke of the spliff.
Hey I ain't addicted to weed I just like to chill now and then.. Its part of having fun G ;)

O.k. boss, I see your points.
You have talent I agree, but your perception on others, I think you can take a better view and understand that while you might be better at one thing there is certainly something that anyone is better than you at.

Most people see life like a competition. I see it like competition is better in numbers eeek eek  I choked on my spliff lol.

Lighten up buddy ;)
If I can help you guys I will. Its as simple as that ;)

Title: Re: Light URL Plugin Maybe?
Post by: MultiformeIngegno on April 21st, 2012, 12:23 AM
STAR are you a karma guy or something similar..? :P
Title: Re: Light URL Plugin Maybe?
Post by: oOo--STAR--oOo on April 21st, 2012, 12:26 AM
Quote from MultiformeIngegno on April 21st, 2012, 12:23 AM
STAR are you a karma guy or something similar..? :P
Lol, yeah you can say that.
I like Arantor, if he had some of my spliff, he would like me 2 lol :P
Title: Re: Light URL Plugin Maybe?
Post by: Arantor on April 21st, 2012, 10:27 PM
Given that a decade ago I was addicted to alcohol, I do not wish to get into any kind of substance abuse, and will be firmly discouraging suggestions of it.