Any possible fix for the alertmanager generatorURL breaking due to url-encoding issues - telegram

I have set-up alertmanager and configured it using the official documentation.
The set-up is made to send alerts to Slack, Email and Telegram via the alertmanager.
I have triggered some alerts to see if it is working fine. For Slack and Emails, the generatorURL (A backlink which identifies the causing entity of the alert.1) is clickable and when clicked takes back to the Grafana Explore section which is the expected behaviour. However for Telegram, the generatorURL link is broken (The link is half clickable). The alertmanager uses default template to send the alerts to Telegram.
After some research, I found out that it is because of the url-encoding (i.e. The quotes, square brackets, etc. are not encoded). I don't know how to encode it manually. However I have tried two possible solutions:
Used parseMode as HTML and using anchor tag for the generatorURL - Didn't work.
Used reReplaceAll to replace the quotes, square brackets, etc. into url encoded form from this GitHub Discussion - Didn't work.
I tried the solution provided here, but I didn't get the source URL i.e. It was blank.
What did I achieve: It didn't generate the URL. I mean the telegram message was blank.
What was expected: A fully clickable source URL.
Screenshots have been attached.
Implemented GitHub solution for GeneratorURL
Result
Any suggestions on what can be done to resolve this issue?

Related

Facebook shares not using og:url when clicked in Facebook?

One of the purposes of og:url -- I thought -- was that it was a way you could make sure sessions variables, or any other personal information that might find its way into a URL, would not be passed along by sharing in places like Facebook. According to the best practices on Facebook's developer pages: "URL
A URL with no session id or extraneous parameters. All shares on Facebook will use this as the identifying URL for this article."
(under good examples: developers.facebook.com/docs/sharing/best-practices)
This does NOT appear to be working, and I am puzzled as to either -- how I misunderstood, and/or what I have wrong in my code. Here's an example:
https://vault.sierraclub.org/fb/test.html?name=adrian
When I drop things into the debugger, it seems to be working fine...
https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fvault.sierraclub.org%2Ffb%2Ftest.html%3Fname%3Dadrian
og:url reads as expected (without name=adrian).
But if I share this on facebook -- and then click the link. The URL goes to the one with name=adrian in it, not the og:url.
Am I doing something incorrectly here, or have I misunderstood? If the latter, how does one keep things like sessions variables out of shares?
Thanks for any insight.
UPDATE
Facebook replied to a bug report on this, and I learned that I indeed was reading the documentation incorrectly
developers.facebook.com/bugs/178234669405574/
The question then remains -- is there any other method to keeping sessions variables/authentication tokens out of shares?

Getting the download url of a video from a site

I'm trying to build a web scraper which downloads videos from "fmovies.se".
I was not able to fully extract the video url given the webpage.
The webpage I'm considering is "https://fmovies.se/film/la-cage-doree.5283j".
Two queries are required to retrieve the video url.
The initial one is 'https://fmovies.se/ajax/episode/info?ts=1483027200&=2399&id=9076jn&update=0'.
The query is composed of "ts", "_", "id" and "update" elements. Everything except "_" part was mentioned in html code of the webpage.
I couldn't get from where "_2399" part was coming.
Can anyone help me with this ?
Even if you figure out how those parameters are computed, they can change their algorithm at any moment, which this site specifically has done in the past, see this thread.
You need a long lasting solution — a headless browser.
You can use a headless browser to simulate user interactions programmatically and intercept the XHR request that you are looking for (e.g. https://fmovies.se/ajax/episode/info?ts=1483027200&=2399&id=9076jn&update=0).
One of the best headless browsers out there is Puppeteer and there's a lot of information on how to use it.

Google Adword not working /conversion.js not found

I'm currently working on a wordpress site. My task is just to add the conversion script in a thankyou page. I added the script here: http://www.livingedge.co.nz/thanks-for-getting-in-touch/ , unfortunately does not work. It says that a conversion.js was not found.
See the attached screenshot: http://screencast.com/t/52ixQUzHKNxZ
I added the conversion script on the footer put it in a conditional so that it will load only on the thakyoupage.
I'm new to this and can't figure out what would be the possible cause of such problem.
I tried adding the script in the header, on the page editor, on a form redirect.
Q: What could be the possible cause of this issue?
The URL you are using for the conversion script is incorrect — the correct one has "www" in the domain name.
The fact that you've got this link wrong makes me think you may be looking at incorrect directions.
Follow the instructions given in the Google documentation page "Setting up conversion tracking" precisely.

OAuth 2.0 REDIRECT URI

my UpdraftPlus Backup/Restore was working and backing up to Google drive.
But now the REDIRECT URI has changed on the Google Cloud Console Side.
it should end with
/options-general.php?page=updraftplus&action=updraftmethod-googledrive-auth
however it keeps truncating after the Ampersand and shows up like
/options-general.php?page=updraftplus
any help on how to set the right URI?
I also faced the same problem yesterday. It looks like a bug of Google Cloud Console to me. I managed to solve this by using "percent-encoding" in the URL for the ampersand symbol. Ampersand symbol shall be encoded as %26. So you shall enter your url the following way:
/options-general.php?page=updraftplus%26action=updraftmethod-googledrive-auth
Another option you could try (but I don't think it will be necessary) is to swith back to the old view. It looks like that in the old interface there is no problem with ampersand. The link to the old interface is at the left bottom corner (it is quite hard to find it).
By the way I've also described this solution here (but it is in Russian :)
In the latest UpdraftPlus release, we worked around this by only having one parameter in the URL!
Best wishes,
David

Pinterest button - invalid url

Since yesterday when Pinterest updated its website, my Pinterest 'Pin it' buttons stopped functioning properly, i.e. the spinning wheel goes forever in the popup window.
My code - which used to work fine - is:
<a data-pin-config="beside" href="//pinterest.com/pin/create/button/?url=<?=urlencode($url)?>&media=<?=urlencode($image_url) ?>&description=The picture I just pinned!" data-pin-do="buttonPin" >
<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />
</a>
I also include the Pinterest js just before the </body> closing tag.
What is interesting is that when I go on Pinterest's website and try to Add Pin by URL, I get:
"Whoops! Invalid URL"
My $url refers to php pages which pass several parameters, i.e.
http://www.mywebsite.com/img.php?img_id=photo (999).jpg&album=...&page=...
Update #1: I noticed that when the posted URL does not contain any parentheses, there is no problem posting on Pinterest directly or via the buttons. Although the URLs are all urlencoded in php, i.e. the ( and ) are encoded to %28 and %29 respectively, which should be taking care of the parentheses, it does not seem to work. The browser still shows the parentheses although I realize that it is interpreting the url encoded %28 and %29 codes.
Update #2: Received reply from Pinterest saying
"Sometimes we see this behavior if a website is blocking Amazon IPs.
Make sure you're not blocking Amazon IPs or whitelist our user agent:
Pinterest/0.1 +http://pinterest.com/
Unfortunately, we don't have a dedicated group of IPs that you could whitelist because our IPs change over time."
Following Pinterest's reply, I did my research and came up with the following relevant links:
http://wordpress.org/support/topic/note-when-entering-user-agent-whitelist
"Pinterest have to be whitelisted as a referrer or agent so that it will see the image - if not it will just see the redirect to a HTML page (thus "not a valid image").
Try to put pinterest and pinterest.com on your user agent whitelist"
Questions:
Has this worked for anyone?
What's the best way to modify .htaccess or robots.txt to accomplish that?
I am facing the same issue with Tumblr as well. I have verified that w/o the parentheses, the share it button works fine. If nothing else works, should I remove all the parentheses from the URIs?
Problem solved!
It was not the parentheses that were causing the failure to pin (or share on Tumblr), but the spaces in the URL (in my case the space before the parenthesis). Although the spaces were URL encoded (+), Pinterest was viewing it as an invalid URL.
I removed all spaces from the picture file names, which means also from the URL since the URL passes as a parameter the picture filename.
This fixed the issues for both the Pinterest and Tumblr buttons.

Resources