From 81a47c5f3113107bf7a6fc4b6dd4bb9729789cab Mon Sep 17 00:00:00 2001 From: Luk Date: Wed, 21 Jan 2026 12:15:11 +0800 Subject: [PATCH] u --- git-ignore-merge.js => gitignore_merge.js | 0 git-ignore-merge.sh => gitignore_merge.sh | 2 +- prod_or_dev.js | 7 +++++-- 3 files changed, 6 insertions(+), 3 deletions(-) rename git-ignore-merge.js => gitignore_merge.js (100%) rename git-ignore-merge.sh => gitignore_merge.sh (88%) diff --git a/git-ignore-merge.js b/gitignore_merge.js similarity index 100% rename from git-ignore-merge.js rename to gitignore_merge.js diff --git a/git-ignore-merge.sh b/gitignore_merge.sh similarity index 88% rename from git-ignore-merge.sh rename to gitignore_merge.sh index 2562c36..8296d7d 100755 --- a/git-ignore-merge.sh +++ b/gitignore_merge.sh @@ -6,4 +6,4 @@ if [ -f .gitignore.local.txt ]; then cat .gitignore.local.txt >> .gitignore; fi; echo # usage in package.json: -# "to_merge_gitignore.sh": "curl -sSL https://git.tic.cc/npm/sysconfig/raw/branch/main/git-ignore-merge.sh | bash", \ No newline at end of file +# "to_merge_gitignore.sh": "curl -sSL https://git.tic.cc/npm/sysconfig/raw/branch/main/gitignore_merge.sh | bash", \ No newline at end of file diff --git a/prod_or_dev.js b/prod_or_dev.js index 7e05455..1636a5d 100644 --- a/prod_or_dev.js +++ b/prod_or_dev.js @@ -3,14 +3,17 @@ const https = require('https') https .get('https://api.ipify.org', (res) => { + // `curl -s https://ifconfig.me` returns the IP address only, but open the url in browser or with nodejs http module returns the HTML content + // `https://api.ipify.org` returns the IP address only with curl, browser or nodejs. But it seems it doesn't work in China. let data = '' res.on('data', (chunk) => (data += chunk)) res.on('end', () => { - // 仅提取返回的纯IP地址部分,忽略HTML标签 const ip = data.trim().split(/\s+/)[0] - console.log('public ip:', ip) + // console.log('public ip:', ip) if (ip.endsWith('.172')) { console.log('production') + } else if (ip.endsWith('.60')) { + console.log('development') } else { console.log('development') }