Skip to content

Commit

Permalink
Merge pull request #388 from spencermountain/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
spencermountain committed Sep 10, 2020
2 parents 94413c5 + 26e6704 commit ac8795a
Show file tree
Hide file tree
Showing 12 changed files with 571 additions and 333 deletions.
16 changes: 12 additions & 4 deletions builds/wtf_wikipedia-client.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* wtf_wikipedia 8.4.0 MIT */
/* wtf_wikipedia 8.5.0 MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.wtf = factory());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.wtf = factory());
}(this, (function () { 'use strict';

var parseUrl = function parseUrl(url) {
Expand Down Expand Up @@ -8731,13 +8731,21 @@

var makeHeaders = function makeHeaders(options) {
var agent = options.userAgent || options['User-Agent'] || options['Api-User-Agent'] || 'User of the wtf_wikipedia library';
var origin;

if (options.noOrigin) {
origin = '';
} else {
origin = options.origin || options.Origin || '*';
}

var opts = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Api-User-Agent': agent,
'User-Agent': agent,
Origin: '*'
Origin: origin
},
redirect: 'follow'
};
Expand Down Expand Up @@ -8956,7 +8964,7 @@

var category = fetchCategory;

var _version = '8.4.0';
var _version = '8.5.0';

var wtf = function wtf(wiki, options) {
return _01Document(wiki, options);
Expand Down
2 changes: 1 addition & 1 deletion builds/wtf_wikipedia-client.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/wtf_wikipedia-client.mjs

Large diffs are not rendered by default.

22 changes: 16 additions & 6 deletions builds/wtf_wikipedia.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* wtf_wikipedia 8.4.0 MIT */
/* wtf_wikipedia 8.5.0 MIT */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('https')) :
typeof define === 'function' && define.amd ? define(['https'], factory) :
(global = global || self, global.wtf = factory(global.https));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.wtf = factory(global.https));
}(this, (function (https) { 'use strict';

https = https && Object.prototype.hasOwnProperty.call(https, 'default') ? https['default'] : https;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var https__default = /*#__PURE__*/_interopDefaultLegacy(https);

var parseUrl = function parseUrl(url) {
var parsed = new URL(url); //eslint-disable-line
Expand Down Expand Up @@ -8724,7 +8726,7 @@
var request = function request(url) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return new Promise(function (resolve, reject) {
https.get(url, opts, function (resp) {
https__default['default'].get(url, opts, function (resp) {
var data = ''; // A chunk of data has been recieved.

resp.on('data', function (chunk) {
Expand All @@ -8749,13 +8751,21 @@

var makeHeaders = function makeHeaders(options) {
var agent = options.userAgent || options['User-Agent'] || options['Api-User-Agent'] || 'User of the wtf_wikipedia library';
var origin;

if (options.noOrigin) {
origin = '';
} else {
origin = options.origin || options.Origin || '*';
}

var opts = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Api-User-Agent': agent,
'User-Agent': agent,
Origin: '*'
Origin: origin
},
redirect: 'follow'
};
Expand Down Expand Up @@ -8974,7 +8984,7 @@

var category = fetchCategory;

var _version = '8.4.0';
var _version = '8.5.0';

var wtf = function wtf(wiki, options) {
return _01Document(wiki, options);
Expand Down
14 changes: 11 additions & 3 deletions builds/wtf_wikipedia.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* wtf_wikipedia 8.4.0 MIT */
/* wtf_wikipedia 8.5.0 MIT */
import https from 'https';

var parseUrl = function parseUrl(url) {
Expand Down Expand Up @@ -8743,13 +8743,21 @@ var server$1 = request;

var makeHeaders = function makeHeaders(options) {
var agent = options.userAgent || options['User-Agent'] || options['Api-User-Agent'] || 'User of the wtf_wikipedia library';
var origin;

if (options.noOrigin) {
origin = '';
} else {
origin = options.origin || options.Origin || '*';
}

var opts = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Api-User-Agent': agent,
'User-Agent': agent,
Origin: '*'
Origin: origin
},
redirect: 'follow'
};
Expand Down Expand Up @@ -8968,7 +8976,7 @@ var fetchCategory = function fetchCategory(category, lang, options) {

var category = fetchCategory;

var _version = '8.4.0';
var _version = '8.5.0';

var wtf = function wtf(wiki, options) {
return _01Document(wiki, options);
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

#### [unreleased]

#### 8.5.0

- fix for cross-domain 3rd-party wikis
- improved support for fetching non-wikipedia domains

#### 8.4.0

- new `wikidata()` method
Expand Down
Loading

0 comments on commit ac8795a

Please sign in to comment.