Skip to content

Commit

Permalink
Move to node-fetch & code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AtlasTheBot committed Oct 3, 2018
1 parent 22084b1 commit 41ad7a8
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 391 deletions.
305 changes: 0 additions & 305 deletions .sample.js

This file was deleted.

2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//@ts-check
// Declare the dependencies
const snekfetch = require('snekfetch')

const Constants = require('./src/Constants.js')
const { BooruError } = Constants
const Utils = require('./src/Utils.js')
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"homepage": "https://github.com/AtlasTheBot/booru#readme",
"dependencies": {
"snekfetch": "^3.6.4",
"node-fetch": "^2.2.0",
"xml2js": "^0.4.17"
}
}
8 changes: 6 additions & 2 deletions src/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
=> .userAgent
=> .searchURI(site, tags, limit)
*/
const Site = require('./structures/Site.js')
const sites = require('./sites.json')
const pkg = require('../package.json')

Expand Down Expand Up @@ -50,7 +51,7 @@ module.exports.BooruError = BooruError
* The user-agent to use for searches
* @private
*/
module.exports.userAgent = `Booru v${pkg.version}, a node package for booru searching (by AtlasTheBot)`
module.exports.userAgent = `booru/${pkg.version} (+https://github.com/AtlasTheBot/booru)`

/**
* Create a full uri to search with
Expand Down Expand Up @@ -94,5 +95,8 @@ function expandTags(tags) {
* @private
*/
module.exports.defaultOptions = {
headers: { 'User-Agent': module.exports.userAgent }
headers: {
'Accept': 'application/json, application/xml;q=0.9, */*;q=0.8',
'User-Agent': module.exports.userAgent
}
}
Loading

0 comments on commit 41ad7a8

Please sign in to comment.