如何禁用glimpse更新检查请求?

时间:2022-12-22 17:23:15

I have noticed that glimpse checks whether there are any update on clientside via https://getglimpse.com/Api/Version/Check?Glimpse.Ado=1.7.3&Glimpse.AspNet=1.9.2&Glimpse=1.8.6&Glimpse.EF6=1.6.5&Glimpse.Mvc5=1.5.3&stamp=1450129430335&callback=glimpse.versionCheck.result .

我注意到一瞥通过https://getglimpse.com/Api/Version/Check?Glimpse.Ado=1.7.3&Glimpse.AspNet=1.9.2&Glimpse=1.8.6&Glimpse.EF6=1.6检查客户端是否有任何更新。 5&Glimpse.Mvc5 = 1.5.3&stamp = 1450129430335&callback = glimpse.versionCheck.result。

http://prntscr.com/9edgdy

Also request couldnt be completed since link's certificate is not valid,

由于链接证书无效,请求也无法完成,

How can I disable it?

我该如何禁用它?

2 个解决方案

#1


1  

Changing config with different or loopback address for Url won't stop the Glimpse to make request version check request. I found that the version check is triggered from client side function versionCheck.

使用Url的不同或环回地址更改配置不会阻止Glimpse发出请求版本检查请求。我发现版本检查是从客户端函数versionCheck触发的。

Here's a hot-fix I figured out how to disable the function versionCheck on glimpse object:

这是一个热门修复我想出了如何在glimpse对象上禁用函数versionCheck:

document.addEventListener("DOMContentLoaded", function () {
    // A wierd fix to wait until glimpse is initialized.
    setTimeout(turnoffGlimpseVersionCheck, 100);
});

function turnoffGlimpseVersionCheck() {

    if (typeof glimpse == 'undefined') {
        console.log("glimpse not found!")
    }
    else {
        console.log(glimpse.settings);
        glimpse.versionCheck = function () { };
        console.log("glimpse updates turned off!!")
    }
}

It might not look good but it will just do the trick.

它可能看起来不太好,但它只会做到这一点。

Update

Here's a updated and better version:

这是一个更新和更好的版本:

<script>

    document.addEventListener("DOMContentLoaded", function () {
        var scripts = document.getElementsByTagName("script");
        var isGlimpseLoaded = false;
        for (var i = 0; i < scripts.length; ++i) {
            var src = scripts[i].getAttribute('src');
            if (src == null) continue;
            if (src.indexOf('Glimpse.axd') > -1) {
                turnoffGlimpseVersionCheck();
                break;
            }
        }

    });

    function turnoffGlimpseVersionCheck() {
        glimpse.versionCheck = function () { };
        console.log('glimpse version check disabled!!')
    }

</script>

#2


1  

Set <add key="GlimpseVersionCheckAPIDomain" value="240.0.0.1" /> in <appSettings> of your Web.config.

在Web.config的 中设置

This reconfigures any call that would have otherwise gone to getglimpse.com into a black hole instead. I tested this and confirmed zero phone-home attempts, and much quicker page loads now.

这会重新配置任何本来会使getglimpse.com进入黑洞的调用。我对此进行了测试,并确认零电话回家尝试,现在页面加载速度更快。

Relevant code is in: Glimpse.Core/Resource/VersionCheckResource.cs

相关代码位于:Glimpse.Core / Resource / VersionCheckResource.cs

var domain = ConfigurationManager.AppSettings["GlimpseVersionCheckAPIDomain"];

        if (string.IsNullOrEmpty(domain))
        {
            domain = "getGlimpse.com";
        }

        return new CacheControlDecorator(OneDay, CacheSetting.Public, new RedirectResourceResult(@"//" + domain + "/Api/Version/Check{?packages*}{&stamp}{&callback}", data));

#1


1  

Changing config with different or loopback address for Url won't stop the Glimpse to make request version check request. I found that the version check is triggered from client side function versionCheck.

使用Url的不同或环回地址更改配置不会阻止Glimpse发出请求版本检查请求。我发现版本检查是从客户端函数versionCheck触发的。

Here's a hot-fix I figured out how to disable the function versionCheck on glimpse object:

这是一个热门修复我想出了如何在glimpse对象上禁用函数versionCheck:

document.addEventListener("DOMContentLoaded", function () {
    // A wierd fix to wait until glimpse is initialized.
    setTimeout(turnoffGlimpseVersionCheck, 100);
});

function turnoffGlimpseVersionCheck() {

    if (typeof glimpse == 'undefined') {
        console.log("glimpse not found!")
    }
    else {
        console.log(glimpse.settings);
        glimpse.versionCheck = function () { };
        console.log("glimpse updates turned off!!")
    }
}

It might not look good but it will just do the trick.

它可能看起来不太好,但它只会做到这一点。

Update

Here's a updated and better version:

这是一个更新和更好的版本:

<script>

    document.addEventListener("DOMContentLoaded", function () {
        var scripts = document.getElementsByTagName("script");
        var isGlimpseLoaded = false;
        for (var i = 0; i < scripts.length; ++i) {
            var src = scripts[i].getAttribute('src');
            if (src == null) continue;
            if (src.indexOf('Glimpse.axd') > -1) {
                turnoffGlimpseVersionCheck();
                break;
            }
        }

    });

    function turnoffGlimpseVersionCheck() {
        glimpse.versionCheck = function () { };
        console.log('glimpse version check disabled!!')
    }

</script>

#2


1  

Set <add key="GlimpseVersionCheckAPIDomain" value="240.0.0.1" /> in <appSettings> of your Web.config.

在Web.config的 中设置

This reconfigures any call that would have otherwise gone to getglimpse.com into a black hole instead. I tested this and confirmed zero phone-home attempts, and much quicker page loads now.

这会重新配置任何本来会使getglimpse.com进入黑洞的调用。我对此进行了测试,并确认零电话回家尝试,现在页面加载速度更快。

Relevant code is in: Glimpse.Core/Resource/VersionCheckResource.cs

相关代码位于:Glimpse.Core / Resource / VersionCheckResource.cs

var domain = ConfigurationManager.AppSettings["GlimpseVersionCheckAPIDomain"];

        if (string.IsNullOrEmpty(domain))
        {
            domain = "getGlimpse.com";
        }

        return new CacheControlDecorator(OneDay, CacheSetting.Public, new RedirectResourceResult(@"//" + domain + "/Api/Version/Check{?packages*}{&stamp}{&callback}", data));