您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically change AWS region to us-east-1 if the URL has region=us-east-2 in query params or hostname
// ==UserScript== // @name AWS Region Changer // @namespace https://gf.qytechs.cn/users/77886 // @version 0.1 // @description Automatically change AWS region to us-east-1 if the URL has region=us-east-2 in query params or hostname // @author muchtall // @match https://console.aws.amazon.com/* // @match https://*.console.aws.amazon.com/* // @license GNU GPL-3 // @grant none // ==/UserScript== (function() { 'use strict'; const url = new URL(window.location.href); const hostnameParts = url.hostname.split('.'); // Check if it's an AWS session URL (e.g., ends with .console.aws.amazon.com) if (hostnameParts.length >= 5 && hostnameParts[hostnameParts.length - 4] === 'console' && hostnameParts[hostnameParts.length - 3] === 'aws' && hostnameParts[hostnameParts.length - 2] === 'amazon' && hostnameParts[hostnameParts.length - 1] === 'com') { const potentialRegionIndex = hostnameParts.length - 5; // Index of the region (e.g., before 'console') if (potentialRegionIndex >= 0) { const region = hostnameParts[potentialRegionIndex]; if (region === 'us-east-2') { // Replace the region in the hostname hostnameParts[potentialRegionIndex] = 'us-east-1'; const newHostname = hostnameParts.join('.'); url.hostname = newHostname; // Update the hostname window.location.href = url.href; // Redirect to the new URL return; // Exit after redirect } } } // If not a session URL or region not us-east-2, check query parameters const urlParams = new URLSearchParams(url.search); if (urlParams.get('region') === 'us-east-2') { urlParams.set('region', 'us-east-1'); url.search = urlParams.toString(); // Update the query string window.location.href = url.href; // Redirect to the new URL } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址