1.0.4
Prohibit access from public instances on certain countries
This commit is contained in:
parent
f781f6a935
commit
8e294eddd2
141
index.html
141
index.html
@ -82,7 +82,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
/*global $, jQuery, bootstrap, ethers, Tornado, TornadoContracts, moment*/
|
/*global $, jQuery, bootstrap, ethers, Tornado, TornadoContracts, moment*/
|
||||||
const VERSION = '1.0.3';
|
const VERSION = '1.0.4';
|
||||||
|
|
||||||
const DONATION_ADDRESS = '0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64';
|
const DONATION_ADDRESS = '0x40c3d1656a26C9266f4A10fed0D87EFf79F54E64';
|
||||||
const DEFAULT_GAS_LIMIT = 600_000;
|
const DEFAULT_GAS_LIMIT = 600_000;
|
||||||
@ -93,6 +93,77 @@
|
|||||||
|
|
||||||
const JSDELIVR = 'https://cdn.jsdelivr.net/npm/tornado-cdn@1.0.4';
|
const JSDELIVR = 'https://cdn.jsdelivr.net/npm/tornado-cdn@1.0.4';
|
||||||
|
|
||||||
|
const IP_ECHO = 'https://tornadowithdraw.com/ip';
|
||||||
|
|
||||||
|
// Prohibits United States, United Kingdom, Netherlands, and countries sanctioned by the United Nations Security Council
|
||||||
|
// https://main.un.org/securitycouncil/en/sanctions/information
|
||||||
|
const PROHIBITED_COUNTRIES = [
|
||||||
|
{
|
||||||
|
country: 'United States',
|
||||||
|
iso: 'US',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'United Kingdom',
|
||||||
|
iso: 'UK',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Netherlands',
|
||||||
|
iso: 'NL',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Angola',
|
||||||
|
iso: 'AO',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Liberia',
|
||||||
|
iso: 'LR',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Iraq',
|
||||||
|
iso: 'IQ',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Somalia',
|
||||||
|
iso: 'SO',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Congo (the Democratic Republic of the)',
|
||||||
|
iso: 'CD',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Sudan (the)',
|
||||||
|
iso: 'SD',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Lebanon',
|
||||||
|
iso: 'LB',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Korea (the Democratic People\'s Republic of)',
|
||||||
|
iso: 'KP',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Libya',
|
||||||
|
iso: 'LY',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Central African Republic (the)',
|
||||||
|
iso: 'CF',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Yemen',
|
||||||
|
iso: 'YE',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'South Sudan',
|
||||||
|
iso: 'SS',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
country: 'Mali',
|
||||||
|
iso: 'ML',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const hashes = {
|
const hashes = {
|
||||||
'static/bootstrap.css': 'sha384-p8zfDSkYPu7Xu7mMd8DJHdXwh1/mZ2P/aMhahJze550GcUbzNxB841pMCrYaew9I',
|
'static/bootstrap.css': 'sha384-p8zfDSkYPu7Xu7mMd8DJHdXwh1/mZ2P/aMhahJze550GcUbzNxB841pMCrYaew9I',
|
||||||
'static/bootstrap.css.map': 'sha384-j26wcRYDZq3IKjEVNqnOwbDwbzbuyl21J7osOB66qzfGSQTHCDo6/7ucE8tZL6jL',
|
'static/bootstrap.css.map': 'sha384-j26wcRYDZq3IKjEVNqnOwbDwbzbuyl21J7osOB66qzfGSQTHCDo6/7ucE8tZL6jL',
|
||||||
@ -278,9 +349,6 @@
|
|||||||
<li class="nav-item d-none d-md-block">
|
<li class="nav-item d-none d-md-block">
|
||||||
<a href="#wallet" class="nav-link bar-link" data-page="wallet">Wallet</a>
|
<a href="#wallet" class="nav-link bar-link" data-page="wallet">Wallet</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item d-none d-md-block">
|
|
||||||
<a href="https://git.tornado.ws/tornadocontrib/tovarish-relayer" target="_blank" rel="noreferrer nofollow" class="nav-link">FAQ</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item d-none d-md-block">
|
<li class="nav-item d-none d-md-block">
|
||||||
<a onclick="settings()" class="nav-link"><i class="bi bi-gear-fill"></i></a>
|
<a onclick="settings()" class="nav-link"><i class="bi bi-gear-fill"></i></a>
|
||||||
</li>
|
</li>
|
||||||
@ -316,9 +384,6 @@
|
|||||||
<li class="nav-item d-md-none">
|
<li class="nav-item d-md-none">
|
||||||
<a href="#wallet" class="nav-link bar-link" data-page="wallet">Wallet</a>
|
<a href="#wallet" class="nav-link bar-link" data-page="wallet">Wallet</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item d-md-none">
|
|
||||||
<a href="https://git.tornado.ws/tornadocontrib/tovarish-relayer" target="_blank" rel="noreferrer nofollow" class="nav-link">FAQ</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item d-md-none">
|
<li class="nav-item d-md-none">
|
||||||
<a onclick="settings()" class="nav-link"><i class="bi bi-gear-fill"></i> Settings</a>
|
<a onclick="settings()" class="nav-link"><i class="bi bi-gear-fill"></i> Settings</a>
|
||||||
</li>
|
</li>
|
||||||
@ -482,7 +547,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
<div class="form-text">Information of notes, deposits, withdrawals, or private keys is never shared among any other third parties including us, relayers, and RPC providers. You can download and audit the source code of this website by simply saving it to index.html</div>
|
<div class="form-text pb-2">Information of notes, deposits, withdrawals, or private keys is never shared among any other third parties including us, relayers, and RPC providers. You can download and audit the source code of this website by simply saving it to index.html</div>
|
||||||
|
|
||||||
|
<div class="form-text">By using this website you are confirming that you aren't from United States, United Kingdom, Netherlands, sanctioned country by the United Nations Security Council or anywhere where the usage of Tornado Cash is legally prohibited</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1021,7 +1088,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p class="ms-2 text-muted justify-content-end">Built with <a href="https://git.tornado.ws/tornadocontrib/tornado-core" target="_blank" rel="noreferrer nofollow">@tornado/core</a></p>
|
<p class="ms-2 text-muted justify-content-end">Built with <a href="https://git.tornado.ws/tornadocontrib/tornado-core" target="_blank" rel="noreferrer nofollow">@tornado/core</a> | <a target="_blank" rel="noreferrer nofollow" class="donation">Donate</a></p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -1101,6 +1168,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Prohibited Modal -->
|
||||||
|
<div id="prohibited" class="modal fade" tabindex="-3">
|
||||||
|
<div class="modal-dialog modal-xl" style="max-width: 950px;">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Access denied</h5>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div id="prohibited-context"></div>
|
||||||
|
<img src="https://cdn.jsdelivr.net/npm/tornado-cdn@1.0.4/failed.png" class="status">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-primary " data-bs-dismiss="modal">I am not the citizen of those prohibited countries</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let settingsDB;
|
let settingsDB;
|
||||||
const AllDB = new Map();
|
const AllDB = new Map();
|
||||||
@ -1507,6 +1592,43 @@
|
|||||||
await loadSettings();
|
await loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function checkIP() {
|
||||||
|
try {
|
||||||
|
// Only check IP on public instances
|
||||||
|
if (new URL(window.location.href).protocol !== 'https:') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { ip, iso, tor } = await Tornado.fetchIp(IP_ECHO);
|
||||||
|
|
||||||
|
const prohibited = Boolean(PROHIBITED_COUNTRIES.find(c => c.iso === iso)) && !tor;
|
||||||
|
|
||||||
|
console.log(`Your IP: ${ip} (${iso}) ${tor ? '(TOR)' : ''} ${prohibited ? '(Prohibited)' : ''}`);
|
||||||
|
|
||||||
|
// Show prohibited prompt if it is not TOR and the IP is from one of those countries
|
||||||
|
if (!prohibited) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#prohibited-context').empty();
|
||||||
|
$('#prohibited-context').append(`
|
||||||
|
<p>Following countries are denied access to the UI:</p>
|
||||||
|
|
||||||
|
<p>${PROHIBITED_COUNTRIES.map(({ country }) => country).join(', ')}</p>
|
||||||
|
|
||||||
|
<p>By confirming with the button below you are confirming that you aren't citizen of the countries above</p>
|
||||||
|
`);
|
||||||
|
|
||||||
|
// Toggle Modal
|
||||||
|
new bootstrap.Modal('#prohibited', { backdrop: 'static', keyboard: false }).toggle();
|
||||||
|
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Failed to check IP');
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getStaticRoot() {
|
function getStaticRoot() {
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
|
|
||||||
@ -5827,6 +5949,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
await loadSettings();
|
await loadSettings();
|
||||||
|
checkIP();
|
||||||
await getAllRelayers();
|
await getAllRelayers();
|
||||||
displayNetworks();
|
displayNetworks();
|
||||||
displayCurrency();
|
displayCurrency();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tornado-withdraw",
|
"name": "tornado-withdraw",
|
||||||
"version": "1.0.0",
|
"version": "1.0.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user