Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hltv

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hltv - npm Package Compare versions

Comparing version 2.17.3 to 2.18.0

10

lib/config.d.ts

@@ -0,1 +1,4 @@

/// <reference types="node" />
import { Agent as HttpsAgent } from 'https';
import { Agent as HttpAgent } from 'http';
export interface HLTVConfig {

@@ -5,7 +8,4 @@ hltvUrl?: string;

loadPage?: (url: string) => Promise<string>;
httpAgent?: HttpsAgent | HttpAgent;
}
export declare const defaultConfig: {
hltvUrl: string;
hltvStaticUrl: string;
loadPage: (url: string) => Promise<string>;
};
export declare const defaultConfig: HLTVConfig;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var mappers_1 = require("./utils/mappers");
var https_1 = require("https");
var defaultAgent = new https_1.Agent();
exports.defaultConfig = {
hltvUrl: 'https://www.hltv.org',
hltvStaticUrl: 'https://static.hltv.org',
loadPage: mappers_1.defaultLoadPage
httpAgent: defaultAgent,
loadPage: mappers_1.defaultLoadPage(defaultAgent)
};

@@ -6,5 +6,5 @@ import { ScoreboardUpdate } from '../models/ScoreboardUpdate';

id: number;
onScoreboardUpdate?: (data: ScoreboardUpdate) => any;
onLogUpdate?: (data: LogUpdate) => any;
onFullLogUpdate?: (data: unknown) => any;
onScoreboardUpdate?: (data: ScoreboardUpdate, done: () => void) => any;
onLogUpdate?: (data: LogUpdate, done: () => void) => any;
onFullLogUpdate?: (data: unknown, done: () => void) => any;
onConnect?: () => any;

@@ -11,0 +11,0 @@ onDisconnect?: () => any;

@@ -13,3 +13,5 @@ "use strict";

var matchId = $('#scoreboardElement').attr('data-scorebot-id');
var socket = io.connect(url);
var socket = io.connect(url, {
agent: !config.httpAgent
});
var initObject = JSON.stringify({

@@ -20,2 +22,3 @@ token: '',

socket.on('connect', function () {
var done = function () { return socket.close(); };
if (onConnect) {

@@ -27,3 +30,3 @@ onConnect();

if (onScoreboardUpdate) {
onScoreboardUpdate(data);
onScoreboardUpdate(data, done);
}

@@ -33,3 +36,3 @@ });

if (onLogUpdate) {
onLogUpdate(JSON.parse(data));
onLogUpdate(JSON.parse(data), done);
}

@@ -39,3 +42,3 @@ });

if (onFullLogUpdate) {
onFullLogUpdate(JSON.parse(data));
onFullLogUpdate(JSON.parse(data), done);
}

@@ -42,0 +45,0 @@ });

@@ -38,2 +38,3 @@ "use strict";

var getEvents_1 = require("./endpoints/getEvents");
var mappers_1 = require("./utils/mappers");
var HLTVFactory = (function () {

@@ -60,2 +61,17 @@ function HLTVFactory(config) {

this.getPlayerRanking = getPlayerRanking_1.getPlayerRanking(this.config);
if (!config.hltvStaticUrl) {
config.hltvStaticUrl = config_1.defaultConfig.hltvStaticUrl;
}
if (!config.hltvUrl) {
config.hltvUrl = config_1.defaultConfig.hltvUrl;
}
if (config.httpAgent && !config.loadPage) {
config.loadPage = mappers_1.defaultLoadPage(config.httpAgent);
}
if (!config.httpAgent) {
config.httpAgent = config_1.defaultConfig.httpAgent;
}
if (!config.loadPage) {
config.loadPage = config_1.defaultConfig.loadPage;
}
}

@@ -62,0 +78,0 @@ HLTVFactory.prototype.createInstance = function (config) {

@@ -0,1 +1,2 @@

/// <reference types="node" />
/// <reference types="cheerio" />

@@ -7,3 +8,5 @@ import { Team } from '../models/Team';

import { MapSlug } from '../enums/MapSlug';
export declare const defaultLoadPage: (url: string) => Promise<string>;
import { Agent as HttpsAgent } from 'https';
import { Agent as HttpAgent } from 'http';
export declare const defaultLoadPage: (httpAgent: HttpsAgent | HttpAgent | undefined) => (url: string) => Promise<string>;
export declare const fetchPage: (url: string, loadPage?: ((url: string) => Promise<string>) | undefined) => Promise<CheerioStatic>;

@@ -10,0 +13,0 @@ export declare const toArray: (elements: Cheerio) => Cheerio[];

@@ -44,7 +44,7 @@ "use strict";

var parsing_1 = require("../utils/parsing");
exports.defaultLoadPage = function (url) {
exports.defaultLoadPage = function (httpAgent) { return function (url) {
return new Promise(function (resolve) {
request.get(url, { gzip: true }, function (_, __, body) { return resolve(body); });
request.get(url, { gzip: true, agent: httpAgent }, function (_, __, body) { return resolve(body); });
});
};
}; };
exports.fetchPage = function (url, loadPage) { return __awaiter(void 0, void 0, void 0, function () {

@@ -51,0 +51,0 @@ var _a, _b;

{
"name": "hltv",
"version": "2.17.3",
"version": "2.18.0",
"description": "The unofficial HLTV Node.js API",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc