I'm using an Edge browser and are having browser recognition problems - microsoft-edge

I added a meta tag to the web page:
<meta http-equiv="Accept-CH" content="UA, UA-Platform, UA-Arch, UA-Model, UA-Mobile, UA-Full-Version">
But the results are as follows:
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"
What's the reason why "Edge" is missing in the brand name?

Related

Is there a way to set up electron-builder auto-updater to check for updates from Google Cloud Storage?

I would like to use the autoUpdater from electron-builder to update my apps. I'm not using Github Releases because I have a private repo and don't want to include the GH_TOKEN for security purposes. Instead I want to put the binaries and the latest.yml/latest-mac.yml files into a Google Storage Bucket.
I know that it is possible to use a generic provider to check for updates. But currently, I can't get electron-builder to even read the latest.yml. I've poured over the documentation and other github/stack overflow issues for hours and hours and haven't found anything to resolve this.
Here's the code I have in my main.js for electron/auto updater to set a new feed URL -
const data = {
provider: 'generic',
url: 'https://storage.cloud.google.com/my-project', //'my-project' is the name of the bucket
channel: 'latest',
};
autoUpdater.setFeedURL(data);
autoUpdater.autoDownload = false;
autoUpdater.checkForUpdates();
The built app plus the yml files are in that bucket. When I try to run my app, I get a huge error that basically just copies over the Google Cloud Storage HTML/CSS instead of reading and processing the latest.yml file...
Error: Error: Cannot parse update info from latest-mac.yml in the latest release artifacts (https://storage.cloud.google.com/my-project/latest-mac.yml?noCache=1dh4pdr5e): YAMLException: end of the stream or a document separator is expected at line 11, column 14:
font-family: 'Open Sans';
^
at generateError (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
at throwError (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
at readDocument (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1539:5)
at loadDocuments (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1575:5)
at load (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1596:19)
at safeLoad (/Users/somelocation/documents/some-project/node_modules/js-yaml/lib/js-yaml/loader.js:1618:10)
at parseUpdateInfo (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/providers/Provider.js:131:37)
at GenericProvider.getLatestVersion (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/providers/GenericProvider.js:57:48)
at processTicksAndRejections (internal/process/task_queues.js:86:5)
at async MacUpdater.getUpdateInfoAndProvider (/Users/somelocation/documents/some-project/node_modules/electron-updater/out/AppUpdater.js:488:13), rawData:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=300, initial-scale=1" name="viewport">
<meta name="google-site-verification" content="LrdTUW9psUAMbh4Ia074-BPEVmcpBxF6Gwf0MSgQXZs">
<title>Sign in - Google Accounts</title>
Is it possible at all to read the files from a Google Cloud Storage bucket rather than S3 or Github? Also, I've already tried eliminating an extra lines or tabs from the yml file.
You should use GCP API instead of a browser URL.
This code worked for me:
"publish": {
"provider": "generic",
"url": "https://storage.googleapis.com/YOUR_BUCKET/"
}
https://cloud.google.com/storage/docs/json_api/v1 also can be used, but it requires OAuth
try to execute this code after the app 'ready' event.
app.on('ready', () => {
const feedURL = 'https://storage.cloud.google.com/my-project';
autoUpdater.setFeedURL(feedURL);
autoUpdater.checkForUpdates();
});

How to get data for channel url without id or username?

I just stumbled upon YouTube url https://www.youtube.com/u2. It leads to a channel page. When I click on a video of the channel and then on the video's channel link, I get back to the same page, but with the url https://www.youtube.com/channel/UC4gPNusMDwx2Xm-YI35AkCA.
But how can I go from https://www.youtube.com/u2 to https://www.youtube.com/channel/UC4gPNusMDwx2Xm-YI35AkCA using the YouTube Data API? The API reference for channel does not document a way to do this. I can do a search for u2 with type channel, and that will give me the channel id, but it will also give me other channel ids. And for a channel, there seems to be no data that lists https://www.youtube.com/u2 as an alternative url.
If there's no way to get the channel ID via the API (which I don't know for sure), what should work is downloading the site (etc. using curl or your programming languages's prefered way of making HTTP requests) and parsing it. The link to the actual channel page is contained a couple of times in the HTML source (in the <head>), as you can see from this excerpt:
<link rel="canonical" href="https://www.youtube.com/channel/UC4gPNusMDwx2Xm-YI35AkCA">
<meta property="og:site_name" content="YouTube">
<meta property="og:url" content="https://www.youtube.com/channel/UC4gPNusMDwx2Xm-YI35AkCA">
<meta property="og:title" content="U2">
<meta property="og:description" content="Rock band from Dublin, Ireland. Adam Clayton on Bass. The Edge on Guitar. Larry Mullen Jr on Drums. Bono on Vocals. http://www.u2.com">
Even if you don't want to fully parse the site and extract the header information, a regex search with <link rel="canonical" href="https:\/\/www\.youtube\.com\/channel\/(.+)"> might do the trick, but be advised this is not guaranteed to work 100%.
I don't know whether I did not find it when I posted the question or whether it is new, but now the YouTube data API has snippet.customUrl for channels, which is "u2" in the given example. So you can do this:
// Kotlin
fun getChannelById(id: String): Channel? =
youTube.channels().list("id, snippet")
.setKey(apiKey)
.setId(id)
.execute()
.items
?.single()
private fun getChannelByCustomUrl(customUrl: String): Channel? =
youTube.search().list("id, snippet")
.setKey(apiKey)
.setType("channel")
.setQ(customUrl)
// .setMaxResults(5) // The default value 5 should suffice.
.execute()
.items
?.asSequence()
?.mapNotNull {
// Can be null when channel has been deleted just after search().
this.getChannelById(it.snippet.channelId)
}
?.firstOrNull { it.snippet.customUrl == customUrl }

How to get Twitter to recognize Angular7 meta tags in a sub page served by a route

I want my Angular7 code to take a URL that contains a route and present desired updated meta tags to Twitter so that Twitter will render the correct social card.
Following standard practices for meta tags, which includes declaring in index.html header and updating in constructors of pages loaded by routes, I can see the correct updated values in the browser console, but twitter ignores those updates and uses the first meta tags from index.html.
From index.html...
<head>
<title>My Title</title>
<!-- Other Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="#myAccountName">
<meta name="twitter:title" content="My Title">
<meta name="twitter:description" content="A detailed description of the site">
<meta name="twitter:image" content="https://www.oursite.com/welcome.png">
From app.module.ts…
import { mySubComponent } from './components/mySub/mySub.component';
...
const appRoutes: Routes = [
...
{ path: 'mySubPage', component: mySubComponent },
...
From the .ts file for the module loaded by www.oursite.com/mySubPage...
import { Router, ActivatedRoute, Params } from '#angular/router';
import { Meta, Title } from '#angular/platform-browser';
#Component({
selector: 'app-mySub',
templateUrl: './mySub.component.html',
styleUrls: ['./mySub.component.css']
})
export class mySubComponent implements OnInit {
...
constructor(
...
public meta: Meta, public title: Title) {
meta.updateTag({ name: 'twitter:card', content: 'summary_large_image' });
meta.updateTag({ name: 'twitter:site', content: '#myAccountName});
meta.updateTag({ name: 'twitter:title', content: 'My Sub Title' });
meta.updateTag({ name: 'twitter:description', content: 'The descript of the sub page' });
meta.updateTag({ name: 'twitter:image', content: 'https://www.oursite.com/mySubPageLogo.png' });
}
When I run this in the browser and manually type the full URL with the route (www.oursite.com/mySubPage, the console Inspector shows all the correct settings...
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="#myAccountName">
<meta name="twitter:title" content="My Sub Title">
<meta name="twitter:description" content="The descript of the sub page">
<meta name="twitter:image" content="https://https://www.oursite.com/mySubPageLogo.png">
But the twitter card validator set to the exact same Sub URL shows the card from the main index.html and appears to ignore the updates from the route altogether.
By the way, I did attempt all steps to flush the twitter cache, and even waited for longer than 12 hours and tried again. But I can make an update to the main tags and the change shows up, so it's not a cache issue with twitter.
This following is from https://twittercommunity.com/t/not-whitelisted-unable-to-render-or-no-image-read-this-first/62736 It looks like unless someone knows of a different approach, they are basically saying we can't serve up different cards from different angular routes from the same app domain. You only get one. Notice they spell it out in the middle...
Before posting a Cards issue, please READ the following:
If you are posting about any issue with your site, please include a
link to the publically-accessible URL where your Card markup is
visible, or we will be unable to help you.
You should also make sure that you’ve checked the items below, and
perform your own troubleshooting before asking for additional help.
Posts that indicate that none of these checks have been performed will
not be prioritised for attention.
As of early 2018, cards no longer require whitelisting (including
player cards)
The not whitelisted error message from the Validator is misleading, and almost certainly means that the tool cannot see or
find any twitter:card markup in your page.
If you see a message saying that you need to submit your card for approval, you’ve probably specified an incorrect card type in the
markup.
Please review the following if you are having other issues:
when you view the source of your page, the expected Twitter Cards meta tags 581 are shown
NB at a minimum, your page must contain at least a twitter:card meta tag specifying a valid card type 370, or suitable OpenGraph
fallback tags 170.
if you execute curl -v -A Twitterbot at the command prompt, does your page still show the twitter:card tags in the section
of the page? Does your server return a 200 response code and a valid
Content-Type header?
is your page adding the tags after it is loaded, for instance using Javascript (e.g. Angular, Meteor, Google Tags Manager)? The
crawler and validator cannot execute Javascript and the tags must be
static.
is your site accessible by the Twitterbot/1.0 user-agent? Are all the files (including image files) accessible to Twitterbot? you should
check http://your-site-url/robots.txt 646 and ensure that it allows
access to our crawler. If your images are on a different domain, also
make sure you check the robots.txt file for that domain.
are you using a Wordpress (or other CMS/blogging platform) plugin? We provide our own official Wordpress plugin 614, but cannot easily
provide support for those built by third parties. Check that the
configuration includes all of the required tags. Avoid using multiple
plugins at the same time, as tags will override one another.
are you putting the top-level site URL into the Validator, or the specific URL where your markup is present? you’ll need to make sure
that you provide a link to where your Card markup is visible in the
page.
are you using a supported 370 Card type? Product, Gallery and Photo cards were deprecated in mid-2015 128. Is the card type spelled
correctly, or is there a typo?
if your image is not showing, is it accessible on a URL that is not blocked by your robots.txt file? Does it conform to our size
constraints? Are you using an absolute and full URL (including the
http protocol piece), not a relative one?
if you see a validator message about Fetching the page failed because other errors or similar, check your SSL configuration. The
certificate and server name must match (or be aliased to match) due to
Java security constraints. More in this thread 220.
are you using a fully qualified DNS domain name? The crawler does not support dotted IP addresses as domain references, and cannot
access localhost.
There is much more Troubleshooting 302 information on our Developer
site.
Looks like there's no work-around for Angular7 at this time. Apparently there can be only one card, served up statically from on index.html per angular domain name.
Are you using a firebase as a BaaS? If so I was able to get twitter to render cards by doing exactly what you were doing above(setting up a service or inserting Meta tags into components). this lesson helped me out https://fireship.io/lessons/angular-universal-firebase/ , but base on my issue besides it having anything to do with being firebase app, my universal would not serve into the browser under app-root. I did not have to render any meta tags in my default index.html. Check the tutorial above and see if that helps out your issue at all.
https://angular.io/guide/universal
// Sub-Component
import { Component, OnInit } from '#angular/core';
import { Title, Meta } from '#angular/platform-browser';
#Component({
selector: 'app-about',
templateUrl: './about.component.html',
styleUrls: ['./about.component.scss']
})
export class AboutComponent implements OnInit {
data = {
name: 'Michael Jordan',
bio: 'Former baseball player',
image: ''
};
constructor(private title: Title, private meta: Meta) {}
ngOnInit() {
this.title.setTitle(this.data.name);
this.meta.addTags([
{ name: 'twitter:card', content: 'summary' },
{ name: 'og:url', content: '/about' },
{ name: 'og:title', content: this.data.name },
{ name: 'og:description', content: this.data.bio },
{ name: 'og:image', content: this.data.image }
]);
}
}

eBay oauth token flow on small screen i.e. smartphone

I've been struggling for couple of days with eBay token authentication on smartphones. I am able to register customer tokens on desktop systems, tablets and hires smartphones. On the android app there is a intent listener to get the reply and register the token within the app.
But on some devices, the following message occurs within registration flow trough ebay:
This can not be done on a small screen. Please try again with a desktop computer.
eBay customer support told me, that it is not possible to use the registration on apps. But i don't understand this, because the registration window for the token registration flow is matching even on small devices!
Any idea to solve this? Eventually to simulate a higher resolution / meta information for the web-view so the message wouldn't generated from the eBay server?
Thank you very much for any idea.
I had to zoom out the browser window
https://stackoverflow.com/a/4322209/1849478
also needed to set the UserAgent of the Webview like this:
String agent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/20100101 Firefox/4.1";
mWebView.getSettings().setUserAgentString(agent);
Try to set the browser size with javascript.
<html>
<head>
<script>
window.alert("Window resolution before overwrite is " + window.screen.availWidth + " x " + window.screen.availHeight);
Object.defineProperty(window.screen, "availWidth", { get: function(){return 0; }});
Object.defineProperty(window.screen, "availHeight", { get: function(){return 0; }});
</script>
</head>
<body>
<script>
window.alert("Window resolution after overwrite is " + window.screen.availWidth + " x " + window.screen.availHeight);
</script>
</body>
</html>
Here is another way

Share on LinkedIn with og

I have rails app. I added og tags for Facebook, google +, and Vkontakte. And I need to add possibility to share to LinkedIn too. But I don't understand why LinkedIn don't pick my OG tags.
My html:
= tag :meta, property: 'og:url', content: 'https://myapp.com/app'
= tag :meta, property: 'og:title', content: 'MyApp'
= tag :meta, property: 'og:description', content: 'You can always find a my app !'
= tag :meta, property: 'og:image', content: "https://myapp.com#{image_path('backgrounds/desk.jpg')}"
And facebook, g+, vk works perfectly, but linked in don't fetch any information from my website.
Any advise?
I had the same problem: everything worked except for LinkedIn on our https-only website. The problem was that ServerName and ServerAlias were not set in the Apache config file (default-ssl in our case).
You can use the Twitter card validator to check your SSL-settings (https://cards-dev.twitter.com/validator), if this throws an error adjust your Apache config.
You find additional information here: SSL handshake alert: unrecognized_name error since upgrade to Java 1.7.0
and here: Making your site shareable on LinkedIn
Interesting! You made your post on March 10, 2017. Support for og: tags at LinkedIn was only officially added and released on March 23, 2017; the feature just 13 days away!
The following formats are now all supported...
<meta property='og:title' content='Title of the article"/>
<meta property='og:image' content='//media.example.com/ 1234567.jpg"/>
<meta property='og:description' content='Description that will show in the preview"/>
<meta property='og:url' content='//www.example.com/URL of the article" />
Source: Official LinkedIn Documentation: Making Your Website Shareable on LinkedIn.
Works great for me:
If you want to verify that you have the tags in place correctly in your <head> block of HTML, try testing the page you're sharing at LinkedIn Post Inspector.

Resources