Skip to content
Open
Show file tree
Hide file tree
Changes from 20 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LOCAL_APPDATA_FONTCONFIG_CACHE/
node_modules/
config/local*
data/asn-domain.json
data/IPINFO_LITE_ASN.mmdb
test/screenshots
yarn.lock
.eslintcache
Expand Down
21 changes: 17 additions & 4 deletions bin/fetch-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const fs = require('fs');
const path = require('path');
const { pipeline } = require('node:stream/promises');

const ASN_COLUMN_NUM = 5;
const DOMAIN_COLUMN_NUM = 7;
const ASN_COLUMN_NUM = 2;
const DOMAIN_COLUMN_NUM = 4;

async function fetchAndSaveAsnDomainMap (url) {
let asnDomainMap = {};
Expand All @@ -20,7 +20,7 @@ async function fetchAndSaveAsnDomainMap (url) {
});

let pipelinePromise = pipeline(
got.stream(url),
got.stream(`${url}.csv.gz`),
zlib.createGunzip(),
parser,
);
Expand Down Expand Up @@ -50,11 +50,24 @@ async function fetchAndSaveAsnDomainMap (url) {
console.log(`ASN-domain map saved to: ${outputPath}`);
}

async function downloadMmdb (url) {
let outputPath = path.resolve(__dirname, '../data/IPINFO_LITE_ASN.mmdb');
fs.mkdirSync(path.dirname(outputPath), { recursive: true });

await pipeline(
got.stream(`${url}.mmdb`),
fs.createWriteStream(outputPath),
);

console.log(`MMDB file saved to: ${outputPath}`);
}

async function main () {
let url = `https://download.jsdelivr.com/IPINFO_LITE.csv.gz`;
let url = `https://download.jsdelivr.com/IPINFO_LITE_ASN`;

try {
await fetchAndSaveAsnDomainMap(url);
await downloadMmdb(url);
} catch (err) {
console.error('Failed to fetch or process data:', err);
process.exit(1);
Expand Down
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ gulp.task('less', () => {
return gulp.src([ `${srcAssetsDir}/less/app.less` ])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(less({ relativeUrls: true, strictMath: true }))
.pipe(less({ relativeUrls: true, strictMath: true, sourceMap: { outputSourceFiles: true } }))
.pipe(rename('app.css'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(`${dstAssetsDir}/css`));
Expand All @@ -108,7 +108,7 @@ gulp.task('nuxt:less', () => {
return gulp.src([ `${srcAssetsDir}/less/reduced.less` ])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(less({ relativeUrls: true, strictMath: true }))
.pipe(less({ relativeUrls: true, strictMath: true, sourceMap: { outputSourceFiles: true } }))
.pipe(postcss([
prefixSelector({
prefix: '.ractive-component',
Expand All @@ -122,7 +122,7 @@ gulp.task('nuxt:less', () => {
gulp.task('less:prod', () => {
return gulp.src([ `${srcAssetsDir}/less/app.less` ])
.pipe(sourcemaps.init())
.pipe(less({ relativeUrls: true, strictMath: true }))
.pipe(less({ relativeUrls: true, strictMath: true, sourceMap: { outputSourceFiles: true } }))
.pipe(autoprefixer())
.pipe(minifyCss())
.pipe(rename('app.css'))
Expand Down
224 changes: 224 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading