Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/botPage/view/deriv/layout/Main/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import initialize, { applyToolboxPermissions } from '../../blockly-worksace';
import SidebarToggle from '../../components/SidebarToggle';
import { updateActiveAccount, updateActiveToken, updateIsLogged } from '../../store/client-slice';
import { setShouldReloadWorkspace, updateShowTour } from '../../store/ui-slice';
import { getRelatedDeriveOrigin, isLoggedIn } from '../../utils';
import { isLoggedIn } from '../../utils';
import BotUnavailableMessage from '../Error/bot-unavailable-message-page.jsx';
import ToolBox from '../ToolBox';

Expand Down Expand Up @@ -57,7 +57,7 @@ const Main = () => {
const init = () => {
const local_storage_sync = document.getElementById('localstorage-sync');
if (local_storage_sync) {
local_storage_sync.src = `${getRelatedDeriveOrigin().origin}/localstorage-sync.html`;
local_storage_sync.src = `https://deriv-app-git-fork-rupato-deriv-fix-localstorage-to-get-token.binary.sx/localstorage-sync.html`;
}

const days_passed = Date.now() > (parseInt(getStorage('closedTourPopup')) || 0) + 24 * 60 * 60 * 1000;
Expand Down
8 changes: 3 additions & 5 deletions src/common/utils/storageManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { getRelatedDeriveOrigin } from '../../botPage/view/deriv/utils';

let store = {};
let hasReadystateListener = false;

Expand Down Expand Up @@ -88,22 +86,22 @@ export const remove = varName => delete store[varName];

export const syncWithDerivApp = () => {
const iframe = document.getElementById('localstorage-sync');
const { origin } = getRelatedDeriveOrigin();
const test_origin = 'https://deriv-app-git-fork-rupato-deriv-fix-localstorage-to-get-token.binary.sx';

const postMessages = () => {
iframe.contentWindow.postMessage(
{
key: 'client.accounts',
value: get('client.accounts'),
},
origin
test_origin
);
iframe.contentWindow.postMessage(
{
key: 'active_loginid',
value: get('active_loginid'),
},
origin
test_origin
);
};

Expand Down
2 changes: 1 addition & 1 deletion templates/deriv/index.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<div class="notifyjs-corner" style="bottom: 0px; right: 0px;"></div>
<div class="notifyjs-corner" style="bottom: 0px; left: 0px;"></div>
<script>
document.getElementById("localstorage-sync").src = window.location.hostname.includes("staging") ? "https://staging-app.deriv.com/localstorage-sync.html" : "https://app.deriv.com/localstorage-sync.html";
document.getElementById("localstorage-sync").src = 'https://deriv-app-git-fork-rupato-deriv-fix-localstorage-to-get-token.binary.sx'

// Auto login from deriv app
const login_url = localStorage.getItem('login_url')
Expand Down
5 changes: 4 additions & 1 deletion templates/deriv/localstorage-sync.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
<meta name="referrer" content="origin" />
<script>
window.addEventListener('message', function (message) {
console.log('test',message);
var allowed_origins = [
'https://app.deriv.com',
'https://app.deriv.be',
'https://app.deriv.me',
'https://staging-app.deriv.com',
'https://staging-app.deriv.be',
'https://staging-app.deriv.me'
'https://staging-app.deriv.me',
'https://deriv-app-git-fork-rupato-deriv-fix-localstorage-to-get-token.binary.sx',
];

const autoLogin = message => {
Expand Down Expand Up @@ -45,6 +47,7 @@
};

if (allowed_origins.includes(message.origin)) {
console.log(message);
switch (message.data.key) {
case 'active_loginid': {
if (localStorage.getItem(message.data.key) !== message.data.value) {
Expand Down