您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Select servers from different gamemodes and regions.
当前为
// ==UserScript== // @name ServerSelector // @namespace http://tampermonkey.net/ // @version 1.0.0 // @description Select servers from different gamemodes and regions. // @author Altanis + Bismuth // @match https://diep.io/ // @icon https://www.google.com/s2/favicons?domain=diep.io // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js // @license MIT // @grant none // ==/UserScript== (async function() { 'use strict'; const style = document.createElement('style'); style.type = 'text/css'; style.appendChild(document.createTextNode('.swal2-popup { font-family: Ubuntu }; .swal2-input { font-family: Ubuntu };')); document.head.appendChild(style); HTMLElement.prototype.focus = new Proxy(HTMLElement.prototype.focus, { apply: function(el, _this, args) { if (inSwal && _this == canvas) return true; if (inSwal && _this == document.getElementById('textInput')) return true; else return el.apply(_this, args) } }); const htme = HTMLElement.prototype; htme.blur = new Proxy(htme.blur, { apply: function(f, _this, args) { if (document.activeElement === _this) return; f.apply(_this, args); }, }); const GAMEMODES = ['ffa', 'teams', '4teams', 'maze']; const REGIONS = ['do-sfo', 'do-nyc', 'do-fra', 'do-sgp']; const SERVERS = { "do-sfo": {}, "do-nyc": {}, "do-fra": {}, "do-sgp": {}, }; const _SERVERS = []; const UI = { mode: null, region: null, } const ctx = window.canvas.getContext('2d'); let HTML = ''; let inSwal = false; let foundServers = false; let alerted = false; async function FindServers(region, mode, times) { const url = 'https://api-game.rivet.gg'; for (let i = 0; i < times; i++) { const opts = { method: 'POST', body: JSON.stringify({ game_modes: [mode], regions: [region] }) }; const resp = await fetch(`${url}/v1/matchmaker/lobbies/find`, opts); if ((resp.status === 429 || resp.status === 500) && !alerted) { for (let pair of resp.headers.entries()) { console.log(pair) } alert('Ratelimit reached! Fetching servers from your current IP will no longer be possible for at least 15 minutes.'); alerted = true } if (alerted) return; const body = await resp.json(); _SERVERS.push(body.lobby.lobby_id); if (!SERVERS[region][mode]) SERVERS[region][mode] = []; if (!SERVERS[region][mode].includes(body.lobby.lobby_id)) SERVERS[region][mode].push(body.lobby.lobby_id); } }; REGIONS.forEach(function(region) { GAMEMODES.forEach(function(gamemode) { FindServers(region, gamemode, 6); }); }); var _server = ''; window.WebSocket = new Proxy(window.WebSocket, { construct(Target, args) { args[0] = _server || args[0]; _server = args[0]; return Reflect.construct(Target, args); } }); document.addEventListener('keydown', async function(event) { if (event.code === 'KeyY' && event.altKey) { inSwal = true; HTML = ''; let { value: region } = await Swal.fire({ title: 'Enter the region.', text: `Regions: ${REGIONS.join(', ')}`, input: 'text', inputValidator: function(val) { if (!REGIONS.includes(val)) return 'Invalid region.'; }, }); if (!region) return; GAMEMODES.forEach(async function(g, ind) { HTML += `<br><br><b style="font-family:16px">${g === 'ffa' ? 'FFA' : `${g.charAt(0).toUpperCase()}${g.substring(1)}`}</b>: <br>`; let gServers = SERVERS[region][g.toUpperCase()] || SERVERS[region][g]; gServers.forEach(function(l, I) { HTML += `${l}<br>`; }); if (GAMEMODES.length === (ind + 1)) { let { value: LobbyID } = await Swal.fire({ title: 'Enter the Lobby ID.', input: 'text', html: HTML, }); if (!LobbyID) return; _server = `wss://${LobbyID}-80.lobby.${region}.hiss.io`; input.execute('lb_reconnect'); inSwal = false; } }); } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址