Compare commits

...

3 Commits

Author SHA1 Message Date
tim
bd37554b7d maxmind fix 2025-12-18 20:59:31 -04:00
tim
0a9b0cc631 maxmind fix 2025-12-18 20:47:59 -04:00
tim
eca99567d8 put app back on app.dexorder.com and corp site on dexorder.com with www redirecting to apex 2025-05-19 15:19:20 -04:00
2 changed files with 24 additions and 13 deletions

View File

@@ -3,6 +3,8 @@ import path from 'path';
import {extract} from "tar"; import {extract} from "tar";
import {Reader} from '@maxmind/geoip2-node'; import {Reader} from '@maxmind/geoip2-node';
const ENABLE_MAXMIND=false
let ipdb = null let ipdb = null
function setDbFile(file) { function setDbFile(file) {
const dbBuffer = fs.readFileSync(file); const dbBuffer = fs.readFileSync(file);
@@ -112,6 +114,11 @@ async function downloadAndExtractMaxmindData(url, outputDir, tempDir, username,
* @return {Promise<void>} Resolves when the data check and optional update process is completed. * @return {Promise<void>} Resolves when the data check and optional update process is completed.
*/ */
async function checkAndUpdateMaxmindData(outputDir, tempDir, url, username, password) { async function checkAndUpdateMaxmindData(outputDir, tempDir, url, username, password) {
if (username === '' || password === '') {
console.log('No MaxMind credentials provided. Skipping MaxMind database update.');
return
}
console.log('Checking for MaxMind database updates.'); console.log('Checking for MaxMind database updates.');
// Ensure the output directory exists // Ensure the output directory exists
@@ -146,21 +153,25 @@ async function checkAndUpdateMaxmindData(outputDir, tempDir, url, username, pass
const url = 'https://download.maxmind.com/geoip/databases/GeoIP2-Country/download?suffix=tar.gz'; const url = 'https://download.maxmind.com/geoip/databases/GeoIP2-Country/download?suffix=tar.gz';
const outputDirectory = './maxmind'; const outputDirectory = './maxmind';
const username = '1102431'; // const username = '1102431';
const password = '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'; // const password = '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';
// const username = process.env.MAXMIND_ACCOUNT_NUMBER; const username = process.env.MAXMIND_ACCOUNT_NUMBER;
// const password = process.env.MAXMIND_LICENSE_KEY; const password = process.env.MAXMIND_LICENSE_KEY;
await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password); if( ENABLE_MAXMIND ) {
await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password);
setInterval(async () => { setInterval(async () => {
try { try {
await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password); await checkAndUpdateMaxmindData(outputDirectory, '/tmp', url, username, password);
} catch (error) { } catch (error) {
console.error('Error during MaxMind database update:', error); console.error('Error during MaxMind database update:', error);
} }
}, 24 * 60 * 60 * 1000 + 1000); // 1 day + 1 second }, 24 * 60 * 60 * 1000 + 1000); // 1 day + 1 second
}
export function countryForIP(ipAddress) { export function countryForIP(ipAddress) {

View File

@@ -4,7 +4,7 @@
<meta property="og:title" content="Dexorder Trade Setup"> <meta property="og:title" content="Dexorder Trade Setup">
<meta property="og:description" content="Trade this setup on Dexorder"> <meta property="og:description" content="Trade this setup on Dexorder">
<meta property="og:image" content="{{{imageUrl}}}"> <meta property="og:image" content="{{{imageUrl}}}">
<meta property="og:url" content="https://dexorder.com/"> <meta property="og:url" content="https://app.dexorder.com/">
<meta property="og:type" content="website"> <meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image"> <meta name="twitter:card" content="summary_large_image">