Skip to content
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

ksria.com 前端循环重定向 #6897

Open
ttimasdf opened this issue Jan 13, 2025 · 2 comments
Open

ksria.com 前端循环重定向 #6897

ttimasdf opened this issue Jan 13, 2025 · 2 comments
Labels

Comments

@ttimasdf
Copy link

描述这个错误

https://ksria.com/simpread/ 及其所有子页面中,包含了一段错误的代码导致页面频繁刷新。

由于现代浏览器默认访问 HTTPS 而非 HTTP,所以下面这段代码没有正确替换域名,导致重复跳转到当前页面。

    function v() {
        "ksria.com" == location.hostname && !function() {
            var a = location.href.replace("http://ksria.com/simpread", "https://simpread.pro");
            $(".top").addClass("bottom"),
            $("body").append('<div class="simpreadpro">嗨 👋 请访问&nbsp;👉&nbsp;<a target="_blank" href="' + a + '"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="15"><path d="M-664.554667 249.408" fill="#195bf7" p-id="4256"></path><path d="M-664.554667 249.408" p-id="4257" fill="#195bf7"></path><path d="M829.781333 960l-211.861333 0c-12.074667 0-21.866667-9.770667-21.866667-21.866667L596.053333 642.218667l-168.128 0 0 295.936c0 12.074667-9.770667 21.866667-21.866667 21.866667L194.218667 960.021333c-55.168 0-74.816-38.656-74.816-74.816L119.402667 589.248 52.693333 589.248c-21.482667 0-35.285333-6.933333-41.088-20.629333-8.64-20.394667 7.317333-40.661333 22.208-56.064L459.050667 86.912C472.448 73.024 491.029333 64.789333 511.146667 64c21.866667 0.789333 40.469333 9.024 54.122667 23.210667L989.866667 512.277333c15.146667 15.68 31.168 35.968 22.549333 56.362667-5.802667 13.674667-19.648 20.629333-41.109333 20.629333l-66.688 0 0 295.936C904.618667 921.344 884.949333 960 829.781333 960z" fill="#195bf7"></path></svg>&nbsp;速度更快的官网</a> <span class="countdown">5</span> 秒中后自动跳转</div>'),
            setInterval(function() {
                var n = $(".simpreadpro").find(".countdown").text();
                "1" == n ? location.href = a : $(".simpreadpro").find(".countdown").text(parseInt(n) - 1)
            }, 1e3)
        }()
    }

复现步骤

  1. 访问 https://ksria.com/simpread/ (非 HTTP)
  2. 忽略 SSL 证书告警。
  3. 页面一直在当前页面刷新

其他相关说明

No response

操作系统

Windows

浏览器

Microsoft Edge

发生问题的网址

https://ksria.com/simpread/

@ttimasdf
Copy link
Author

workaround:

// ==UserScript==
// @name         Redirect ksira.com to Simpread Pro
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Redirects traffic from ksria.com/simpread/xxx to simpread.pro/xxx
// @author       KnownRabbit
// @match        *://ksria.com/simpread/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    if (window.location.href.includes('ksria.com/simpread')) {
        // Construct the new URL by replacing "ksria" with "simpread.pro"
        const newURL = window.location.href.replace("ksria.com/simpread", 'simpread.pro');
        console.log(`Redirecting to ${newURL}`);

        // Redirect to the new URL
        window.location.href = newURL;
    }
})();

@Kenshin
Copy link
Owner

Kenshin commented Jan 13, 2025

okay 😂

我目前在休假,先 Mark 下,等我回去后处理。

@Kenshin Kenshin added the to do label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants