mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2025-01-10 14:39:28 -07:00
Make certain fetchers environment-aware
This commit is contained in:
parent
ffbae32a55
commit
e13bd4e9f5
3 changed files with 28 additions and 7 deletions
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
const dns = require('dns')
|
const jsEnv = require("browser-or-node")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @module fetcher/dns
|
* @module fetcher/dns
|
||||||
|
@ -25,6 +25,13 @@ const dns = require('dns')
|
||||||
*/
|
*/
|
||||||
module.exports.timeout = 5000
|
module.exports.timeout = 5000
|
||||||
|
|
||||||
|
if (!jsEnv.isNode) {
|
||||||
|
module.exports.fn = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const dns = require('dns')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a fetch request
|
* Execute a fetch request
|
||||||
* @function
|
* @function
|
||||||
|
|
|
@ -13,8 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
const irc = require('irc-upd')
|
const jsEnv = require("browser-or-node")
|
||||||
const validator = require('validator')
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @module fetcher/irc
|
* @module fetcher/irc
|
||||||
|
@ -26,6 +25,14 @@ const validator = require('validator')
|
||||||
*/
|
*/
|
||||||
module.exports.timeout = 20000
|
module.exports.timeout = 20000
|
||||||
|
|
||||||
|
if (!jsEnv.isNode) {
|
||||||
|
module.exports.fn = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const irc = require('irc-upd')
|
||||||
|
const validator = require('validator')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a fetch request
|
* Execute a fetch request
|
||||||
* @function
|
* @function
|
||||||
|
|
|
@ -13,10 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
const jsdom = require('jsdom')
|
const jsEnv = require("browser-or-node")
|
||||||
const { client, xml } = require('@xmpp/client')
|
|
||||||
const debug = require('@xmpp/debug')
|
|
||||||
const validator = require('validator')
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @module fetcher/xmpp
|
* @module fetcher/xmpp
|
||||||
|
@ -28,6 +25,16 @@ const validator = require('validator')
|
||||||
*/
|
*/
|
||||||
module.exports.timeout = 5000
|
module.exports.timeout = 5000
|
||||||
|
|
||||||
|
if (!jsEnv.isNode) {
|
||||||
|
module.exports.fn = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const jsdom = require('jsdom')
|
||||||
|
const { client, xml } = require('@xmpp/client')
|
||||||
|
const debug = require('@xmpp/debug')
|
||||||
|
const validator = require('validator')
|
||||||
|
|
||||||
let xmpp = null,
|
let xmpp = null,
|
||||||
iqCaller = null
|
iqCaller = null
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue