node-steam-totp
node-steam-totp copied to clipboard
fix bug proxy
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/steamcommunity/node_modules/steam-totp/index.js b/node_modules/steamcommunity/node_modules/steam-totp/index.js
index bf9e991..20477bd 100644
--- a/node_modules/steamcommunity/node_modules/steam-totp/index.js
+++ b/node_modules/steamcommunity/node_modules/steam-totp/index.js
@@ -2,6 +2,7 @@
require('@doctormckay/stats-reporter').setup(require('./package.json'));
var Crypto = require('crypto');
+const StdLib = require('@doctormckay/stdlib');
/**
* Returns the current local Unix time
@@ -18,9 +19,9 @@ exports.time = function(timeOffset) {
* @param {number} [timeOffset=0] - If you know how far off your clock is from the Steam servers, put the offset here in seconds
* @returns {string}
*/
-exports.generateAuthCode = exports.getAuthCode = function(secret, timeOffset) {
+exports.generateAuthCode = exports.getAuthCode = function(secret, timeOffset, httpProxy) {
if (typeof timeOffset === 'function') {
- exports.getTimeOffset(function(err, offset, latency) {
+ exports.getTimeOffset(httpProxy, function(err, offset, latency) {
if (err) {
timeOffset(err);
return;
@@ -92,7 +93,7 @@ exports.generateConfirmationKey = exports.getConfirmationKey = function(identity
return hmac.update(buffer).digest('base64');
};
-exports.getTimeOffset = function(callback) {
+exports.getTimeOffset = function(httpProxy, callback) {
var start = Date.now();
var req = require('https').request({
"hostname": "api.steampowered.com",
@@ -100,7 +101,8 @@ exports.getTimeOffset = function(callback) {
"method": "POST",
"headers": {
"Content-Length": 0
- }
+ },
+ "agent": httpProxy ? StdLib.HTTP.getProxyAgent(true, httpProxy) : undefined
}, function(res) {
if(res.statusCode != 200) {
callback(new Error("HTTP error " + res.statusCode));
This issue body was partially generated by patch-package.