ignitetnt
Version:
IGNITE OS — Advanced proxy-enabled gaming platform with comprehensive filter bypass system
266 lines (216 loc) • 8.49 kB
JavaScript
import "./custom.js";
import "./proxy-utils.js";
const sitename = "Ignite OS";
const subtext = "FIND YOUR NEXT OBSESSION.";
const gameServerUrl = "https://gms.parcoil.com";
const gamesContainer = document.getElementById("gamesContainer");
const searchInput = document.getElementById("searchInput");
const titleElement = document.getElementById("title");
const subtitleElement = document.getElementById("subtitle");
// Proxy configuration
const PROXY_ENDPOINTS = [
'https://proxy1.ignite-os.workers.dev',
'https://proxy2.ignite-os.vercel.app/api/proxy',
'https://proxy3.ignite-os.netlify.app/.netlify/functions/proxy',
'https://cors-anywhere.herokuapp.com',
'https://api.allorigins.win/raw?url=',
'https://thingproxy.freeboard.io/fetch/'
];
// Backup game servers
const BACKUP_SERVERS = [
'https://gms.parcoil.com',
'https://games.cdn.parcoil.com',
'https://content.gameserver.net',
'https://assets.playzone.io'
];
let currentProxyIndex = 0;
let currentServerIndex = 0;
let proxyEncoder = null;
document.title = titleElement ? `${sitename} | Arcade` : `${sitename} | Now Playing`;
if (titleElement) titleElement.textContent = sitename;
if (subtitleElement) subtitleElement.textContent = subtext;
let gamesData = [];
// Initialize proxy system
async function initializeProxy() {
try {
// Initialize encoder
proxyEncoder = new ProxyEncoder();
// Register service worker
if ('serviceWorker' in navigator) {
const registration = await navigator.serviceWorker.register('./sw.js');
console.log('Service Worker registered:', registration);
// Wait for service worker to be ready
await navigator.serviceWorker.ready;
console.log('Service Worker is ready');
}
// Test proxy endpoints
await testProxyEndpoints();
} catch (error) {
console.warn('Proxy initialization failed:', error);
}
}
// Test proxy endpoints and find working ones
async function testProxyEndpoints() {
const testUrl = 'https://httpbin.org/status/200';
for (let i = 0; i < PROXY_ENDPOINTS.length; i++) {
try {
const proxyUrl = createProxyUrl(PROXY_ENDPOINTS[i], testUrl);
const response = await fetch(proxyUrl, {
method: 'HEAD',
signal: AbortSignal.timeout(3000)
});
if (response.ok) {
console.log(`Proxy ${i} is working:`, PROXY_ENDPOINTS[i]);
currentProxyIndex = i;
return;
}
} catch (error) {
console.warn(`Proxy ${i} failed:`, error);
}
}
}
// Create proxy URL with obfuscation
function createProxyUrl(proxyEndpoint, targetUrl) {
if (!proxyEncoder) {
proxyEncoder = new ProxyEncoder();
}
const encoded = proxyEncoder.xorEncode(targetUrl);
if (proxyEndpoint.includes('?url=')) {
return `${proxyEndpoint}${encodeURIComponent(targetUrl)}`;
} else if (proxyEndpoint.includes('allorigins.win')) {
return `${proxyEndpoint}${encodeURIComponent(targetUrl)}`;
} else if (proxyEndpoint.includes('thingproxy.freeboard.io')) {
return `${proxyEndpoint}${encodeURIComponent(targetUrl)}`;
} else {
return `${proxyEndpoint}?target=${encoded}&origin=${encodeURIComponent(location.origin)}&t=${Date.now()}`;
}
}
// Get working game server
function getWorkingServer() {
return BACKUP_SERVERS[currentServerIndex] || gameServerUrl;
}
// Rotate to next proxy endpoint
function rotateProxy() {
currentProxyIndex = (currentProxyIndex + 1) % PROXY_ENDPOINTS.length;
}
// Rotate to next server
function rotateServer() {
currentServerIndex = (currentServerIndex + 1) % BACKUP_SERVERS.length;
}
function displayFilteredGames(filteredGames) {
if (!gamesContainer) return;
gamesContainer.replaceChildren();
if (filteredGames.length === 0) {
const emptyState = document.createElement("div");
emptyState.className = "empty-state";
emptyState.innerHTML = "<strong>NO GAMES FOUND</strong><span>Try another search and keep the spark alive.</span>";
gamesContainer.appendChild(emptyState);
return;
}
filteredGames.forEach((game, index) => {
const gameLink = document.createElement("a");
gameLink.className = "game";
// Create obfuscated game URL
const gameUrl = `${getWorkingServer()}/${game.url}/`;
const encodedGameUrl = proxyEncoder ? proxyEncoder.xorEncode(gameUrl) : btoa(gameUrl);
gameLink.href = `play.html?g=${encodedGameUrl}&r=${Math.random().toString(36).substring(2)}`;
gameLink.setAttribute("aria-label", `Play ${game.name}`);
gameLink.style.setProperty("--card-delay", `${Math.min(index, 18) * 35}ms`);
const gameImage = document.createElement("img");
// Use proxy for game images
const imageUrl = `${getWorkingServer()}/${game.url}/${game.image}`;
if (PROXY_ENDPOINTS[currentProxyIndex]) {
gameImage.src = createProxyUrl(PROXY_ENDPOINTS[currentProxyIndex], imageUrl);
} else {
gameImage.src = imageUrl;
}
gameImage.alt = "";
gameImage.loading = "lazy";
gameImage.decoding = "async";
// Add error handling for images
gameImage.onerror = function() {
// Try next server
rotateServer();
const fallbackImageUrl = `${getWorkingServer()}/${game.url}/${game.image}`;
if (PROXY_ENDPOINTS[currentProxyIndex]) {
this.src = createProxyUrl(PROXY_ENDPOINTS[currentProxyIndex], fallbackImageUrl);
} else {
this.src = fallbackImageUrl;
}
};
const gameName = document.createElement("span");
gameName.className = "game-name";
gameName.textContent = game.name;
const playLabel = document.createElement("span");
playLabel.className = "game-play";
playLabel.textContent = "PLAY";
gameLink.append(gameImage, gameName, playLabel);
gamesContainer.appendChild(gameLink);
});
}
function updateSearchResults() {
if (!searchInput) return;
const query = searchInput.value.trim().toLowerCase();
const filteredGames = gamesData.filter((game) =>
game.name.toLowerCase().includes(query)
);
displayFilteredGames(filteredGames);
const resultsLabel = document.getElementById("resultsLabel");
if (resultsLabel) {
resultsLabel.textContent = query
? `${filteredGames.length} OF ${gamesData.length} GAMES`
: "PICK YOUR NEXT GAME";
}
}
if (gamesContainer) {
// Initialize proxy system first
initializeProxy();
if (searchInput) searchInput.addEventListener("input", updateSearchResults);
// Enhanced fetch with retry logic
async function fetchWithRetry(url, maxRetries = 3) {
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
let fetchUrl = url;
// Use proxy for external requests if available
if (PROXY_ENDPOINTS[currentProxyIndex] && !url.startsWith(window.location.origin)) {
fetchUrl = createProxyUrl(PROXY_ENDPOINTS[currentProxyIndex], url);
}
const response = await fetch(fetchUrl, {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
'Accept': 'application/json, text/plain, */*',
'Cache-Control': 'no-cache'
},
signal: AbortSignal.timeout(10000)
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
return response;
} catch (error) {
console.warn(`Fetch attempt ${attempt} failed:`, error);
if (attempt < maxRetries) {
// Rotate proxy and server for next attempt
rotateProxy();
rotateServer();
await new Promise(resolve => setTimeout(resolve, 1000 * attempt));
} else {
throw error;
}
}
}
}
fetchWithRetry("./config/games.json")
.then((response) => response.json())
.then((data) => {
gamesData = data;
const gameCount = document.getElementById("gameCount");
if (gameCount) gameCount.textContent = String(data.length);
displayFilteredGames(data);
console.log(`Loaded ${data.length} games successfully`);
})
.catch((error) => {
console.error("Error fetching games:", error);
gamesContainer.innerHTML = '<div class="empty-state" role="alert"><strong>THE ARCADE IS TAKING A BREATHER</strong><span>We could not load the game list. Refresh the page to try again.</span></div>';
});
}