MyBB Community Forums

Full Version: Link Tools 1.4.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
I have been testing for 3 days, seems to be fine. I have some ideas but need to write down on paper.
(2021-02-09, 11:59 AM)Eldenroot Wrote: [ -> ]I have been testing for 3 days, seems to be fine. I have some ideas but need to write down on paper.

Thanks for testing, my friend! Will be very interested in your ideas!

As I mentioned privately to @Eldenroot (although not framed quite in this way as conflicting), there are two features that I want to add, one of which is for Link Helpers to be able to say "I don't need the contents of the page to know whether I can Help nor to generate a preview" (and thus, by refraining from querying the page's web server, to save on bandwidth), but the other of which is to say "I need the contents of this page to Help". I (we?) need to think carefully as to how to resolve these competing interests.

An example of the former: the existing Tweet helper can generate a (Javascript-heavy) preview based solely on the (last part of the) URL - the ID of the Tweet - without needing to load the tweet page itself. This Tweet helper could then signal "I don't need the contents of the page to know that I can help, and nor do I need them to know how to generate a preview", thus saving us bandwidth.

On the other hand, what about a PDF previewer? This Helper definitely needs the contents of the page (and its Content-Type header in particular) both to know whether it can Help as well as to Help (extract a title and image, as well as an initial preview sentence of the contents from the PDF).

But there are cases where it's not easy to decide which of these two have precedence, and whether we ought to spend the bandwidth and download the page, and if so, on what basis we do so. This is the area which I am mulling around in the back of my mind.
Hi, the update didn't work for me for some reason (no previews are displayed although apparently they are rebuilt successfully), I will certainly deep into the issue but I lack time ATM. What I noticed, is that you include the global.php file in the ACP module page. I think this should be discouraged and reviewed by you.

Regards.

Edit: About PDF rendering, I think this feature isn't necessary, if it is a PDF then don't render a preview. Most browsers already handle PDFs like web pages.
(2021-02-12, 08:08 AM)Omar G. Wrote: [ -> ]Hi, the update didn't work for me for some reason (no previews are displayed although apparently they are rebuilt successfully), I will certainly deep into the issue but I lack time ATM.

Hmm. That's not good. The first thing to do would probably be to make sure that you have the latest version of the code, as there was a bug which I fixed recently which was inhibiting previews in some situations.

(2021-02-12, 08:08 AM)Omar G. Wrote: [ -> ]What I noticed, is that you include the global.php file in the ACP module page. I think this should be discouraged and reviewed by you.

Thanks for the heads-up. I've removed it in my working code.

(2021-02-12, 08:08 AM)Omar G. Wrote: [ -> ]Edit: About PDF rendering, I think this feature isn't necessary, if it is a PDF then don't render a preview. Most browsers already handle PDFs like web pages.

Thanks for your advice. I would like though for the plugin to at least support this sort of scenario even if in practice it isn't used. Am working on the code as we speak so you should soon be able to see how I've added this support.

Have now added this support, and with it support for a Plain Text helper (where Content-Type is "text/plain", regardless of the form of the link).

In addition, have added a YouTube video helper.

All pushed to the GitHub repo.

Oh, and just a note: those two new helpers won't be auto-enabled, even via the deactivate-copy-files-reactivate upgrade method: you need to go to the Link Helpers module under "Configuration" in the ACP and check their "Template installed?" and "Enabled?" boxes then click "Update Link Helpers".

Finally (though it should have been first): thank you very much for taking some of your precious time to test this plugin out. I really appreciate it.
Hi, I updated to the latest package from Github and it seems to be working now. It seems like a helpful plugin to use.

Also, it seems like editing the linktools_linkpreview_default has no effect, something should be wrong.
(2021-02-17, 01:52 AM)Omar G. Wrote: [ -> ]Hi, I updated to the latest package from Github and it seems to be working now. It seems like a helpful plugin to use.

Excellent - glad to hear it's now working.

(2021-02-17, 01:52 AM)Omar G. Wrote: [ -> ]Also, it seems like editing the linktools_linkpreview_default has no effect, something should be wrong.

It has an effect, but only on previews generated since the edit. Previews for the default helper are cached (in the DB table mybb_url_previews), and the caching code has no way of knowing that the template has been edited so as to know that the preview needs to be regenerated (or, at least, if there is a way of finding out, I haven't yet learnt it myself and implemented it).

You can though regenerate previews via the Recount & Rebuild entry "Rebuild Link Previews for Link Tools", making sure that you have first set the plugin's "Scope of Rebuild Link Previews entry" setting to "All".

Another approach: set the "Link preview expiry period" setting to "1", and wait a day for the template change to take effect.

Also, if you are interested only in testing the change to the template on a single link, then, in the footer of the post containing the link, right-aligned where "IP logged" is left-aligned, you can click on "Regenerate preview".

(2021-02-17, 01:52 AM)Omar G. Wrote: [ -> ]Also, it seems like editing the linktools_linkpreview_default has no effect, something should be wrong.
(2021-02-17, 02:15 AM)Laird Wrote: [ -> ]It has an effect, but only on previews generated since the edit. Previews for the default helper are cached (in the DB table mybb_url_previews), and the caching code has no way of knowing that the template has been edited so as to know that the preview needs to be regenerated (or, at least, if there is a way of finding out, I haven't yet learnt it myself and implemented it).

Re the bit I've emphasised: I found a way to do this by hooking in to the template saving functionality. Now, when the template of a Link Helper that caches link previews is saved, the admin sees a page like this:

[attachment=43790]

And if the admin clicks on the button to invalidate the cache, then s/he sees a page like this:

[attachment=43791]

I'll probably release a development version of this plugin with the new link preview feature to its Extend page in the next day or two.
Released version 1.1.0, with the following new feature:
  • Adds link preview functionality. A preview box at the bottom of the post is generated for each link in a post. Different types of preview can be generated for different sites/content, as supported by a customisable Link Previewer framework.

This is marked as a Development rather than Stable release simply because there is so much new code that it is very possible that undiscovered bugs lurk. It probably is safe to use on a production site, but exercise caution, and please report any bugs you encounter.
OK, I have updated to the latest version, seems to be working fine! Thank you!
You're welcome! Thanks for the feedback.
I have been using the plugin a few days (for testing) and I couldn't find any issues yet (except the template issue but that was already explained and I have come back to it). Cheers.
Pages: 1 2 3 4 5 6