portalHelper: Use a constant for the host name and URI
https://bugzilla.gnome.org/show_bug.cgi?id=769940
This commit is contained in:
parent
9ea8fdc1d1
commit
c4a07fad83
@ -20,6 +20,8 @@ const PortalHelperResult = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const INACTIVITY_TIMEOUT = 30000; //ms
|
const INACTIVITY_TIMEOUT = 30000; //ms
|
||||||
|
const CONNECTIVITY_CHECK_HOST = 'nmcheck.gnome.org';
|
||||||
|
const CONNECTIVITY_CHECK_URI = 'http://' + CONNECTIVITY_CHECK_HOST;
|
||||||
const CONNECTIVITY_RECHECK_RATELIMIT_TIMEOUT = 30 * GLib.USEC_PER_SEC;
|
const CONNECTIVITY_RECHECK_RATELIMIT_TIMEOUT = 30 * GLib.USEC_PER_SEC;
|
||||||
|
|
||||||
const HelperDBusInterface = '<node> \
|
const HelperDBusInterface = '<node> \
|
||||||
@ -50,7 +52,7 @@ const PortalWindow = new Lang.Class({
|
|||||||
this.parent({ application: application });
|
this.parent({ application: application });
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
url = 'http://nmcheck.gnome.org';
|
url = CONNECTIVITY_CHECK_URI;
|
||||||
this._originalUrlWasGnome = true;
|
this._originalUrlWasGnome = true;
|
||||||
} else {
|
} else {
|
||||||
this._originalUrlWasGnome = false;
|
this._originalUrlWasGnome = false;
|
||||||
@ -112,12 +114,12 @@ const PortalWindow = new Lang.Class({
|
|||||||
let uri = new Soup.URI(request.get_uri());
|
let uri = new Soup.URI(request.get_uri());
|
||||||
|
|
||||||
if (!uri.host_equal(this._uri) && this._originalUrlWasGnome) {
|
if (!uri.host_equal(this._uri) && this._originalUrlWasGnome) {
|
||||||
if (uri.get_host() == 'nmcheck.gnome.org' && this._everSeenRedirect) {
|
if (uri.get_host() == CONNECTIVITY_CHECK_HOST && this._everSeenRedirect) {
|
||||||
// Yay, we got to gnome!
|
// Yay, we got to gnome!
|
||||||
decision.ignore();
|
decision.ignore();
|
||||||
this._doneCallback(PortalHelperResult.COMPLETED);
|
this._doneCallback(PortalHelperResult.COMPLETED);
|
||||||
return true;
|
return true;
|
||||||
} else if (uri.get_host() != 'nmcheck.gnome.org') {
|
} else if (uri.get_host() != CONNECTIVITY_CHECK_HOST) {
|
||||||
this._everSeenRedirect = true;
|
this._everSeenRedirect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user