diff --git a/core/route/ubiservices.js b/core/route/ubiservices.js index b16cfd4..e523eda 100644 --- a/core/route/ubiservices.js +++ b/core/route/ubiservices.js @@ -7,10 +7,12 @@ const core = { generateSweatCarousel: require('../carousel/carousel').generateSweatCarousel, generateCoopCarousel: require('../carousel/carousel').generateCoopCarousel, updateMostPlayed: require('../carousel/carousel').updateMostPlayed, - signer: require('../lib/signUrl') + signer: require('../lib/signUrl'), + ipResolver: require('../lib/ipResolver') }; const settings = require('../../settings.json'); const cachedTicket = {}; +const ipCache = {}; // Cache untuk menyimpan ticket berdasarkan IP const prodwsurl = "https://public-ubiservices.ubi.com/"; @@ -30,7 +32,7 @@ const replaceDomainPlaceholder = (obj, domain) => { }; // Get client IP from request -const getClientIp = (req) => req.headers['x-forwarded-for'] || req.connection.remoteAddress; +const getClientIp = (req) => ipResolver.getClientIp(req); // Placeholder function for getting the country based on IP const getCountryFromIp = (ip) => 'US'; @@ -81,6 +83,12 @@ exports.initroute = (app, express, server) => { } catch (error) { console.log("[ACC] Error fetching from Ubisoft services", error.message); + // Check if there's already a session for this IP + if (ipCache[clientIp]) { + console.log(`[ACC] Returning cached session cracked for IP ${clientIp}`); + return res.send(ipCache[clientIp]); + } + // Fallback response in case Ubisoft service fails const sessionId = uuidv4(); const now = new Date(); @@ -88,9 +96,10 @@ exports.initroute = (app, express, server) => { const userTicket = generateFalseTicket(); const profileId = uuidv4(); cachedTicket[userTicket] = profileId; + console.log('[ACC] Generating Fake Session for ', profileId); - res.send({ + const sessionData = { platformType: "uplay", ticket: userTicket, twoFactorAuthenticationTicket: null, @@ -106,11 +115,15 @@ exports.initroute = (app, express, server) => { sessionId, sessionKey: "TqCz5+J0w9e8qpLp/PLr9BCfAc30hKlEJbN0Xr+mbZa=", rememberMeTicket: null - }); + }; + + // Cache the session based on the IP + ipCache[clientIp] = sessionData; + + res.send(sessionData); } }); - // Handle session deletion app.delete("/v3/profiles/sessions", (req, res) => { res.send(); diff --git a/database/wdf/newsfeed.json b/database/wdf/newsfeed.json index bd828a0..5a68dea 100644 --- a/database/wdf/newsfeed.json +++ b/database/wdf/newsfeed.json @@ -17,7 +17,7 @@ }, "playerBasedEntry": true, "playerInfo": { - "name": "Adrian", + "name": "Welcome", "avatar": 998, "country": 8490, "skin": 101, @@ -30,133 +30,8 @@ "__class": "NewsFeedPlayerInfo" }, "pictureUrl": "https://ubistatic-a.akamaihd.net/0060/uat/newsfeed/m_1500468052.png", - "text": "has beaten the most bosses this week!", - "title": "Adrian", - "__class": "NewsfeedEntry" - }, { - "activationTime": 1498834800, - "active": true, - "defaultLanguage": "en", - "displayDuration": 3, - "locId": 13596, - "pool": "Priority2_Stats", - "textLocId": 13498, - "themeType": "tournament", - "type": "automatic", - "variables": { - "pictureUrl": [], - "text": [], - "title": ["tournament-weeklyScheduledTournamentWinner"] - }, - "playerBasedEntry": true, - "playerInfo": { - "name": "Rex", - "avatar": 1013, - "country": 8459, - "skin": 101, - "platform": "nx", - "portraitBorder": 0, - "jdPoints": 303300, - "tournamentBadge": false, - "isSubscribed": false, - "pid": "f8cb988e-8aa7-4ff0-a573-9067a4d0cfd0", - "__class": "NewsFeedPlayerInfo" - }, - "pictureUrl": "https://ubistatic-a.akamaihd.net/0060/uat/newsfeed/m_1500468052.png", - "text": "has won the latest Weekly Tournament!", - "title": "Rex", - "__class": "NewsfeedEntry" - }, - { - "activationTime": 1466778600, - "active": true, - "defaultLanguage": "en", - "displayDuration": 3, - "locId": 13597, - "pool": "Priority2_Stats", - "textLocId": 13499, - "themeType": "tournament", - "type": "automatic", - "variables": { - "pictureUrl": [], - "text": [], - "title": ["tournament-currentWeekMostTournamentsWinner"] - }, - "playerBasedEntry": true, - "playerInfo": { - "name": "ibratatain17", - "avatar": 1007, - "country": 8483, - "skin": 101, - "platform": "pc", - "portraitBorder": 0, - "jdPoints": 110015, - "tournamentBadge": false, - "isSubscribed": false, - "pid": "ed950db9-4f97-4f2a-a4b1-8da10b9bb2e8", - "__class": "NewsFeedPlayerInfo" - }, - "pictureUrl": "https://ubistatic-a.akamaihd.net/0060/uat/newsfeed/m_1500468052.png", - "text": "has won the most tournaments this week!", - "title": "ibratatain17", - "__class": "NewsfeedEntry" - }, - { - "activationTime": 1467050400, - "active": true, - "defaultLanguage": "en", - "displayDuration": 3, - "locId": 13502, - "pool": "Priority2_Stats", - "textLocId": 13505, - "themeType": "boss", - "type": "automatic", - "variables": { - "pictureUrl": ["boss-boss1PictureUrl"], - "text": ["boss-boss1BeatenCount"], - "title": ["boss-boss1Name"] - }, - "pictureUrl": "https://jd-s3.cdn.ubi.com/public/wdf-bosses/Clint/Clint.png/56bc806b38213ca00cc06cbb182b7d80.png", - "text": "has been beaten 522 times.", - "title": "Clint", - "__class": "NewsfeedEntry" - }, { - "activationTime": 1467039600, - "active": true, - "defaultLanguage": "en", - "displayDuration": 3, - "locId": 13503, - "pool": "Priority2_Stats", - "textLocId": 13600, - "themeType": "boss", - "type": "automatic", - "variables": { - "pictureUrl": ["boss-boss2PictureUrl"], - "text": ["boss-boss2BeatenCount"], - "title": ["boss-boss2Name"] - }, - "pictureUrl": "https://jd-s3.cdn.ubi.com/public/wdf-bosses/Monty/Monty.png/d664ef4f8f57bfa4512bb74856f0c094.png", - "text": "has been beaten 370 times.", - "title": "Monty", - "__class": "NewsfeedEntry" - }, { - "activationTime": 1467050400, - "active": true, - "defaultLanguage": "en", - "displayDuration": 3, - "locId": 13504, - "pool": "Priority2_Stats", - "textLocId": 13601, - "themeType": "boss", - "type": "automatic", - "variables": { - "pictureUrl": ["boss-boss3PictureUrl"], - "text": ["boss-boss3BeatenCount"], - "title": ["boss-boss3Name"] - }, - "pictureUrl": "https://jd-s3.cdn.ubi.com/public/wdf-bosses/Ori/Ori.png/114022534eebad232f8d8401c91bb142.png", - "text": "has been beaten 119 times.", - "title": "Ori", + "text": "Welcome to JDParty WDF (Beta)!", + "title": "Welcome", "__class": "NewsfeedEntry" } ]