code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
get tabs() { return {}; }
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
tabs
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
constructor(options) { this.options = options; }
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
constructor
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
get urlPattern() { return /^https:\/\/(www\.)?gitlab\.com/; }
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
urlPattern
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
get searchBoxSelector() { return '.form-input, input[id=search]'; }
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
searchBoxSelector
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
getTopMargin(element) { return getFixedSearchBoxTopMargin( document.querySelector('header.navbar'), element, ); }
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
getTopMargin
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
onChangedResults(callback) { const containers = document.querySelectorAll( '.projects-list, .groups-list, #content-body', ); const observer = new MutationObserver(async (mutationsList, observer) => { callback(true); }); for (const container of containers) { observer.observe(conta...
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
onChangedResults
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
getSearchResults() { const includedElements = [ { nodes: document.querySelectorAll('li.project-row h2 a'), containerSelector: (n) => n.closest('li.project-row'), highlightedElementSelector: (n) => n.closest('li.project-row'), highlightClass: 'wsn-gitlab-focused-group-row', ...
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
getSearchResults
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
get urlPattern() { return new RegExp(this.options.customGitlabUrl); }
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
urlPattern
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
getSearchEngine = (options) => { const searchEngines = [ new GoogleSearch(options), new BraveSearch(options), new StartPage(options), new YouTube(options), new GoogleScholar(options), new Amazon(options), new Github(options), new Gitlab(options), new CustomGitlab(options), ]; /...
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
getSearchEngine
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
getSearchEngine = (options) => { const searchEngines = [ new GoogleSearch(options), new BraveSearch(options), new StartPage(options), new YouTube(options), new GoogleScholar(options), new Amazon(options), new Github(options), new Gitlab(options), new CustomGitlab(options), ]; /...
Filter the results based on special properties @param {*} period, filter identifier. Accepted filter are : 'a' : all results 'h' : last hour 'd' : last day 'w' : last week 'm' : last month 'y' : last year 'v' : verbatim search null : toggle sort
getSearchEngine
javascript
infokiller/web-search-navigator
src/search_engines.js
https://github.com/infokiller/web-search-navigator/blob/master/src/search_engines.js
MIT
invoke(id, args) { if (id === undefined) { return } const obj = this.callbacks[id] if (obj && isFunction(obj.callback)) { obj.callback(args) if (!obj.keep) { delete this.callbacks[id] } } }
[Container] triggerCallback -> [Service] invoke @param {*} id @param {*} args
invoke
javascript
didi/dimina
fe/packages/common/src/core/callback.js
https://github.com/didi/dimina/blob/master/fe/packages/common/src/core/callback.js
Apache-2.0
remove(id) { if (id) { Object.keys(this.callbacks).forEach((k) => { if (id === k) { delete this.callbacks[k] } }) } else { Object.entries(this.callbacks).forEach(([k, v]) => { if (v.keep) { delete this.callbacks[k] } }) } }
[Container] triggerCallback -> [Service] invoke @param {*} id @param {*} args
remove
javascript
didi/dimina
fe/packages/common/src/core/callback.js
https://github.com/didi/dimina/blob/master/fe/packages/common/src/core/callback.js
Apache-2.0
function invokeAPI(apiName, { params, bridgeId }) { window.__message.invoke({ type: 'invokeAPI', target: 'container', body: { name: apiName, bridgeId, params, }, }) }
https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/event.html @param {*} methodName @param {*} param
invokeAPI
javascript
didi/dimina
fe/packages/components/src/common/events.js
https://github.com/didi/dimina/blob/master/fe/packages/components/src/common/events.js
Apache-2.0
function generateColorFromName(name) { // If name is empty, return a default color (Material Blue) if (!name || name.length === 0) { return '#2196F3' } // Use the hash code of the name as a seed for color generation let hash = 0 for (let i = 0; i < name.length; i++) { hash = ((hash << 5) - hash) + name.charC...
Generates a consistent color based on the name's hash code @param {string} name - The name to generate a color from @returns {string} - A hex color code
generateColorFromName
javascript
didi/dimina
fe/packages/container/src/services/index.js
https://github.com/didi/dimina/blob/master/fe/packages/container/src/services/index.js
Apache-2.0
function hsvToRgb(h, s, v) { let r, g, b const i = Math.floor(h / 60) const f = h / 60 - i const p = v * (1 - s) const q = v * (1 - f * s) const t = v * (1 - (1 - f) * s) /* eslint-disable style/max-statements-per-line */ switch (i % 6) { case 0: r = v; g = t; b = p; break case 1: r = q; g = v; b = p; brea...
Converts HSV color values to RGB @param {number} h - Hue (0-360) @param {number} s - Saturation (0-1) @param {number} v - Value (0-1) @returns {number[]} - Array of [r, g, b] values (0-255)
hsvToRgb
javascript
didi/dimina
fe/packages/container/src/services/index.js
https://github.com/didi/dimina/blob/master/fe/packages/container/src/services/index.js
Apache-2.0
function rgbToHex(r, g, b) { return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}` }
Converts RGB values to a hex color string @param {number} r - Red (0-255) @param {number} g - Green (0-255) @param {number} b - Blue (0-255) @returns {string} - Hex color code
rgbToHex
javascript
didi/dimina
fe/packages/container/src/services/index.js
https://github.com/didi/dimina/blob/master/fe/packages/container/src/services/index.js
Apache-2.0
function generateLogo(app) { const size = [60, 60] const cvs = document.createElement('canvas') cvs.setAttribute('width', size[0]) cvs.setAttribute('height', size[1]) const ctx = cvs.getContext('2d') // Use the new color generation function instead of random colors ctx.fillStyle = generateColorFromName(app.name...
Converts RGB values to a hex color string @param {number} r - Red (0-255) @param {number} g - Green (0-255) @param {number} b - Blue (0-255) @returns {string} - Hex color code
generateLogo
javascript
didi/dimina
fe/packages/container/src/services/index.js
https://github.com/didi/dimina/blob/master/fe/packages/container/src/services/index.js
Apache-2.0
setInitialData(initialData) { for (const [path, data] of Object.entries(initialData)) { if (!data) { continue } const module = this.staticModules[path] if (!module) { continue } module.setInitialData(data) } }
serviceResourceLoaded && renderResourceLoaded -> [Container]resourceLoaded -> [Service]resourceLoaded -> [Service]initialDataReady -> [Container]initialDataReady -> [Render]setInitialData @param {*} initialData
setInitialData
javascript
didi/dimina
fe/packages/render/src/core/loader.js
https://github.com/didi/dimina/blob/master/fe/packages/render/src/core/loader.js
Apache-2.0
getModuleByPath(path) { return this.staticModules[path] }
serviceResourceLoaded && renderResourceLoaded -> [Container]resourceLoaded -> [Service]resourceLoaded -> [Service]initialDataReady -> [Container]initialDataReady -> [Render]setInitialData @param {*} initialData
getModuleByPath
javascript
didi/dimina
fe/packages/render/src/core/loader.js
https://github.com/didi/dimina/blob/master/fe/packages/render/src/core/loader.js
Apache-2.0
isElementReady(element) { if (!element) { return false } const rect = element.getBoundingClientRect() return rect.height > 0 || rect.width > 0 }
https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.fields.html
isElementReady
javascript
didi/dimina
fe/packages/render/src/core/runtime.js
https://github.com/didi/dimina/blob/master/fe/packages/render/src/core/runtime.js
Apache-2.0
function getSystemInfo(opts) { return new Promise((resolve) => { resolve(invokeAPI('getSystemInfo', opts)) }) }
https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html
getSystemInfo
javascript
didi/dimina
fe/packages/service/src/api/core/base/system/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/base/system/index.js
Apache-2.0
function getSystemInfoSync() { return invokeAPI('getSystemInfoSync') }
https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html
getSystemInfoSync
javascript
didi/dimina
fe/packages/service/src/api/core/base/system/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/base/system/index.js
Apache-2.0
function getSystemInfoAsync(opts) { invokeAPI('getSystemInfoAsync', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html
getSystemInfoAsync
javascript
didi/dimina
fe/packages/service/src/api/core/base/system/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/base/system/index.js
Apache-2.0
function makePhoneCall(opts) { invokeAPI('makePhoneCall', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html
makePhoneCall
javascript
didi/dimina
fe/packages/service/src/api/core/device/phone/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/device/phone/index.js
Apache-2.0
function scanCode(opts) { invokeAPI('scanCode', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/device/scan/wx.scanCode.html
scanCode
javascript
didi/dimina
fe/packages/service/src/api/core/device/scan/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/device/scan/index.js
Apache-2.0
function login(opts) { invokeAPI('login', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html
login
javascript
didi/dimina
fe/packages/service/src/api/core/open-api/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/open-api/index.js
Apache-2.0
function setStorageSync(...opts) { invokeAPI('setStorageSync', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html
setStorageSync
javascript
didi/dimina
fe/packages/service/src/api/core/storage/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/storage/index.js
Apache-2.0
function removeStorageSync(...opts) { return invokeAPI('removeStorageSync', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html
removeStorageSync
javascript
didi/dimina
fe/packages/service/src/api/core/storage/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/storage/index.js
Apache-2.0
function setStorage(opts) { invokeAPI('setStorage', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html
setStorage
javascript
didi/dimina
fe/packages/service/src/api/core/storage/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/storage/index.js
Apache-2.0
function getStorage(opts) { invokeAPI('getStorage', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html
getStorage
javascript
didi/dimina
fe/packages/service/src/api/core/storage/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/storage/index.js
Apache-2.0
function removeStorage(opts) { invokeAPI('removeStorage', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html
removeStorage
javascript
didi/dimina
fe/packages/service/src/api/core/storage/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/storage/index.js
Apache-2.0
function getStorageInfoSync(...opts) { return invokeAPI('getStorageInfoSync', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfoSync.html
getStorageInfoSync
javascript
didi/dimina
fe/packages/service/src/api/core/storage/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/storage/index.js
Apache-2.0
function getStorageInfo(opts) { invokeAPI('getStorageInfo', opts) }
https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html
getStorageInfo
javascript
didi/dimina
fe/packages/service/src/api/core/storage/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/storage/index.js
Apache-2.0
selectViewport() { return new NodesRef(this, router.getPageInfo().id, '', true) }
@param {*} selector @param {*} moduleId @param {*} single @param {*} fields @param {*} callback
selectViewport
javascript
didi/dimina
fe/packages/service/src/api/core/wxml/selector-query/index.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/api/core/wxml/selector-query/index.js
Apache-2.0
constructor(moduleInfo, extraInfo) { this.moduleInfo = moduleInfo this.extraInfo = extraInfo this.type = ComponentModule.type this.isComponent = this.extraInfo.component this.behaviors = this.moduleInfo.behaviors this.usingComponents = this.extraInfo.usingComponents this.noReferenceData = filterData(this....
@param {{data: object, lifetimes: object, pageLifetimes: object, methods: object, options: object, properties: object}} moduleInfo
constructor
javascript
didi/dimina
fe/packages/service/src/instance/component/component-module.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/instance/component/component-module.js
Apache-2.0
getProps() { let props = serializeProps(this.moduleInfo.properties) if (Array.isArray(this.moduleInfo.externalClasses) && this.moduleInfo.externalClasses.length > 0) { if (!props) { props = {} } for (const externalClass of this.moduleInfo.externalClasses) { props[externalClass] = { type: ['s'...
@param {{data: object, lifetimes: object, pageLifetimes: object, methods: object, options: object, properties: object}} moduleInfo
getProps
javascript
didi/dimina
fe/packages/service/src/instance/component/component-module.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/instance/component/component-module.js
Apache-2.0
constructor(module, opts) { this.initd = false this.opts = opts if (opts.targetInfo) { this.id = opts.targetInfo.id this.dataset = opts.targetInfo.dataset this.__targetInfo__ = opts.targetInfo } this.is = opts.path this.renderer = 'webview' this.bridgeId = opts.bridgeId this.behaviors = module....
https://developers.weixin.qq.com/miniprogram/dev/reference/api/Component.html
constructor
javascript
didi/dimina
fe/packages/service/src/instance/component/component.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/instance/component/component.js
Apache-2.0
setData(data) { const fData = filterData(data) for (const key in fData) { set(this.data, key, fData[key]) } if (!this.initd) { return } message.send({ type: 'u', target: 'render', body: { bridgeId: this.bridgeId, moduleId: this.__id__, data: fData, }, }) }
https://developers.weixin.qq.com/miniprogram/dev/framework/performance/tips/runtime_setData.html @param {*} data
setData
javascript
didi/dimina
fe/packages/service/src/instance/component/component.js
https://github.com/didi/dimina/blob/master/fe/packages/service/src/instance/component/component.js
Apache-2.0
setOption(option, value) { this._setOption(option, value); this._checkOptionTypes(); }
Set a configuration option. @param {string} option @param {*} value
setOption
javascript
DoctorMcKay/node-steam-user
index.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/index.js
MIT
setOptions(options) { for (let i in options) { this._setOption(i, options[i]); } this._checkOptionTypes(); }
Set one or more configuration options @param {OptionsObject} options
setOptions
javascript
DoctorMcKay/node-steam-user
index.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/index.js
MIT
_checkOptionTypes() { // We'll infer types from DefaultOptions, but stuff that's null (for example) needs to be defined explicitly let types = { socksProxy: 'string', httpProxy: 'string', localAddress: 'string', localPort: 'number', machineIdFormat: 'array' }; for (let opt in DefaultOptions) { ...
Make sure that the types of all options are valid. @private
_checkOptionTypes
javascript
DoctorMcKay/node-steam-user
index.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/index.js
MIT
_resetExponentialBackoff(backoffName, dontClearBackoffTime) { if (this._exponentialBackoffs[backoffName]) { this.emit('debug-verbose', `[EBO] ${dontClearBackoffTime ? 'Soft-resetting' : 'Resetting'} exponential backoff "${backoffName}"`); clearTimeout(this._exponentialBackoffs[backoffName].timeout); if (!do...
@param {string} backoffName @param {boolean} [dontClearBackoffTime=false] @protected
_resetExponentialBackoff
javascript
DoctorMcKay/node-steam-user
components/00-base.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/00-base.js
MIT
_exponentialBackoff(backoffName, minimumTimeout, maximumTimeout) { return new Promise((resolve) => { let timeout = this._exponentialBackoffs[backoffName]?.lastTimeout ?? 0; this._resetExponentialBackoff(backoffName); // cancel any outstanding backoffs of this name timeout *= 2; timeout = Math.max(timeout...
@param {string} backoffName @param {number} minimumTimeout @param {number} maximumTimeout @return Promise<void> @protected
_exponentialBackoff
javascript
DoctorMcKay/node-steam-user
components/00-base.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/00-base.js
MIT
_handleConnectionClose(conn) { let connPrefix = conn.connectionType[0] + conn.connectionId; // If the message queue is currently enabled, we need to enqueue processing of the connection close. // Otherwise we might handle the closed connection too early, e.g. before processing ClientLogOnResponse if (this._use...
Handle the closure of our underlying connection. @param {BaseConnection} conn @protected
_handleConnectionClose
javascript
DoctorMcKay/node-steam-user
components/02-connection.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/02-connection.js
MIT
_cleanupClosedConnection() { this._connecting = false; this._loggingOff = false; this._cancelReconnectTimers(true); clearInterval(this._heartbeatInterval); this._connectionClosed = true; this._incomingMessageQueue = []; // clear the incoming message queue. If we're disconnecting, we don't care about anyt...
Handle the closure of our underlying connection. @param {BaseConnection} conn @protected
_cleanupClosedConnection
javascript
DoctorMcKay/node-steam-user
components/02-connection.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/02-connection.js
MIT
_cancelReconnectTimers(dontClearBackoffTime) { this._resetExponentialBackoff('logOn', dontClearBackoffTime); this._resetExponentialBackoff('webLogOn', dontClearBackoffTime); clearTimeout(this._reconnectForCloseDuringAuthTimeout); }
Handle the closure of our underlying connection. @param {BaseConnection} conn @protected
_cancelReconnectTimers
javascript
DoctorMcKay/node-steam-user
components/02-connection.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/02-connection.js
MIT
_getProxyAgent() { if (this.options.socksProxy && this.options.httpProxy) { throw new Error('Cannot specify both socksProxy and httpProxy options'); } if (this.options.socksProxy) { return new SocksProxyAgent(this.options.socksProxy); } if (this.options.httpProxy) { return StdLib.HTTP.getProxyAgent...
Handle the closure of our underlying connection. @param {BaseConnection} conn @protected
_getProxyAgent
javascript
DoctorMcKay/node-steam-user
components/02-connection.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/02-connection.js
MIT
static _encodeProto(proto, data) { return proto.encode(data).finish(); }
Encode a protobuf. @param {object} proto - The protobuf class @param {object} data - The data to serialize @returns {Buffer} @protected
_encodeProto
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
static _decodeProto(proto, encoded) { if (ByteBuffer.isByteBuffer(encoded)) { encoded = encoded.toBuffer(); } let decoded = proto.decode(encoded); let objNoDefaults = proto.toObject(decoded, {longs: String}); let objWithDefaults = proto.toObject(decoded, {defaults: true, longs: String}); return replaceD...
Decode a protobuf. @param {object} proto - The protobuf class @param {Buffer|ByteBuffer} encoded - The data to decode @returns {object} @protected
_decodeProto
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
function replaceDefaults(noDefaults, withDefaults) { if (Array.isArray(withDefaults)) { return withDefaults.map((val, idx) => replaceDefaults(noDefaults[idx], val)); } for (let i in withDefaults) { if (!Object.hasOwnProperty.call(withDefaults, i)) { continue; } if (withDefaults[i] && typ...
Decode a protobuf. @param {object} proto - The protobuf class @param {Buffer|ByteBuffer} encoded - The data to decode @returns {object} @protected
replaceDefaults
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
function isReplaceableDefaultValue(val) { if (Buffer.isBuffer(val) && val.length == 0) { // empty buffer is replaceable return true; } if (Array.isArray(val)) { // empty array is not replaceable (empty repeated fields) return false; } if (val === '0') { // Zero as a string is replac...
Decode a protobuf. @param {object} proto - The protobuf class @param {Buffer|ByteBuffer} encoded - The data to decode @returns {object} @protected
isReplaceableDefaultValue
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
_send(emsgOrHeader, body, callback) { // header fields: msg, proto, sourceJobID, targetJobID let header = typeof emsgOrHeader === 'object' ? emsgOrHeader : {msg: emsgOrHeader}; let emsg = header.msg; let canWeSend = this.steamID || ( this._tempSteamID && [EMsg.ChannelEncryptResponse, EMsg.ClientLogo...
@param {int|object} emsgOrHeader @param {object|Buffer|ByteBuffer} body @param {function} [callback] @protected
_send
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
_handleNetMessage(buffer, conn, multiId) { if (conn && conn != this._connection) { let ghostConnId = conn.connectionType[0] + conn.connectionId; let expectedConnId = this._connection ? (this._connection.connectionType[0] + this._connection.connectionId) : 'NO CONNECTION'; this.emit('debug', `Received net mes...
Handles a raw binary netmessage by parsing the header and routing it appropriately @param {Buffer|string} buffer @param {BaseConnection} [conn] @param {string} [multiId] @protected
_handleNetMessage
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
_handleMessage(header, bodyBuf, conn, multiId) { // Is this a multi? If yes, short-circuit and just process it now. if (header.msg == EMsg.Multi) { this._processMulti(header, SteamUserMessages._decodeProto(protobufs[EMsg.Multi], bodyBuf), conn); return; } let msgName = EMsg[header.msg] || header.msg; l...
Handles and routes a parsed message @param {object} header @param {ByteBuffer} bodyBuf @param {BaseConnection} [conn] @param {string} [multiId] @protected
_handleMessage
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
async _processMulti(header, body, conn) { let multiId = conn.connectionType[0] + conn.connectionId + '#' + (++this._multiCount); this.emit('debug-verbose', `=== Processing ${body.size_unzipped ? 'gzipped multi msg' : 'multi msg'} ${multiId} (${body.message_body.length} bytes) ===`); let payload = body.message_bo...
@param {object} header @param {object} body @param {object} conn @returns {Promise<void>} @protected
_processMulti
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
_sendUnified(methodName, methodData, callback) { let Proto = protobufs[methodName + (callback ? '_Request' : '')]; let header = { msg: EMsg.ServiceMethodCallFromClient, proto: { target_job_name: methodName } }; this._send(header, SteamUserMessages._encodeProto(Proto, methodData), callback); }
Send a unified message. @param {string} methodName - In format Interface.Method#Version, e.g. Foo.DoThing#1 @param {object} methodData @param {function} [callback] @protected
_sendUnified
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
_getLoginSession() { if (!this._loginSession) { let options = { transport: new CMAuthTransport(this), machineId: this._logOnDetails?.machine_id }; let customMachineName = this._logOnDetails?.machine_name || ''; if (customMachineName.length > 0) { options.machineFriendlyName = customMachineNam...
Send a unified message. @param {string} methodName - In format Interface.Method#Version, e.g. Foo.DoThing#1 @param {object} methodData @param {function} [callback] @protected
_getLoginSession
javascript
DoctorMcKay/node-steam-user
components/03-messages.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/03-messages.js
MIT
static formatCurrency(amount, currency) { let amountString = amount.toFixed(2); if (!CurrencyData[currency]) { return amountString; } let data = CurrencyData[currency]; if (data.whole) { amountString = amountString.replace('.00', ''); } if (data.commas) { amountString = amountString.replace('...
@param {number} amount @param {ECurrencyCode} currency @returns {string}
formatCurrency
javascript
DoctorMcKay/node-steam-user
components/04-utility.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/04-utility.js
MIT
async _saveFile(filename, content) { try { if (this.storage) { await this.storage.saveFile(filename, content); } } catch (ex) { this.emit('debug', `Error saving file ${filename}: ${ex.message}`); } }
@param {string} filename @param {Buffer|*} content @return {Promise} @protected
_saveFile
javascript
DoctorMcKay/node-steam-user
components/05-filestorage.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/05-filestorage.js
MIT
async _readFile(filename) { let content = null; try { if (this.storage) { content = await this.storage.readFile(filename); } } catch (ex) { this.emit('debug', `Error reading file ${filename}: ${ex.message}`); } return content; }
@param {string} filename @returns {Promise<Buffer|null>} @protected
_readFile
javascript
DoctorMcKay/node-steam-user
components/05-filestorage.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/05-filestorage.js
MIT
async _readFiles(filenames) { if (!this.storage) { return filenames.map(filename => ({filename, error: new Error('Storage system disabled')})); } // No need for a try/catch because readFiles can't reject return await this.storage.readFiles(filenames); }
@param {string[]} filenames @returns {Promise<{filename: string, error?: Error, contents?: Buffer}[]>} @protected
_readFiles
javascript
DoctorMcKay/node-steam-user
components/05-filestorage.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/05-filestorage.js
MIT
async _apiRequest(httpMethod, iface, method, version, data, cacheSeconds) { data = data || {}; httpMethod = httpMethod.toUpperCase(); // just in case // Pad the version with zeroes to make it 4 digits long, because Valve version = version.toString(); while (version.length < 4) { version = '0' + version; ...
@param {string} httpMethod @param {string} iface @param {string} method @param {number} version @param {object} [data] @param {number} [cacheSeconds] @returns {Promise} @protected
_apiRequest
javascript
DoctorMcKay/node-steam-user
components/06-webapi.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/06-webapi.js
MIT
function buildQueryString(data) { // We can't use the querystring module's encode because we want binary data to be completely percent-encoded let str = ''; for (let i in data) { if (!Object.hasOwnProperty.call(data, i)) { continue; } str += (str ? '&' : '') + i + '='; if (Buffer.isBuffer(data[i])) { ...
@param {string} httpMethod @param {string} iface @param {string} method @param {number} version @param {object} [data] @param {number} [cacheSeconds] @returns {Promise} @protected
buildQueryString
javascript
DoctorMcKay/node-steam-user
components/06-webapi.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/06-webapi.js
MIT
function getDefaultHeaders() { return { Accept: 'text/html,*/*;q=0.9', 'Accept-Encoding': 'gzip,identity,*;q=0', 'Accept-Charset': 'ISO-8859-1,utf-8,*;q=0.7' }; }
@param {string} httpMethod @param {string} iface @param {string} method @param {number} version @param {object} [data] @param {number} [cacheSeconds] @returns {Promise} @protected
getDefaultHeaders
javascript
DoctorMcKay/node-steam-user
components/06-webapi.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/06-webapi.js
MIT
async _sendLogOn() { if (this._logOnDetails.account_name && this._logOnDetails.password) { this.emit('debug', 'Logging on with account name and password; fetching a new refresh token'); let startTime = Date.now(); let authSuccess = await this._performPasswordAuth(); if (!authSuccess) { // We would hav...
Send the actual ClientLogOn message. @private
_sendLogOn
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
_performPasswordAuth() { return new Promise(async (resolve) => { this._send(EMsg.ClientHello, {protocol_version: PROTOCOL_VERSION}); let session = this._getLoginSession(); session.on('debug', (...args) => { this.emit('debug', '[steam-session] ' + args.map(arg => typeof arg == 'object' ? JSON.stringify(...
Send the actual ClientLogOn message. @private
_performPasswordAuth
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
_enqueueLogonAttempt() { this._exponentialBackoff('logOn', 1000, 60000).then(() => { if (this.steamID || this._connecting) { // Not sure why this happened, but we're already connected let whyFail = this.steamID ? 'already connected' : 'already attempting to connect'; this.emit('debug', `!! Attempted to...
Enqueue another logon attempt. Used after we get ServiceUnavailable, TryAnotherCM, or a timeout waiting for ClientLogOnResponse. @private
_enqueueLogonAttempt
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
_disconnect(suppressLogoff) { this._clearChangelistUpdateTimer(); this._incomingMessageQueue = []; // clear the incoming message queue. If we're disconnecting, we don't care about anything else in the queue. this.emit('debug', 'Disconnecting' + (suppressLogoff ? ' without sending logoff' : '')); if (this.stea...
Disconnect from Steam @param {boolean} suppressLogoff - If true, just disconnect immediately without sending a logoff message. @private
_disconnect
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
_getMachineID(localFile) { if ( ( !this._logOnDetails.account_name && !this._logOnDetails._steamid ) || this.options.machineIdType == EMachineIDType.None ) { // No machine IDs for anonymous logons return null; } // The user wants to use a random machine ID that's saved to dataDirectory ...
@param {Buffer} [localFile] @returns {null|Buffer} @private
_getMachineID
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
function getRandomID() { return createMachineID(Math.random().toString(), Math.random().toString(), Math.random().toString()); }
@param {Buffer} [localFile] @returns {null|Buffer} @private
getRandomID
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
_getAccountIdentifier() { return this._logOnDetails.account_name || this._logOnDetails._newAuthAccountName || this._logOnDetails._steamid.toString(); }
@param {Buffer} [localFile] @returns {null|Buffer} @private
_getAccountIdentifier
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
relog() { if (!this.steamID) { throw new Error('Cannot relog if not already connected'); } let relogAvailable = ( this.steamID.type == SteamID.Type.ANON_USER || ( this.steamID.type == SteamID.Type.INDIVIDUAL && this._logOnDetails && this._logOnDetails.access_token ) ); if (!relogAvai...
@param {Buffer} [localFile] @returns {null|Buffer} @private
relog
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
_handleLogOff(result, msg) { let fatal = true; let nonFatalLogOffResults = [ 0, EResult.Fail, EResult.NoConnection, EResult.ServiceUnavailable, EResult.TryAnotherCM ]; if (this.options.autoRelogin && nonFatalLogOffResults.includes(result)) { fatal = false; } delete this.publicIP; dele...
@param {number} result @param {string} msg @private
_handleLogOff
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
_steamGuardPrompt(domain, lastCodeWrong, callback) { if (this.listenerCount('steamGuard') == 0) { // No steamGuard listeners, so prompt for one from stdin let rl = require('readline').createInterface({ input: process.stdin, output: process.stdout }); rl.question('Steam Guard' + (!domain ? ' App'...
@param {string} domain @param {boolean} lastCodeWrong @param {function} callback @private
_steamGuardPrompt
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
function createMachineID(val_bb3, val_ff2, val_3b3) { // Machine IDs are binary KV objects with root key MessageObject and three hashes named BB3, FF2, and 3B3. // I don't feel like writing a proper BinaryKV serializer, so this will work fine. let buffer = ByteBuffer.allocate(155, ByteBuffer.LITTLE_ENDIAN); buffer...
@param {string} domain @param {boolean} lastCodeWrong @param {function} callback @private
createMachineID
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
function sha1(input) { let hash = Crypto.createHash('sha1'); hash.update(input, 'utf8'); return hash.digest('hex'); }
@param {string} domain @param {boolean} lastCodeWrong @param {function} callback @private
sha1
javascript
DoctorMcKay/node-steam-user
components/09-logon.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/09-logon.js
MIT
getPrivacySettings(callback) { return StdLib.Promises.timeoutCallbackPromise(10000, null, callback, (resolve, reject) => { this._sendUnified('Player.GetPrivacySettings#1', {}, (body, hdr) => { let err = Helpers.eresultError(hdr.proto); if (err) { return reject(err); } resolve(body.privacy_set...
Get your account's profile privacy settings. @param {function} [callback] @returns {Promise<{privacy_state: int, privacy_state_inventory: int, privacy_state_gifts: int, privacy_state_ownedgames: int, privacy_state_playtime: int, privacy_state_friendslist: int}>}
getPrivacySettings
javascript
DoctorMcKay/node-steam-user
components/account.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/account.js
MIT
createEncryptedAppTicket(appid, userData, callback) { if (typeof userData === 'function') { callback = userData; userData = Buffer.alloc(0); } return StdLib.Promises.timeoutCallbackPromise(10000, ['encryptedAppTicket'], callback, (resolve, reject) => { this._send(EMsg.ClientRequestEncryptedAppTicket, { ...
Request an encrypted appticket for a particular app. The app must be set up on the Steam backend for encrypted apptickets. @param {int} appid - The Steam AppID of the app you want a ticket for @param {Buffer} [userData] - If the app expects some "user data", provide it here @param {function} [callback] - First argument...
createEncryptedAppTicket
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
getEncryptedAppTicket(appid, userData, callback) { return this.createEncryptedAppTicket(appid, userData, callback); }
Request an encrypted appticket for a particular app. The app must be set up on the Steam backend for encrypted apptickets. @param {int} appid - The Steam AppID of the app you want a ticket for @param {Buffer} [userData] - If the app expects some "user data", provide it here @param {function} [callback] - First argument...
getEncryptedAppTicket
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
static parseEncryptedAppTicket(ticket, encryptionKey) { return AppTicket.parseEncryptedAppTicket(ticket, encryptionKey); }
@param {Buffer} ticket - The raw encrypted appticket @param {Buffer|string} encryptionKey - The app's encryption key, either raw hex or a Buffer @returns {object}
parseEncryptedAppTicket
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
static parseAppTicket(ticket, allowInvalidSignature) { return AppTicket.parseAppTicket(ticket, allowInvalidSignature); }
Parse a Steam app or session ticket and return an object containing its details. Static. @param {Buffer|ByteBuffer} ticket - The binary appticket @param {boolean} [allowInvalidSignature=false] - Pass true to get back data even if the ticket has no valid signature. @returns {object|null} - object if well-formed ticket (...
parseAppTicket
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
createAuthSessionTicket(appid, callback) { return StdLib.Promises.callbackPromise(['sessionTicket'], callback, (resolve, reject) => { // For an auth session ticket we need the following: // 1. Length-prefixed GCTOKEN // 2. Length-prefixed SESSIONHEADER // 3. Length-prefixed OWNERSHIPTICKET (yes, even thou...
Parse a Steam app or session ticket and return an object containing its details. Static. @param {Buffer|ByteBuffer} ticket - The binary appticket @param {boolean} [allowInvalidSignature=false] - Pass true to get back data even if the ticket has no valid signature. @returns {object|null} - object if well-formed ticket (...
createAuthSessionTicket
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
buildToken = async (err) => { if (err) { return reject(err); } let gcToken = this._gcTokens.splice(0, 1)[0]; this.emit('debug', `Using GC token ${gcToken.toString('hex')}. We now have ${this._gcTokens.length} tokens left.`); let buffer = ByteBuffer.allocate(4 + gcToken.length + 4 + 24 + ...
Parse a Steam app or session ticket and return an object containing its details. Static. @param {Buffer|ByteBuffer} ticket - The binary appticket @param {boolean} [allowInvalidSignature=false] - Pass true to get back data even if the ticket has no valid signature. @returns {object|null} - object if well-formed ticket (...
buildToken
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
buildToken = async (err) => { if (err) { return reject(err); } let gcToken = this._gcTokens.splice(0, 1)[0]; this.emit('debug', `Using GC token ${gcToken.toString('hex')}. We now have ${this._gcTokens.length} tokens left.`); let buffer = ByteBuffer.allocate(4 + gcToken.length + 4 + 24 + ...
Parse a Steam app or session ticket and return an object containing its details. Static. @param {Buffer|ByteBuffer} ticket - The binary appticket @param {boolean} [allowInvalidSignature=false] - Pass true to get back data even if the ticket has no valid signature. @returns {object|null} - object if well-formed ticket (...
buildToken
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
getAppOwnershipTicket(appid, callback) { return StdLib.Promises.timeoutCallbackPromise(10000, ['appOwnershipTicket'], callback, async (resolve, reject) => { // See if we have one saved let filename = `appOwnershipTicket_${this.steamID}_${appid}.bin`; let file = await this._readFile(filename); if (file) { ...
Parse a Steam app or session ticket and return an object containing its details. Static. @param {Buffer|ByteBuffer} ticket - The binary appticket @param {boolean} [allowInvalidSignature=false] - Pass true to get back data even if the ticket has no valid signature. @returns {object|null} - object if well-formed ticket (...
getAppOwnershipTicket
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
activateAuthSessionTickets(appid, tickets, callback) { if (!Array.isArray(tickets)) { tickets = [tickets]; } return StdLib.Promises.timeoutCallbackPromise(10000, null, callback, true, async (resolve, reject) => { tickets.forEach((ticket, idx) => { if (ticket instanceof Buffer) { ticket = AppTicket...
Parse a Steam app or session ticket and return an object containing its details. Static. @param {Buffer|ByteBuffer} ticket - The binary appticket @param {boolean} [allowInvalidSignature=false] - Pass true to get back data even if the ticket has no valid signature. @returns {object|null} - object if well-formed ticket (...
activateAuthSessionTickets
javascript
DoctorMcKay/node-steam-user
components/appauth.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/appauth.js
MIT
gamesPlayed(apps, force) { if (!(apps instanceof Array)) { apps = [apps]; } let execute = async () => { if (this._playingBlocked && force) { await this.kickPlayingSession(); } let processedApps = apps.map((app) => { if (typeof app == 'string') { app = {game_id: '15190414816125648896', g...
Tell Steam that you're "playing" zero or more games. @param {array} apps - Array of integers (AppIDs) or strings (non-Steam game names) for the games you're playing. Empty to play nothing. @param {boolean} [force=false] If true, kick any other sessions logged into this account and playing games from Steam
gamesPlayed
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
execute = async () => { if (this._playingBlocked && force) { await this.kickPlayingSession(); } let processedApps = apps.map((app) => { if (typeof app == 'string') { app = {game_id: '15190414816125648896', game_extra_info: app}; } else if (typeof app != 'object') { app = {game_id: app}; ...
Tell Steam that you're "playing" zero or more games. @param {array} apps - Array of integers (AppIDs) or strings (non-Steam game names) for the games you're playing. Empty to play nothing. @param {boolean} [force=false] If true, kick any other sessions logged into this account and playing games from Steam
execute
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
execute = async () => { if (this._playingBlocked && force) { await this.kickPlayingSession(); } let processedApps = apps.map((app) => { if (typeof app == 'string') { app = {game_id: '15190414816125648896', game_extra_info: app}; } else if (typeof app != 'object') { app = {game_id: app}; ...
Tell Steam that you're "playing" zero or more games. @param {array} apps - Array of integers (AppIDs) or strings (non-Steam game names) for the games you're playing. Empty to play nothing. @param {boolean} [force=false] If true, kick any other sessions logged into this account and playing games from Steam
execute
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
kickPlayingSession(callback) { return StdLib.Promises.callbackPromise([], callback, true, (resolve, reject) => { this._send(EMsg.ClientKickPlayingSession, {}); Helpers.onceTimeout(10000, this, 'playingState', (err, blocked, playingApp) => { if (err) { return reject(err); } else if (blocked) { ...
Kick any other session logged into your account which is playing a game from Steam. @param {function} [callback] @returns {Promise<{playingApp: number}>}
kickPlayingSession
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
getPlayerCount(appid, callback) { return StdLib.Promises.timeoutCallbackPromise(10000, ['playerCount'], callback, (resolve, reject) => { this._send(EMsg.ClientGetNumberOfCurrentPlayersDP, {appid}, (body) => { let err = Helpers.eresultError(body.eresult); if (err) { reject(err); } else { resol...
Get count of people playing a Steam app. Use appid 0 to get number of people connected to Steam. @param {int} appid @param {function} [callback] @returns {Promise<{playerCount: number}>}
getPlayerCount
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
getProductChanges(sinceChangenumber, callback) { let args = ['currentChangeNumber', 'appChanges', 'packageChanges']; return StdLib.Promises.timeoutCallbackPromise(10000, args, callback, (resolve, reject) => { this._send(EMsg.ClientPICSChangesSinceRequest, { since_change_number: sinceChangenumber, send_ap...
Get a list of apps or packages which have changed since a particular changenumber. @param {int} sinceChangenumber - Changenumber to get changes since. Use 0 to get the latest changenumber, but nothing else @param {function} [callback] @returns {Promise<{currentChangeNumber: number, appChanges: number[], packageChanges:...
getProductChanges
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
getProductInfo(apps, packages, inclTokens, callback, requestType) { // Adds support for the previous syntax if (typeof inclTokens !== 'boolean' && typeof inclTokens === 'function') { requestType = callback; callback = inclTokens; inclTokens = false; } // This one actually can take a while, so allow it...
Get info about some apps and/or packages from Steam. @param {int[]|object[]} apps - Array of AppIDs. May be empty. May also contain objects with keys {appid, access_token} @param {int[]|object[]} packages - Array of package IDs. May be empty. May also contain objects with keys {packageid, access_token} @param {boolean}...
getProductInfo
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
getProductAccessToken(apps, packages, callback) { let args = ['appTokens', 'packageTokens', 'appDeniedTokens', 'packageDeniedTokens']; return StdLib.Promises.timeoutCallbackPromise(10000, args, callback, (resolve, reject) => { this._send(EMsg.ClientPICSAccessTokenRequest, { packageids: packages, appids: ...
Get access tokens for some apps and/or packages @param {int[]} apps - Array of appids @param {int[]} packages - Array of packageids @param {function} [callback] - First arg is an object of (appid => access token), second is the same for packages, third is array of appids for which tokens are denied, fourth is the same ...
getProductAccessToken
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
redeemKey(key, callback) { return StdLib.Promises.timeoutCallbackPromise(90000, ['purchaseResultDetails', 'packageList'], callback, (resolve, reject) => { this._send(EMsg.ClientRegisterKey, {key: key}, (body) => { let packageList = {}; let receiptDetails = BinaryKVParser.parse(body.purchase_receipt_info)....
Redeem a product code on this account. @param {string} key @param {function} [callback] - Args (eresult value, SteamUser.EPurchaseResult value, object of (packageid => package names) @returns {Promise<{purchaseResultDetails: EPurchaseResult, packageList: Object<string, string>}>}
redeemKey
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
getLegacyGameKey(appid, callback) { return StdLib.Promises.timeoutCallbackPromise(10000, null, callback, (resolve, reject) => { let request = Buffer.alloc(4); request.writeUInt32LE(appid); this._send(EMsg.ClientGetLegacyGameKey, request, (body) => { let responseAppId = body.readUint32(); if (response...
Gets your legacy CD key for a game in your library which uses CD keys @param {number} appid @param {function} [callback] @returns {Promise<{key: string}>}
getLegacyGameKey
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
function sortNumeric(a, b) { if (a < b) { return -1; } else if (a > b) { return 1; } return 0; }
Gets your legacy CD key for a game in your library which uses CD keys @param {number} appid @param {function} [callback] @returns {Promise<{key: string}>}
sortNumeric
javascript
DoctorMcKay/node-steam-user
components/apps.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/apps.js
MIT
getContentServers(appid, callback) { if (typeof appid == 'function') { callback = appid; appid = null; } return StdLib.Promises.timeoutCallbackPromise(10000, ['servers'], callback, async (resolve, reject) => { let res; if (this._contentServerCache && this._contentServerCache.timestamp && Date.now() -...
Get the list of currently-available content servers. @param {int} [appid] - If you know the appid you want to download, pass it here as some content servers only provide content for specific games @param {function} [callback] @return Promise
getContentServers
javascript
DoctorMcKay/node-steam-user
components/cdn.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/cdn.js
MIT
getDepotDecryptionKey(appID, depotID, callback) { appID = parseInt(appID, 10); depotID = parseInt(depotID, 10); return StdLib.Promises.timeoutCallbackPromise(10000, ['key'], callback, async (resolve, reject) => { // Check if it's cached locally let filename = `depot_key_${appID}_${depotID}.bin`; let fil...
Request the decryption key for a particular depot. @param {int} appID @param {int} depotID @param {function} [callback] @return Promise
getDepotDecryptionKey
javascript
DoctorMcKay/node-steam-user
components/cdn.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/cdn.js
MIT
getCDNAuthToken(appID, depotID, hostname, callback) { return StdLib.Promises.timeoutCallbackPromise(10000, ['token', 'expires'], callback, (resolve, reject) => { if (this._contentServerTokens[depotID + '_' + hostname] && this._contentServerTokens[depotID + '_' + hostname].expires - Date.now() > (1000 * 60 * 60)) {...
Get an auth token for a particular CDN server. @param {int} appID @param {int} depotID @param {string} hostname - The hostname of the CDN server for which we want a token @param {function} [callback] @return Promise
getCDNAuthToken
javascript
DoctorMcKay/node-steam-user
components/cdn.js
https://github.com/DoctorMcKay/node-steam-user/blob/master/components/cdn.js
MIT