-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get build info from chrome.management API #113
Conversation
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
return "Beta"; | ||
} else if (chrome.runtime.id === "gighmmpiobklfepjocnamgkkbiglidom" || | ||
chrome.runtime.id === "aobdicepooefnbaeokijohmhjlleamfj") { | ||
if (!SAFARI && !FIREFOX) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of future browsers, could we not use a new CHROME
constant instead, as this would otherwise become a !SAFARI && !FIREFOX && !EDGE
just to check for CHROME || OPERA
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
var OPERA = navigator.userAgent.indexOf("OPR") > -1; | ||
var EDGE = navigator.userAgent.indexOf("Edge") > -1; | ||
var FIREFOX = navigator.userAgent.indexOf("Firefox") > -1; | ||
var CHROME = !OPERA && !EDGE && !FIREFOX && !SAFARI; // SAFARI is defined in port.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there really no reliable way of detecting if it's Chrome without just assuming it's the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpeckett This is the safest way, how to detect Chrome afaik.
…installed Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
@kpeckett Please take a look, and review. Thanks! |
callback("Developer"); | ||
} else { | ||
callback("Unsupported"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't handling potential future copies, which is what the original code was made for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpeckett You are right, I will add chrome.runtime.id
handling in the next commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpeckett Please review changes in the latest commit (handling potential future copies).
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still getting "Developer" showing when I change the manifest to give it the right extension ID for the stable version. Any ideas?
@@ -1491,16 +1498,17 @@ function getDebugInfo(callback) { | |||
return the_debug_info; | |||
} | |||
|
|||
if (!SAFARI) { | |||
if (!SAFARI && !EDGE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could simplify to !(SAFARI || EDGE) by De Morgan's Law. Might save a single CPU cycle? 😛
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
@kpeckett We are checking, how our extension was installed as well. So if you've added an exact ID of the extension to the manifest file and the extension was installed from an unpacked environment, CatBlock will still report that you are using a "Developer" version of the extension :) |
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
This fixes #105
@kpeckett Could you please test and verify? Thanks!