Imgur to Rimgo Redirect

Redirect Imgur URLs to a Rimgo instance for privacy-friendly viewing. Handles SEO-style imgur URLs too.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Imgur to Rimgo Redirect
// @namespace    none
// @version      1.1
// @description  Redirect Imgur URLs to a Rimgo instance for privacy-friendly viewing. Handles SEO-style imgur URLs too.
// @author       OfficialJesseP
// @match        https://imgur.com/*
// @match        https://i.imgur.com/*
// @match        https://imgur.io/*
// @match        https://*.imgur.io/*
// @exclude      https://imgur.com/user/*
// @exclude      https://imgur.com/signin
// @exclude      https://imgur.com/register
// @exclude      https://imgur.com/arcade
// @exclude      https://imgur.com/upload
// @exclude      https://imgur.com/meme-generator
// @exclude      https://imgur.com/privacy
// @exclude      https://imgur.com/rules
// @exclude      https://imgur.com/emerald
// @exclude      https://imgur.com/ccpa
// @exclude      https://imgur.com/tos
// @exclude      https://imgur.com/about
// @exclude      https://imgur.com/apps
// @run-at       document-start
// @grant        none
// @license         MIT
// ==/UserScript==

(function () {
    'use strict';

    const rimgoInstance = 'https://rimgo.us.projectsegfau.lt';
    const url = new URL(window.location.href);
    let path = url.pathname;

    // Check for SEO-style album or gallery URLs
    const matchSeoURL = path.match(/^\/(a|gallery)\/(?:[a-zA-Z0-9\-]+-)?([a-zA-Z0-9]{5,7})$/);
    if (matchSeoURL) {
        // e.g., "/a/downloading-game-gBLJO" → extract group(1)="a", group(2)="gBLJO"
        const type = matchSeoURL[1]; // 'a' or 'gallery'
        const id = matchSeoURL[2];   // Actual ID (usually 5–7 characters)
        path = `/${type}/${id}`;
    }

    // Rebuild Rimgo URL and redirect
    const newUrl = rimgoInstance + path + url.search + url.hash;

    if (window.location.href !== newUrl) {
        window.location.replace(newUrl);
    }
})();