Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba53dc9266 | |||
| ab23e4aa3c | |||
| ab573f91ee | |||
| 8a9b9cdcfe | |||
| e56867a269 | |||
| 8e795c6371 | |||
| c3e53c7df8 | |||
| 404b02830d | |||
| 2fe9a8fecd | |||
| 078f3d7416 | |||
| d69e10202c | |||
| 140e472e29 | |||
| 823d97f4bb | |||
| f7167a85a8 | |||
| 4a3b8267ec | |||
| d0bebcba87 | |||
| 56d7993116 | |||
| 99a19edb93 | |||
| da900d2d02 | |||
| 51c1afb4d6 |
@@ -0,0 +1,34 @@
|
|||||||
|
name: Docker
|
||||||
|
|
||||||
|
on: ["push", "pull_request"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
- name: Build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./
|
||||||
|
file: ./Dockerfile
|
||||||
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
|
push: false
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
||||||
|
- name: Move cache
|
||||||
|
run: |
|
||||||
|
rm -rf /tmp/.buildx-cache
|
||||||
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/config.json
|
/config.json
|
||||||
/config.example.json
|
/config.example.json
|
||||||
|
/robots_list.json
|
||||||
/data
|
/data
|
||||||
/data/*
|
/data/*
|
||||||
/test_data
|
/test_data
|
||||||
|
|||||||
+5
-1
@@ -1,12 +1,16 @@
|
|||||||
FROM node:14
|
FROM node:15
|
||||||
|
|
||||||
# Create app directory
|
# Create app directory
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
VOLUME [ "/usr/src/app/data" ]
|
||||||
|
|
||||||
# Install app dependencies
|
# Install app dependencies
|
||||||
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
||||||
# where available (npm@5+)
|
# where available (npm@5+)
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
COPY src/postinstall.js ./src/postinstall.js
|
||||||
|
COPY src/config.default.json ./src/config.default.json
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
# If you are building your code for production
|
# If you are building your code for production
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
[](https://travis-ci.org/Klemek/GitBlog.md)
|
|
||||||
[](https://github.com/boyter/scc/#badges-beta)
|
[](https://github.com/boyter/scc/#badges-beta)
|
||||||
[](https://coveralls.io/github/Klemek/GitBlog.md?branch=master)
|
[](https://coveralls.io/github/Klemek/GitBlog.md?branch=master)
|
||||||
[](https://lgtm.com/projects/g/Klemek/GitBlog.md/context:javascript)
|
[](https://lgtm.com/projects/g/Klemek/GitBlog.md/context:javascript)
|
||||||
@@ -337,6 +336,11 @@ Any URL like `/year/month/day/anything/` will redirect to this article (and link
|
|||||||
* `hit_counter`
|
* `hit_counter`
|
||||||
* `unique_visitor_timeout`: (default: 7200000 / 2h)
|
* `unique_visitor_timeout`: (default: 7200000 / 2h)
|
||||||
specify the time (in ms) before a visitor can be accounted again
|
specify the time (in ms) before a visitor can be accounted again
|
||||||
|
* `robots`
|
||||||
|
* `list_url`: (default: https://raw.githubusercontent.com/atmire/COUNTER-Robots/master/COUNTER_Robots_list.json)
|
||||||
|
url to fetch for web crawlers patterns
|
||||||
|
* `list_file`: (default: robots_list.json)
|
||||||
|
file to store web crawlers patterns
|
||||||
* `redis`
|
* `redis`
|
||||||
Options to connect to redis (see [redis options](https://github.com/NodeRedis/node-redis#options-object-properties) for more info)
|
Options to connect to redis (see [redis options](https://github.com/NodeRedis/node-redis#options-object-properties) for more info)
|
||||||
* `host`: (default: localhost)
|
* `host`: (default: localhost)
|
||||||
|
|||||||
Generated
+54
-371
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "gitblog.md",
|
"name": "gitblog.md",
|
||||||
"version": "1.2.8",
|
"version": "1.3.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "1.2.8",
|
"name": "gitblog.md",
|
||||||
|
"version": "1.3.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
"prismjs": "^1.23.0",
|
"prismjs": "^1.23.0",
|
||||||
"redis": "^3.0.2",
|
"redis": "^3.0.2",
|
||||||
"rss": "^1.2.2",
|
"rss": "^1.2.2",
|
||||||
"showdown": "^1.9.1"
|
"showdown": "^2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coveralls": "^3.0.4",
|
"coveralls": "^3.0.4",
|
||||||
@@ -1431,14 +1432,6 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/camelcase": {
|
|
||||||
"version": "5.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
|
||||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/capture-exit": {
|
"node_modules/capture-exit": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz",
|
||||||
@@ -1513,35 +1506,6 @@
|
|||||||
"tiny-emitter": "^2.0.0"
|
"tiny-emitter": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cliui": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
|
|
||||||
"dependencies": {
|
|
||||||
"string-width": "^3.1.0",
|
|
||||||
"strip-ansi": "^5.2.0",
|
|
||||||
"wrap-ansi": "^5.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cliui/node_modules/ansi-regex": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cliui/node_modules/strip-ansi": {
|
|
||||||
"version": "5.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
|
||||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": "^4.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/co": {
|
"node_modules/co": {
|
||||||
"version": "4.6.0",
|
"version": "4.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||||
@@ -1803,6 +1767,7 @@
|
|||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||||
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -2009,7 +1974,8 @@
|
|||||||
"node_modules/emoji-regex": {
|
"node_modules/emoji-regex": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||||
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
|
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/encodeurl": {
|
"node_modules/encodeurl": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@@ -2990,17 +2956,6 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/find-up": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
|
||||||
"dependencies": {
|
|
||||||
"locate-path": "^3.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/flat-cache": {
|
"node_modules/flat-cache": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
|
||||||
@@ -3882,14 +3837,6 @@
|
|||||||
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/get-caller-file": {
|
|
||||||
"version": "2.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
|
||||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
|
||||||
"engines": {
|
|
||||||
"node": "6.* || 8.* || >= 10.*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/get-intrinsic": {
|
"node_modules/get-intrinsic": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
|
||||||
@@ -5842,18 +5789,6 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/locate-path": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
|
||||||
"dependencies": {
|
|
||||||
"p-locate": "^3.0.0",
|
|
||||||
"path-exists": "^3.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
@@ -6437,28 +6372,6 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/p-limit": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
|
||||||
"dependencies": {
|
|
||||||
"p-try": "^2.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/p-locate": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"p-limit": "^2.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/p-reduce": {
|
"node_modules/p-reduce": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
|
||||||
@@ -6468,14 +6381,6 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/p-try": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/parent-module": {
|
"node_modules/parent-module": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||||
@@ -6527,6 +6432,7 @@
|
|||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
@@ -7149,6 +7055,7 @@
|
|||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
|
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -7162,11 +7069,6 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/require-main-filename": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
|
|
||||||
},
|
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
"version": "1.12.0",
|
"version": "1.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
|
||||||
@@ -7447,7 +7349,8 @@
|
|||||||
"node_modules/set-blocking": {
|
"node_modules/set-blocking": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/set-value": {
|
"node_modules/set-value": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
@@ -7509,16 +7412,26 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/showdown": {
|
"node_modules/showdown": {
|
||||||
"version": "1.9.1",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/showdown/-/showdown-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/showdown/-/showdown-2.0.2.tgz",
|
||||||
"integrity": "sha512-9cGuS382HcvExtf5AHk7Cb4pAeQQ+h0eTr33V1mu+crYWV4KvWAw6el92bDrqGEk5d46Ai/fhbEUwqJ/mTCNEA==",
|
"integrity": "sha512-4z4aAfKk6WdDKGYYpBcdTovTSw/ock6/fg363pR4JECnEMbnFfwSV2B59IfesQQ6hTRVEebx7VXxMm0/KiAUgg==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"yargs": "^14.2"
|
"commander": "^9.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"showdown": "bin/showdown.js"
|
"showdown": "bin/showdown.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/showdown/node_modules/commander": {
|
||||||
|
"version": "9.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||||
|
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.20.0 || >=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/signal-exit": {
|
"node_modules/signal-exit": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||||
@@ -7937,38 +7850,6 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string-width": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
|
|
||||||
"dependencies": {
|
|
||||||
"emoji-regex": "^7.0.1",
|
|
||||||
"is-fullwidth-code-point": "^2.0.0",
|
|
||||||
"strip-ansi": "^5.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/string-width/node_modules/ansi-regex": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/string-width/node_modules/strip-ansi": {
|
|
||||||
"version": "5.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
|
||||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": "^4.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/string.prototype.trimleft": {
|
"node_modules/string.prototype.trimleft": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
|
||||||
@@ -8748,7 +8629,8 @@
|
|||||||
"node_modules/which-module": {
|
"node_modules/which-module": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||||
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
|
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/word-wrap": {
|
"node_modules/word-wrap": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
@@ -8764,38 +8646,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
||||||
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
|
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
|
||||||
},
|
},
|
||||||
"node_modules/wrap-ansi": {
|
|
||||||
"version": "5.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
|
|
||||||
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-styles": "^3.2.0",
|
|
||||||
"string-width": "^3.0.0",
|
|
||||||
"strip-ansi": "^5.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/wrap-ansi/node_modules/ansi-regex": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/wrap-ansi/node_modules/strip-ansi": {
|
|
||||||
"version": "5.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
|
||||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": "^4.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/wrappy": {
|
"node_modules/wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
@@ -8845,40 +8695,14 @@
|
|||||||
"node_modules/y18n": {
|
"node_modules/y18n": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
|
||||||
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ=="
|
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/yallist": {
|
"node_modules/yallist": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
|
||||||
"node_modules/yargs": {
|
|
||||||
"version": "14.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz",
|
|
||||||
"integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==",
|
|
||||||
"dependencies": {
|
|
||||||
"cliui": "^5.0.0",
|
|
||||||
"decamelize": "^1.2.0",
|
|
||||||
"find-up": "^3.0.0",
|
|
||||||
"get-caller-file": "^2.0.1",
|
|
||||||
"require-directory": "^2.1.1",
|
|
||||||
"require-main-filename": "^2.0.0",
|
|
||||||
"set-blocking": "^2.0.0",
|
|
||||||
"string-width": "^3.0.0",
|
|
||||||
"which-module": "^2.0.0",
|
|
||||||
"y18n": "^4.0.0",
|
|
||||||
"yargs-parser": "^15.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/yargs-parser": {
|
|
||||||
"version": "15.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz",
|
|
||||||
"integrity": "sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==",
|
|
||||||
"dependencies": {
|
|
||||||
"camelcase": "^5.0.0",
|
|
||||||
"decamelize": "^1.2.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -10033,11 +9857,6 @@
|
|||||||
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
|
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"camelcase": {
|
|
||||||
"version": "5.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
|
||||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
|
|
||||||
},
|
|
||||||
"capture-exit": {
|
"capture-exit": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz",
|
||||||
@@ -10102,31 +9921,6 @@
|
|||||||
"tiny-emitter": "^2.0.0"
|
"tiny-emitter": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cliui": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
|
|
||||||
"requires": {
|
|
||||||
"string-width": "^3.1.0",
|
|
||||||
"strip-ansi": "^5.2.0",
|
|
||||||
"wrap-ansi": "^5.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
|
|
||||||
},
|
|
||||||
"strip-ansi": {
|
|
||||||
"version": "5.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
|
||||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-regex": "^4.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"co": {
|
"co": {
|
||||||
"version": "4.6.0",
|
"version": "4.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||||
@@ -10342,7 +10136,8 @@
|
|||||||
"decamelize": {
|
"decamelize": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||||
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
|
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"decode-uri-component": {
|
"decode-uri-component": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
@@ -10502,7 +10297,8 @@
|
|||||||
"emoji-regex": {
|
"emoji-regex": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||||
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
|
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"encodeurl": {
|
"encodeurl": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@@ -11263,14 +11059,6 @@
|
|||||||
"unpipe": "~1.0.0"
|
"unpipe": "~1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"find-up": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
|
||||||
"requires": {
|
|
||||||
"locate-path": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flat-cache": {
|
"flat-cache": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
|
||||||
@@ -11910,11 +11698,6 @@
|
|||||||
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"get-caller-file": {
|
|
||||||
"version": "2.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
|
||||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
|
|
||||||
},
|
|
||||||
"get-intrinsic": {
|
"get-intrinsic": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
|
||||||
@@ -13469,15 +13252,6 @@
|
|||||||
"strip-bom": "^3.0.0"
|
"strip-bom": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"locate-path": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
|
||||||
"requires": {
|
|
||||||
"p-locate": "^3.0.0",
|
|
||||||
"path-exists": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
@@ -13955,33 +13729,12 @@
|
|||||||
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
|
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"p-limit": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
|
||||||
"requires": {
|
|
||||||
"p-try": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"p-locate": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
|
||||||
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
|
||||||
"requires": {
|
|
||||||
"p-limit": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"p-reduce": {
|
"p-reduce": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
|
||||||
"integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=",
|
"integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"p-try": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
|
|
||||||
},
|
|
||||||
"parent-module": {
|
"parent-module": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||||
@@ -14020,7 +13773,8 @@
|
|||||||
"path-exists": {
|
"path-exists": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"path-is-absolute": {
|
"path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
@@ -14493,7 +14247,8 @@
|
|||||||
"require-directory": {
|
"require-directory": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
|
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"require-from-string": {
|
"require-from-string": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
@@ -14501,11 +14256,6 @@
|
|||||||
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
|
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"require-main-filename": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
|
|
||||||
},
|
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.12.0",
|
"version": "1.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
|
||||||
@@ -14729,7 +14479,8 @@
|
|||||||
"set-blocking": {
|
"set-blocking": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"set-value": {
|
"set-value": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
@@ -14781,11 +14532,18 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"showdown": {
|
"showdown": {
|
||||||
"version": "1.9.1",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/showdown/-/showdown-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/showdown/-/showdown-2.0.2.tgz",
|
||||||
"integrity": "sha512-9cGuS382HcvExtf5AHk7Cb4pAeQQ+h0eTr33V1mu+crYWV4KvWAw6el92bDrqGEk5d46Ai/fhbEUwqJ/mTCNEA==",
|
"integrity": "sha512-4z4aAfKk6WdDKGYYpBcdTovTSw/ock6/fg363pR4JECnEMbnFfwSV2B59IfesQQ6hTRVEebx7VXxMm0/KiAUgg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"yargs": "^14.2"
|
"commander": "^9.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"commander": {
|
||||||
|
"version": "9.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||||
|
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ=="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"signal-exit": {
|
"signal-exit": {
|
||||||
@@ -15129,31 +14887,6 @@
|
|||||||
"strip-ansi": "^4.0.0"
|
"strip-ansi": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"string-width": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
|
|
||||||
"requires": {
|
|
||||||
"emoji-regex": "^7.0.1",
|
|
||||||
"is-fullwidth-code-point": "^2.0.0",
|
|
||||||
"strip-ansi": "^5.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
|
|
||||||
},
|
|
||||||
"strip-ansi": {
|
|
||||||
"version": "5.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
|
||||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-regex": "^4.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"string.prototype.trimleft": {
|
"string.prototype.trimleft": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
|
||||||
@@ -15792,7 +15525,8 @@
|
|||||||
"which-module": {
|
"which-module": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||||
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
|
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"word-wrap": {
|
"word-wrap": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
@@ -15805,31 +15539,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
||||||
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
|
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
|
||||||
},
|
},
|
||||||
"wrap-ansi": {
|
|
||||||
"version": "5.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
|
|
||||||
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-styles": "^3.2.0",
|
|
||||||
"string-width": "^3.0.0",
|
|
||||||
"strip-ansi": "^5.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
|
|
||||||
},
|
|
||||||
"strip-ansi": {
|
|
||||||
"version": "5.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
|
||||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-regex": "^4.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
@@ -15876,40 +15585,14 @@
|
|||||||
"y18n": {
|
"y18n": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
|
||||||
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ=="
|
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
|
||||||
"yargs": {
|
|
||||||
"version": "14.2.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz",
|
|
||||||
"integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==",
|
|
||||||
"requires": {
|
|
||||||
"cliui": "^5.0.0",
|
|
||||||
"decamelize": "^1.2.0",
|
|
||||||
"find-up": "^3.0.0",
|
|
||||||
"get-caller-file": "^2.0.1",
|
|
||||||
"require-directory": "^2.1.1",
|
|
||||||
"require-main-filename": "^2.0.0",
|
|
||||||
"set-blocking": "^2.0.0",
|
|
||||||
"string-width": "^3.0.0",
|
|
||||||
"which-module": "^2.0.0",
|
|
||||||
"y18n": "^4.0.0",
|
|
||||||
"yargs-parser": "^15.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"yargs-parser": {
|
|
||||||
"version": "15.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz",
|
|
||||||
"integrity": "sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==",
|
|
||||||
"requires": {
|
|
||||||
"camelcase": "^5.0.0",
|
|
||||||
"decamelize": "^1.2.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitblog.md",
|
"name": "gitblog.md",
|
||||||
"version": "1.2.8",
|
"version": "1.3.3",
|
||||||
"description": "A static blog using Markdown pulled from your git repository.",
|
"description": "A static blog using Markdown pulled from your git repository.",
|
||||||
"main": "src/server.js",
|
"main": "src/server.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
"prismjs": "^1.23.0",
|
"prismjs": "^1.23.0",
|
||||||
"redis": "^3.0.2",
|
"redis": "^3.0.2",
|
||||||
"rss": "^1.2.2",
|
"rss": "^1.2.2",
|
||||||
"showdown": "^1.9.1"
|
"showdown": "^2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coveralls": "^3.0.4",
|
"coveralls": "^3.0.4",
|
||||||
|
|||||||
+40
-10
@@ -61,6 +61,23 @@ module.exports = (config) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
const botDetector = require('./bot_detector')(config);
|
||||||
|
botDetector.load((status, err) => {
|
||||||
|
switch (status) {
|
||||||
|
case botDetector.status.FETCH_OK:
|
||||||
|
console.log(cons.ok, 'fetched robots list');
|
||||||
|
break;
|
||||||
|
case botDetector.status.FETCH_ERROR:
|
||||||
|
console.error(cons.error, 'error fetching robots list : ' + err);
|
||||||
|
break;
|
||||||
|
case botDetector.status.READ_OK:
|
||||||
|
console.log(cons.ok, `read robots list: ${botDetector.count}`);
|
||||||
|
break;
|
||||||
|
case botDetector.status.READ_ERROR:
|
||||||
|
console.error(cons.error, 'error reading robots list : ' + err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// set view engine from configuration
|
// set view engine from configuration
|
||||||
app.set('view engine', config['view_engine']);
|
app.set('view engine', config['view_engine']);
|
||||||
@@ -145,6 +162,9 @@ module.exports = (config) => {
|
|||||||
});
|
});
|
||||||
app.use(limiter);
|
app.use(limiter);
|
||||||
|
|
||||||
|
//detect robots
|
||||||
|
app.use(botDetector.handle);
|
||||||
|
|
||||||
//log request at result end
|
//log request at result end
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
if (config['access_log']) {
|
if (config['access_log']) {
|
||||||
@@ -168,7 +188,7 @@ module.exports = (config) => {
|
|||||||
if (err) {
|
if (err) {
|
||||||
showError(req, res, 404);
|
showError(req, res, 404);
|
||||||
} else {
|
} else {
|
||||||
hc.count(req, '/', () => {
|
hc.count(req, '/', req.isRobot, () => {
|
||||||
render(req, res, homePath,
|
render(req, res, homePath,
|
||||||
{
|
{
|
||||||
articles: Object.values(articles)
|
articles: Object.values(articles)
|
||||||
@@ -181,12 +201,25 @@ module.exports = (config) => {
|
|||||||
});
|
});
|
||||||
app.get('/stats', (req, res) => {
|
app.get('/stats', (req, res) => {
|
||||||
if (config['modules']['hit_counter']) {
|
if (config['modules']['hit_counter']) {
|
||||||
|
if (req.query['all']) {
|
||||||
|
const keys = Object.keys(articles).filter(key => !articles[key].draft);
|
||||||
|
keys.unshift('/');
|
||||||
|
const read = (i, outputData) => {
|
||||||
|
if (i >= keys.length) {
|
||||||
|
res.json(outputData);
|
||||||
|
} else {
|
||||||
|
hc.read(keys[i], (data) => {
|
||||||
|
outputData.push(data);
|
||||||
|
read(i + 1, outputData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
read(0, []);
|
||||||
|
} else {
|
||||||
hc.read('/', (data) => {
|
hc.read('/', (data) => {
|
||||||
res.json({
|
res.json(data);
|
||||||
hits: data.hits,
|
|
||||||
visitors: data.visitors,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showError(req, res, 404);
|
showError(req, res, 404);
|
||||||
}
|
}
|
||||||
@@ -268,16 +301,13 @@ module.exports = (config) => {
|
|||||||
} else if (req.path.endsWith('stats')) {
|
} else if (req.path.endsWith('stats')) {
|
||||||
if (config['modules']['hit_counter']) {
|
if (config['modules']['hit_counter']) {
|
||||||
hc.read(articlePath, (data) => {
|
hc.read(articlePath, (data) => {
|
||||||
res.json({
|
res.json(data);
|
||||||
hits: data.hits,
|
|
||||||
visitors: data.visitors,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
showError(req, res, 404);
|
showError(req, res, 404);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hc.count(req, articlePath, () => {
|
hc.count(req, articlePath, req.isRobot, () => {
|
||||||
renderer.render(article.realPath, (err, html) => {
|
renderer.render(article.realPath, (err, html) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(cons.error, `failed to render article ${req.path} : ${err}`);
|
console.log(cons.error, `failed to render article ${req.path} : ${err}`);
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
const https = require('https');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
module.exports = (config) => {
|
||||||
|
const _this = {
|
||||||
|
status: {
|
||||||
|
FETCH_OK: 1,
|
||||||
|
FETCH_ERROR: 2,
|
||||||
|
READ_OK: 3,
|
||||||
|
READ_ERROR: 4,
|
||||||
|
},
|
||||||
|
count: [],
|
||||||
|
regex: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchList = (cb) => {
|
||||||
|
https.get(config['robots']['list_url'], (res) => {
|
||||||
|
if (res.statusCode !== 200) {
|
||||||
|
cb(res.statusCode);
|
||||||
|
} else {
|
||||||
|
const file = fs.createWriteStream(config['robots']['list_file']);
|
||||||
|
res.pipe(file);
|
||||||
|
file.on('finish', () => {
|
||||||
|
file.close(cb);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).on('error', (err) => {
|
||||||
|
cb(err.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const readFile = (cb) => {
|
||||||
|
fs.readFile(config['robots']['list_file'], { encoding: 'utf-8' }, (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
cb(err, undefined);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
cb(undefined, JSON.parse(data));
|
||||||
|
} catch (err) {
|
||||||
|
cb(err, undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.load = (cb) => {
|
||||||
|
fetchList((err) => {
|
||||||
|
cb(err ? _this.status.FETCH_ERROR : _this.status.FETCH_OK, err);
|
||||||
|
readFile((err, data) => {
|
||||||
|
if (!err) {
|
||||||
|
_this.count = data.length;
|
||||||
|
_this.regex = new RegExp('(' + data.filter(v => v['pattern']).map(v => v['pattern'])
|
||||||
|
.join('|') + ')');
|
||||||
|
}
|
||||||
|
cb(err ? _this.status.READ_ERROR : _this.status.READ_OK, err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.handle = (req, res, next) => {
|
||||||
|
req.isRobot = !!((req.headers['user-agent'] || '').match(_this.regex));
|
||||||
|
next();
|
||||||
|
};
|
||||||
|
|
||||||
|
return _this;
|
||||||
|
};
|
||||||
@@ -63,6 +63,10 @@
|
|||||||
"hit_counter": {
|
"hit_counter": {
|
||||||
"unique_visitor_timeout": 7200000
|
"unique_visitor_timeout": 7200000
|
||||||
},
|
},
|
||||||
|
"robots": {
|
||||||
|
"list_url": "https://raw.githubusercontent.com/atmire/COUNTER-Robots/master/COUNTER_Robots_list.json",
|
||||||
|
"list_file": "robots_list.json"
|
||||||
|
},
|
||||||
"redis": {
|
"redis": {
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
"port": 6379
|
"port": 6379
|
||||||
|
|||||||
+26
-8
@@ -8,15 +8,15 @@ module.exports = (config, onConnect, onError) => {
|
|||||||
|
|
||||||
const visitors = {};
|
const visitors = {};
|
||||||
|
|
||||||
const count = (req, path, cb) => {
|
const count = (req, path, disable, cb) => {
|
||||||
if (!client.connected) {
|
if (!client.connected || disable) {
|
||||||
cb();
|
cb();
|
||||||
} else {
|
} else {
|
||||||
const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
||||||
const key = path + ':' + ip;
|
visitors[path] = (visitors[path] || {});
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const isNewVisitor = (now - (visitors[key] || 0)) > config['hit_counter']['unique_visitor_timeout'];
|
const isNewVisitor = (now - (visitors[path][ip] || 0)) > config['hit_counter']['unique_visitor_timeout'];
|
||||||
visitors[key] = now;
|
visitors[path][ip] = now;
|
||||||
client
|
client
|
||||||
.multi()
|
.multi()
|
||||||
.hincrby(path, 'h', 1)
|
.hincrby(path, 'h', 1)
|
||||||
@@ -25,17 +25,35 @@ module.exports = (config, onConnect, onError) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const cleanVisitors = (path) => {
|
||||||
|
visitors[path] = (visitors[path] || {});
|
||||||
|
const now = Date.now();
|
||||||
|
let count = 0;
|
||||||
|
for (let ip in visitors[path]) {
|
||||||
|
if ((now - visitors[path][ip]) > config['hit_counter']['unique_visitor_timeout']) {
|
||||||
|
delete visitors[path][ip];
|
||||||
|
} else {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
};
|
||||||
|
|
||||||
const read = (path, cb) => {
|
const read = (path, cb) => {
|
||||||
if (!client.connected) {
|
if (!client.connected) {
|
||||||
cb({
|
cb({
|
||||||
|
path: path,
|
||||||
hits: 0,
|
hits: 0,
|
||||||
visitors: 0,
|
total_visitors: 0,
|
||||||
|
current_visitors: cleanVisitors(path),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
client.hgetall(path, (_, value) => {
|
client.hgetall(path, (_, value) => {
|
||||||
cb({
|
cb({
|
||||||
hits: value ? value.h || 0 : 0,
|
path: path,
|
||||||
visitors: value ? value.v || 0 : 0,
|
hits: value ? parseInt(value.h) || 0 : 0,
|
||||||
|
total_visitors: value ? parseInt(value.v) || 0 : 0,
|
||||||
|
current_visitors: cleanVisitors(path),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+110
-49
@@ -197,22 +197,6 @@ describe('Test root path', () => {
|
|||||||
});
|
});
|
||||||
}, fail);
|
}, fail);
|
||||||
});
|
});
|
||||||
test('404 index no stats', (done) => {
|
|
||||||
request(app).get('/stats')
|
|
||||||
.then((response) => {
|
|
||||||
expect(response.statusCode).toBe(404);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
test('200 index stats', (done) => {
|
|
||||||
config['modules']['hit_counter'] = true;
|
|
||||||
request(app).get('/stats')
|
|
||||||
.then((response) => {
|
|
||||||
expect(response.statusCode).toBe(200);
|
|
||||||
expect(response.body).toEqual({ hits: 0, visitors: 0 });
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Test RSS feed', () => {
|
describe('Test RSS feed', () => {
|
||||||
@@ -451,41 +435,8 @@ describe('Test articles rendering', () => {
|
|||||||
});
|
});
|
||||||
}, fail);
|
}, fail);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('404 article no stats', (done) => {
|
|
||||||
utils.createEmptyDirs([ path.join(dataDir, '2019', '05', '05') ]);
|
|
||||||
utils.createEmptyFiles([
|
|
||||||
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
|
||||||
path.join(dataDir, testTemplate),
|
|
||||||
]);
|
|
||||||
app.reload(() => {
|
|
||||||
request(app).get('/2019/05/05/hello/stats')
|
|
||||||
.then((response) => {
|
|
||||||
expect(response.statusCode).toBe(404);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('200 index stats', (done) => {
|
|
||||||
config['modules']['hit_counter'] = true;
|
|
||||||
utils.createEmptyDirs([ path.join(dataDir, '2019', '05', '05') ]);
|
|
||||||
utils.createEmptyFiles([
|
|
||||||
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
|
||||||
path.join(dataDir, testTemplate),
|
|
||||||
]);
|
|
||||||
app.reload(() => {
|
|
||||||
request(app).get('/2019/05/05/anything/stats')
|
|
||||||
.then((response) => {
|
|
||||||
expect(response.statusCode).toBe(200);
|
|
||||||
expect(response.body).toEqual({ hits: 0, visitors: 0 });
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('Test static files', () => {
|
describe('Test static files', () => {
|
||||||
test('404 invalid file no error page', (done) => {
|
test('404 invalid file no error page', (done) => {
|
||||||
request(app).get('/somefile.txt')
|
request(app).get('/somefile.txt')
|
||||||
@@ -566,3 +517,113 @@ describe('Test other requests', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('Test stats', () => {
|
||||||
|
test('404 index no stats', (done) => {
|
||||||
|
request(app).get('/stats')
|
||||||
|
.then((response) => {
|
||||||
|
expect(response.statusCode).toBe(404);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('200 index stats', (done) => {
|
||||||
|
config['modules']['hit_counter'] = true;
|
||||||
|
request(app).get('/stats')
|
||||||
|
.then((response) => {
|
||||||
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.body).toEqual({
|
||||||
|
path: '/',
|
||||||
|
hits: 0,
|
||||||
|
total_visitors: 0,
|
||||||
|
current_visitors: 0,
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('200 index stats all no article', (done) => {
|
||||||
|
config['modules']['hit_counter'] = true;
|
||||||
|
app.reload(() => {
|
||||||
|
request(app).get('/stats?all=true')
|
||||||
|
.then((response) => {
|
||||||
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.body).toEqual([
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
hits: 0,
|
||||||
|
total_visitors: 0,
|
||||||
|
current_visitors: 0,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('200 index stats all 2 article 1 drafted', (done) => {
|
||||||
|
config['modules']['hit_counter'] = true;
|
||||||
|
utils.createEmptyDirs([
|
||||||
|
path.join(dataDir, '2019', '05', '05'),
|
||||||
|
path.join(dataDir, '2019', '04', '05'),
|
||||||
|
]);
|
||||||
|
utils.createEmptyFiles([
|
||||||
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
|
path.join(dataDir, '2019', '04', '05', 'draft.md'),
|
||||||
|
]);
|
||||||
|
app.reload(() => {
|
||||||
|
request(app).get('/stats?all=true')
|
||||||
|
.then((response) => {
|
||||||
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.body).toEqual([
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
hits: 0,
|
||||||
|
total_visitors: 0,
|
||||||
|
current_visitors: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '2019/05/05',
|
||||||
|
hits: 0,
|
||||||
|
total_visitors: 0,
|
||||||
|
current_visitors: 0,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('404 article no stats', (done) => {
|
||||||
|
utils.createEmptyDirs([ path.join(dataDir, '2019', '05', '05') ]);
|
||||||
|
utils.createEmptyFiles([
|
||||||
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
|
path.join(dataDir, testTemplate),
|
||||||
|
]);
|
||||||
|
app.reload(() => {
|
||||||
|
request(app).get('/2019/05/05/hello/stats')
|
||||||
|
.then((response) => {
|
||||||
|
expect(response.statusCode).toBe(404);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('200 article stats', (done) => {
|
||||||
|
config['modules']['hit_counter'] = true;
|
||||||
|
utils.createEmptyDirs([ path.join(dataDir, '2019', '05', '05') ]);
|
||||||
|
utils.createEmptyFiles([
|
||||||
|
path.join(dataDir, '2019', '05', '05', 'index.md'),
|
||||||
|
path.join(dataDir, testTemplate),
|
||||||
|
]);
|
||||||
|
app.reload(() => {
|
||||||
|
request(app).get('/2019/05/05/anything/stats')
|
||||||
|
.then((response) => {
|
||||||
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.body).toEqual({
|
||||||
|
path: '2019/05/05',
|
||||||
|
hits: 0,
|
||||||
|
total_visitors: 0,
|
||||||
|
current_visitors: 0,
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const utils = require('./test_utils');
|
||||||
|
|
||||||
|
const dataDir = 'test_data';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
robots: {
|
||||||
|
list_url: '',
|
||||||
|
list_file: `${dataDir}/robots_list.json`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
utils.deleteFolderSync(dataDir);
|
||||||
|
fs.mkdirSync(dataDir);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
if (fs.existsSync(dataDir)) {
|
||||||
|
utils.deleteFolderSync(dataDir);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const botDetector = require('../src/bot_detector')(config);
|
||||||
|
|
||||||
|
describe('load()', () => {
|
||||||
|
test('success', (done) => {
|
||||||
|
config.robots = {
|
||||||
|
list_url: 'https://raw.githubusercontent.com/atmire/COUNTER-Robots/master/COUNTER_Robots_list.json',
|
||||||
|
list_file: `${dataDir}/robots_list_success.json`,
|
||||||
|
};
|
||||||
|
let count = 0;
|
||||||
|
botDetector.load((status, err) => {
|
||||||
|
expect(err).not.toBeDefined();
|
||||||
|
expect(status).toBe(count === 0 ? botDetector.status.FETCH_OK : botDetector.status.READ_OK);
|
||||||
|
if (count > 0) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('fetch and file failure', (done) => {
|
||||||
|
let count = 0;
|
||||||
|
config.robots = {
|
||||||
|
list_url: 'https://blog.klemek.fr/invalid.json',
|
||||||
|
list_file: `${dataDir}/robots_list_fail_1.json`,
|
||||||
|
};
|
||||||
|
botDetector.load((status) => {
|
||||||
|
expect(status).toBe(count === 0 ? botDetector.status.FETCH_ERROR : botDetector.status.READ_ERROR);
|
||||||
|
if (count > 0) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('fetch failure and file ok', (done) => {
|
||||||
|
let count = 0;
|
||||||
|
config.robots = {
|
||||||
|
list_url: 'https://blog.klemek.fr/invalid.json',
|
||||||
|
list_file: `${dataDir}/robots_list_fail_2.json`,
|
||||||
|
};
|
||||||
|
fs.writeFile(config.robots.list_file, '[]\n', { encoding: 'utf-8' }, () => {
|
||||||
|
botDetector.load((status) => {
|
||||||
|
expect(status).toBe(count === 0 ? botDetector.status.FETCH_ERROR : botDetector.status.READ_OK);
|
||||||
|
if (count > 0) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('handle()', () => {
|
||||||
|
beforeAll((done) => {
|
||||||
|
config.robots = {
|
||||||
|
list_url: 'https://blog.klemek.fr/invalid.json',
|
||||||
|
list_file: `${dataDir}/robots_list_fake.json`,
|
||||||
|
};
|
||||||
|
fs.writeFile(config.robots.list_file, '[{"pattern":"bot"}]\n', { encoding: 'utf-8' }, () => {
|
||||||
|
botDetector.load((status) => {
|
||||||
|
if (status !== botDetector.status.FETCH_ERROR) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('not bot', (done) => {
|
||||||
|
const req = {
|
||||||
|
headers: {
|
||||||
|
'user-agent': 'my user agent',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
botDetector.handle(req, null, () => {
|
||||||
|
expect(req.isRobot).toBeFalsy();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('bot', (done) => {
|
||||||
|
const req = {
|
||||||
|
headers: {
|
||||||
|
'user-agent': 'bot',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
botDetector.handle(req, null, () => {
|
||||||
|
expect(req.isRobot).toBeTruthy();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
+51
-23
@@ -37,14 +37,21 @@ test('options passed to redis', () => {
|
|||||||
expect(mockClient.options).toEqual(config['redis']);
|
expect(mockClient.options).toEqual(config['redis']);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('read()', () => {
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockClient.hgetall = (_, cb) => {
|
mockClient.hgetall = (_, cb) => {
|
||||||
cb();
|
cb();
|
||||||
};
|
};
|
||||||
});
|
mockClient.multi = () => mockClient;
|
||||||
|
mockClient.hincrby = () => mockClient;
|
||||||
|
mockClient.exec = (cb) => {
|
||||||
|
cb();
|
||||||
|
};
|
||||||
|
config['hit_counter']['unique_visitor_timeout'] = -1;
|
||||||
|
});
|
||||||
|
|
||||||
test('read path', (done) => {
|
describe('read()', () => {
|
||||||
|
test('normal', (done) => {
|
||||||
mockClient.hgetall = (path, cb) => {
|
mockClient.hgetall = (path, cb) => {
|
||||||
expect(path).toBe('/test/path/');
|
expect(path).toBe('/test/path/');
|
||||||
cb(undefined, { h: 12, v: 34 });
|
cb(undefined, { h: 12, v: 34 });
|
||||||
@@ -52,12 +59,13 @@ describe('read()', () => {
|
|||||||
hc.read('/test/path/', (data) => {
|
hc.read('/test/path/', (data) => {
|
||||||
expect(data).toBeDefined();
|
expect(data).toBeDefined();
|
||||||
expect(data.hits).toBe(12);
|
expect(data.hits).toBe(12);
|
||||||
expect(data.visitors).toBe(34);
|
expect(data.total_visitors).toBe(34);
|
||||||
|
expect(data.current_visitors).toBe(0);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('read path with error', (done) => {
|
test('with error', (done) => {
|
||||||
mockClient.hgetall = (path, cb) => {
|
mockClient.hgetall = (path, cb) => {
|
||||||
expect(path).toBe('/test/path/');
|
expect(path).toBe('/test/path/');
|
||||||
cb('error', undefined);
|
cb('error', undefined);
|
||||||
@@ -65,12 +73,13 @@ describe('read()', () => {
|
|||||||
hc.read('/test/path/', (data) => {
|
hc.read('/test/path/', (data) => {
|
||||||
expect(data).toBeDefined();
|
expect(data).toBeDefined();
|
||||||
expect(data.hits).toBe(0);
|
expect(data.hits).toBe(0);
|
||||||
expect(data.visitors).toBe(0);
|
expect(data.total_visitors).toBe(0);
|
||||||
|
expect(data.current_visitors).toBe(0);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('read path with error 2', (done) => {
|
test('with error 2', (done) => {
|
||||||
mockClient.hgetall = (path, cb) => {
|
mockClient.hgetall = (path, cb) => {
|
||||||
expect(path).toBe('/test/path/');
|
expect(path).toBe('/test/path/');
|
||||||
cb(undefined, {});
|
cb(undefined, {});
|
||||||
@@ -78,22 +87,41 @@ describe('read()', () => {
|
|||||||
hc.read('/test/path/', (data) => {
|
hc.read('/test/path/', (data) => {
|
||||||
expect(data).toBeDefined();
|
expect(data).toBeDefined();
|
||||||
expect(data.hits).toBe(0);
|
expect(data.hits).toBe(0);
|
||||||
expect(data.visitors).toBe(0);
|
expect(data.total_visitors).toBe(0);
|
||||||
|
expect(data.current_visitors).toBe(0);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('1 visitor', (done) => {
|
||||||
|
config['hit_counter']['unique_visitor_timeout'] = 1000;
|
||||||
|
hc.count({
|
||||||
|
headers: {},
|
||||||
|
connection: { remoteAddress: 'test1' },
|
||||||
|
}, '/test/path/5', false, () => {
|
||||||
|
hc.read('/test/path/5', (data) => {
|
||||||
|
expect(data).toBeDefined();
|
||||||
|
expect(data.current_visitors).toBe(1);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('cleaned old visitor', (done) => {
|
||||||
|
hc.count({
|
||||||
|
headers: {},
|
||||||
|
connection: { remoteAddress: 'test1' },
|
||||||
|
}, '/test/path/5', false, () => {
|
||||||
|
hc.read('/test/path/5', (data) => {
|
||||||
|
expect(data).toBeDefined();
|
||||||
|
expect(data.current_visitors).toBe(0);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('count()', () => {
|
describe('count()', () => {
|
||||||
beforeEach(() => {
|
|
||||||
mockClient.multi = () => mockClient;
|
|
||||||
mockClient.hincrby = () => mockClient;
|
|
||||||
mockClient.exec = (cb) => {
|
|
||||||
cb();
|
|
||||||
};
|
|
||||||
config['hit_counter']['unique_visitor_timeout'] = -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
test('simple visit', (done) => {
|
test('simple visit', (done) => {
|
||||||
let multiCalled = false;
|
let multiCalled = false;
|
||||||
let execCalled = false;
|
let execCalled = false;
|
||||||
@@ -117,7 +145,7 @@ describe('count()', () => {
|
|||||||
hc.count({
|
hc.count({
|
||||||
headers: {},
|
headers: {},
|
||||||
connection: { remoteAddress: 'test1' },
|
connection: { remoteAddress: 'test1' },
|
||||||
}, '/test/path/1', () => {
|
}, '/test/path/1', false, () => {
|
||||||
expect(multiCalled).toBeTruthy();
|
expect(multiCalled).toBeTruthy();
|
||||||
expect(hincrbyCalls).toEqual([
|
expect(hincrbyCalls).toEqual([
|
||||||
[
|
[
|
||||||
@@ -149,11 +177,11 @@ describe('count()', () => {
|
|||||||
hc.count({
|
hc.count({
|
||||||
headers: {},
|
headers: {},
|
||||||
connection: { remoteAddress: 'test2' },
|
connection: { remoteAddress: 'test2' },
|
||||||
}, '/test/path/2', () => {
|
}, '/test/path/2', false, () => {
|
||||||
hc.count({
|
hc.count({
|
||||||
headers: {},
|
headers: {},
|
||||||
connection: { remoteAddress: 'test2' },
|
connection: { remoteAddress: 'test2' },
|
||||||
}, '/test/path/2', () => {
|
}, '/test/path/2', false, () => {
|
||||||
expect(hincrbyCalls).toEqual([
|
expect(hincrbyCalls).toEqual([
|
||||||
[
|
[
|
||||||
'/test/path/2',
|
'/test/path/2',
|
||||||
@@ -195,11 +223,11 @@ describe('count()', () => {
|
|||||||
hc.count({
|
hc.count({
|
||||||
headers: {},
|
headers: {},
|
||||||
connection: { remoteAddress: 'test3' },
|
connection: { remoteAddress: 'test3' },
|
||||||
}, '/test/path/3', () => {
|
}, '/test/path/3', false, () => {
|
||||||
hc.count({
|
hc.count({
|
||||||
headers: {},
|
headers: {},
|
||||||
connection: { remoteAddress: 'test3' },
|
connection: { remoteAddress: 'test3' },
|
||||||
}, '/test/path/3', () => {
|
}, '/test/path/3', false, () => {
|
||||||
expect(hincrbyCalls).toEqual([
|
expect(hincrbyCalls).toEqual([
|
||||||
[
|
[
|
||||||
'/test/path/3',
|
'/test/path/3',
|
||||||
|
|||||||
Reference in New Issue
Block a user