Hi,After a while I've decided to finally give it a try to the url shortener thing.
How is this going along ? Need help ?
so, i'm currently inclined to something like that:twist:12334566788=
The encoded base64 thing would be two 32 integers to specify user and post number k.
so, i'm currently inclined to something like that:twist:12334566788=what about trl:// (Twister Resource Locator) or irl:// (Internal Resource Locator or In Real Life)
does "=" character mark end of URL? why, if so?
The encoded base64 thing would be two 32 integers to specify user and post number k.help me decode your "QwAAAN0DAAA" to 2 integers.
I've tried to code some simple test here into applyHtml() but i've failed miserably... I thought I'd have a jquery element reference to change later, but then i realized the html is concatened as text...
Sure, we may use a different "protocol" but i think the "//" is not required.
That's actually part of the base64 string. every 3 bytes encodes to 4, but we have 8. then it adds "=" as padding.
You know you don't have to, right? Just pass into twisterd's decodeshorturl RPC and we're done.
I don't know exactly how to get a reference into the formatted post that can be later changed by a callback or something.
I don't see clearly your need
why is it need to add it by hand? can twisterd add it by itself?
That's actually part of the base64 string. every 3 bytes encodes to 4, but we have 8. then it adds "=" as padding.why is it need to add it by hand? can twisterd add it by itself?
I don't know exactly how to get a reference into the formatted post that can be later changed by a callback or something.when we match shortened twister URL and perform "msg = msgAddHtmlEntity()" we may add some id to so called templateShortenedTwisterURL which we put in newHtmlEntityLink() and then search element with that id from callback function to manage it. it's not so good but I don't see clearly your need.
so questionwhy is it need to add it by hand? can twisterd add it by itself?now sounds like — why we need put both "twist:" and "=" to "twisterd decodeshorturl twist:QwAAAN0DAAA="?
twisterd will have to identify between possibly different variations, for that is better to always have the whole thing.
I don't know exactly how to get a reference into the formatted post that can be later changed by a callback or something.when we match shortened twister URL and perform "msg = msgAddHtmlEntity()" we may add some id to so called templateShortenedTwisterURL which we put in newHtmlEntityLink() and then search element with that id from callback function to manage it. it's not so good but I don't see clearly your need.Great idea!
it was just one way. I've decided to go another one: https://github.com/miguelfreitas/twister-html/commit/3e43fdb5946a10e956b3f5c3610ad17d39517dfd
we use fillElemWithTxt() to apply formatting to elements so now we search there for .link-shortened elements, disable clicks on them and fetch URIs. then we put fetched URIs on all related to them links on document and enable clicks.
btw I suppose we may cache shortened URIs to localStorage.
There is, of course, room for future improvements: because 'decodeshorturl' may block, the best thing would be to serialize it together with the dhtget (which are limited in number of simultaneous requests). Otherwise, multiple shorturls in timeline will cause the interface to get less responsive.
can't fetch URI "twist:CQAAAG4AAAA=": resource busy, try again
Another possibility, perhaps more user friendly, could be opening a dialog box to inform the user the URL is still being fetched.
yep, I've missed that. can you explain it a bit more detailed about "may block"? and why does daemon not dhtget requested resources by itself?
I gotcan't fetch URI "twist:CQAAAG4AAAA=": resource busy, try againfrom Vegos's link. is it related?
since there may be troubles with fetching and some links cannot be fetched at all even — I think we need to be always able to choose if we want to have links in a post shortened or not. I want to add tool bar to active textarea with buttons to format text and paste links. there may be a checkbox in link pasting dialog to short link or not.
yep, I've missed that. can you explain it a bit more detailed about "may block"? and why does daemon not dhtget requested resources by itself?
It does exactly that ;-)
But remember 'dhtget' requests do also block (ie. they take some time to complete).
here may be a checkbox in link pasting dialog to short link or not.
we use fillElemWithTxt() to apply formatting to elements so now we search there for .link-shortened elements, disable clicks on them and fetch URIs. then we put fetched URIs on all related to them links on document and enable clicks.
maybe it's need to attach all created elements to element attached to twister.html.detached immediately after creation.
I want to add tool bar to active textarea with buttons to format text and paste links. there may be a checkbox in link pasting dialog to short link or not.
I want to add tool bar to active textarea with buttons to format text and paste links. there may be a checkbox in link pasting dialog to short link or not.today I've added shorten URL link to new post textareas