-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #500 from dwyl/contact-form-spam-#487
Resolve Contact form `SPAM` #487
- Loading branch information
Showing
18 changed files
with
160 additions
and
3,715 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "07:00" | ||
timezone: Europe/London |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x, 14.x, 16.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
# - run: npm run build --if-present | ||
- run: npm test | ||
# - name: Upload coverage to Codecov | ||
# uses: codecov/codecov-action@v1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
'use strict'; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var http_request = require('./http_request'); | ||
var cheerio = require('cheerio'); // Server-side JQuery. v. useful for scraping! | ||
|
||
// Adding Colors to Terminal *Without* a Library/Module | ||
var bgRedBlack = '\x1b[41m\x1b[30m'; | ||
var bgGreenBlack = '\x1b[42m\x1b[30m'; | ||
var RESET = '\x1b[0m'; // see: https://stackoverflow.com/a/41407246/1148249 | ||
// var bgRedBlack = '\x1b[41m\x1b[30m'; | ||
// var bgGreenBlack = '\x1b[42m\x1b[30m'; | ||
// var RESET = '\x1b[0m'; // see: https://stackoverflow.com/a/41407246/1148249 | ||
|
||
var URL = 'https://github.com/dwyl/home/blob/master/README.md'; | ||
|
||
http_request(URL, function (status, html) { | ||
// eslint forces us to have all vars declared before logic ... | ||
var $ = cheerio.load(html); // load the HTML of the rendered markdown "page" | ||
var body = $('#readme').html(); // parse the contents of #readme (article) | ||
var css = fs.readFileSync(path.resolve(__dirname, './style.css'), 'utf8'); | ||
var template = fs.readFileSync(path.resolve(__dirname, './template.html'), | ||
'utf8'); // rudimentary "template" with string subtitution. | ||
var out = template.replace('{css}', css).replace('{content}', body); | ||
|
||
if (status !== 200 || !html) { | ||
console.log(bgRedBlack, | ||
" - - - GitHub Scraper FAIL >> " + URL + " - - - ", RESET); | ||
process.exit(); | ||
} | ||
else { | ||
var $ = cheerio.load(html); // load the HTML of the rendered markdown "page" | ||
var body = $('#readme').html() // parse the contents of #readme (article) | ||
var css = fs.readFileSync(path.resolve(__dirname, './style.css'), 'utf8'); | ||
var template = fs.readFileSync(path.resolve(__dirname, './template.html'), | ||
'utf8'); // rudimentary "template" with string subtitution. | ||
var out = template.replace('{css}', css).replace('{content}', body); | ||
// console.log(bgRedBlack, | ||
// " - - - GitHub Scraper FAIL >> " + URL + " - - - ", RESET); | ||
// process.exit(); | ||
} else { | ||
fs.writeFileSync('./home.html', out, 'utf8'); // save the file | ||
console.log(bgGreenBlack, 'done.', RESET); | ||
// console.log(bgGreenBlack, 'done.', RESET); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.