@fpjs-incubator/botd
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -13,2 +13,3 @@ declare type SimpleSourceResult = string | number | boolean; | ||
token: string; | ||
async?: boolean; | ||
endpoint?: string; | ||
@@ -24,2 +25,3 @@ } | ||
token: string; | ||
async: boolean; | ||
timestamp?: number; | ||
@@ -33,2 +35,3 @@ tag?: string; | ||
get(tag: unknown): Promise<Record<string, unknown>>; | ||
poll(): Promise<Record<string, unknown>>; | ||
} | ||
@@ -35,0 +38,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).FPJSBotDetect={})}(this,(function(t){"use strict";function n(t,n,e,r){return new(e||(e=Promise))((function(o,i){function c(t){try{a(r.next(t))}catch(n){i(n)}}function u(t){try{a(r.throw(t))}catch(n){i(n)}}function a(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(c,u)}a((r=r.apply(t,n||[])).next())}))}function e(t){return n(this,void 0,void 0,(function*(){let n,e;try{n=yield t(),e={state:1,value:n}}catch(r){e={state:-1,value:r.toString()}}return e}))}function r(){return navigator.userAgent}function o(){return void 0!==navigator.userAgentData}function i(){return navigator.appVersion}function c(){if(void 0===navigator.connection)throw new Error("navigator.connection is undefined");return navigator.connection.rtt}function u(){return[window.outerWidth,window.outerHeight]}function a(){return n(this,void 0,void 0,(function*(){if("undefined"==typeof Notification)throw new Error("Notification is undefined");const{permissions:t}=navigator;if(!t)throw new Error("navigator.permissions is undefined");const n=yield t.query({name:"notifications"});return"denied"===Notification.permission&&"prompt"===n.state}))}function s(){const t=document.createElement("canvas").getContext("webgl");if(null!==t){const n=t.getExtension("WEBGL_debug_renderer_info");if(null!==n){return[t.getParameter(n.UNMASKED_VENDOR_WEBGL),t.getParameter(n.UNMASKED_RENDERER_WEBGL)]}}throw new Error("can`t get webgl data")}function d(){return[screen.width,screen.height]}function f(){if(void 0===navigator.deviceMemory)throw new Error("navigator.deviceMemory is undefined");return navigator.deviceMemory}function w(){const t=new ArrayBuffer(4);return new Uint32Array(t)[0]=2852126720,170===new Uint8Array(t)[0]}function l(){try{const t=navigator.hardwareConcurrency;if("string"==typeof t){const n=parseInt(t);return isNaN(n)?1:n}return t}catch(t){throw new Error("navigator.hardwareConcurrency wrong type")}}function p(){return void 0!==window.chrome}function v(){return eval.toString().length}function h(){return navigator.plugins.length}function _(){return n(this,void 0,void 0,(function*(){const{plugins:t}=navigator;if(!t)return!1;let n=Object.getPrototypeOf(t)===PluginArray.prototype;for(let e=0;e<t.length;e++)n&&(n=Object.getPrototypeOf(t[e])===Plugin.prototype);return n}))}function g(){try{null[0]()}catch(t){return t.stack.toString()}throw new Error("wrong error trace behaviour")}function m(){try{throw"a"}catch(t){try{return t.toSource(),!0}catch(n){return!1}}}function y(){if(void 0===navigator.oscpu)throw new Error("navigator.oscpu is undefined");return navigator.oscpu}function b(){return navigator.platform}function E(){return navigator.productSub}function O(){return navigator.vendor}function P(t,n){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];if(Object.prototype.hasOwnProperty.call(n,r))return!0}return!1}function S(){return"callPhantom"in window||"_phantom"in window||"phantom"in window||"__phantomas"in window||"__nightmare"in window||"awesomium"in window||"geb"in window||"emit"in window||-1!==window.close.toString().toLowerCase().indexOf("electron")||"spawn"in window||"Buffer"in window||"domAutomation"in window||"domAutomationController"in window||function(){const t=window;return"external"in t&&-1!==t.external.toString().indexOf("Sequentum")}()||function(){const t=window;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.match(/[a-z]dc_/))return!0;return!1}()||function(){const t=document;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.match(/\$[a-z]dc_/)&&t[n].cache_)return!0;return!1}()||function(){const t=document,n=window,{documentElement:e}=t,r=["webdriver","__webdriver_script_fn","__driver_evaluate","__webdriver_evaluate","__fxdriver_evaluate","__webdriverFunc","__driver_unwrapped","__webdriver_unwrapped","__fxdriver_unwrapped","__webdriver_script_fn","__webdriver_script_func","__webdriver_script_function","$cdc_asdjflasutopfhvcZLmcf","$cdc_asdjflasutopfhvcZLmcfl_","$chrome_asyncScriptInfo","__$webdriverAsyncExecutor","__lastWatirAlert","__lastWatirConfirm","__lastWatirPrompt","_WEBDRIVER_ELEM_CACHE","ChromeDriverw"],o=P(r,n),i=P(r,t),c=null!==e.getAttribute("webdriver")||null!==e.getAttribute("driver");return o||i||c}()||function(){const t=document,n=window,{documentElement:e}=t,r=["__selenium_evaluate","__selenium_unwrapped","_Selenium_IDE_Recorder","_selenium","calledSelenium","selenium-evaluate"],o=P(r,n),i=P(r,t),c=null!==e.getAttribute("selenium");return o||i||c}()}function j(){if(null==navigator.webdriver)throw new Error("navigator.webdriver is undefined");return navigator.webdriver}function A(){const t=typeof window.InstallTrigger;if(void 0===t)throw new Error("typeof returned undefined");return"undefined"!==t}function x(){function t(){return performance.now()/1e3}function n(t,e){return t<1e-8?e:t<e?n(e-Math.floor(e/t)*t,t):t===e?t:n(e,t)}const e=t();let r=t()-e;for(let o=0;o<10;o++)r=n(r,t()-e);return Math.round(1/r)}function N(t,n=[]){return null==Object.getPrototypeOf(t)?n:N(Object.getPrototypeOf(t),n.concat(Object.getOwnPropertyNames(t)))}function D(){return N(window)}function C(){return N(window.document)}function M(){return N(window.navigator)}function W(){return n(this,void 0,void 0,(function*(){return function(t){return n(this,void 0,void 0,(function*(){const n={};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const o=t[r];n[r]=yield e(o)}return n}))}({s1:r,s2:o,s3:i,s4:c,s5:u,s6:a,s7:s,s8:d,s9:f,s10:w,s11:l,s12:p,s13:A,s14:S,s15:j,s16:v,s17:h,s18:_,s19:g,s20:m,s21:y,s22:b,s23:E,s24:O,s25:x,s26:D,s27:C,s28:M})}))}class B{constructor(t){this.endpoint=void 0===t.endpoint?"https://botd.fpapi.io/detect":t.endpoint,this.token=t.token}setTag(t){if(void 0!==this.sources){try{this.tag=void 0===t?"":JSON.stringify(t)}catch(n){this.tag=""}this.sources.s29={state:1,value:this.tag}}}collect(){return n(this,void 0,void 0,(function*(){return this.timestamp=Date.now(),this.sources=yield W(),this.performance=Date.now()-this.timestamp,this.sources}))}get(t){return n(this,void 0,void 0,(function*(){this.setTag(t);const n={timestamp:this.timestamp,performance:this.performance,signals:this.sources,version:"0.1.0",token:this.token};try{const t=yield fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return yield t.json()}catch(e){return{error:{code:"Failed",message:e.toString()}}}}))}}t.load=function(t){return n(this,void 0,void 0,(function*(){const n=new B(t);return yield n.collect(),n}))},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).FPJSBotDetect={})}(this,(function(t){"use strict";function n(t,n,e,r){return new(e||(e=Promise))((function(o,i){function c(t){try{s(r.next(t))}catch(n){i(n)}}function u(t){try{s(r.throw(t))}catch(n){i(n)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(c,u)}s((r=r.apply(t,n||[])).next())}))}function e(t){return n(this,void 0,void 0,(function*(){let n,e;try{n=yield t(),e={state:1,value:n}}catch(r){e={state:-1,value:r.toString()}}return e}))}function r(){return navigator.userAgent}function o(){return void 0!==navigator.userAgentData}function i(){return navigator.appVersion}function c(){if(void 0===navigator.connection)throw new Error("navigator.connection is undefined");return navigator.connection.rtt}function u(){return[window.outerWidth,window.outerHeight]}function s(){return n(this,void 0,void 0,(function*(){if("undefined"==typeof Notification)throw new Error("Notification is undefined");const{permissions:t}=navigator;if(!t)throw new Error("navigator.permissions is undefined");const n=yield t.query({name:"notifications"});return"denied"===Notification.permission&&"prompt"===n.state}))}function a(){const t=document.createElement("canvas").getContext("webgl");if(null!==t){const n=t.getExtension("WEBGL_debug_renderer_info");if(null!==n){return[t.getParameter(n.UNMASKED_VENDOR_WEBGL),t.getParameter(n.UNMASKED_RENDERER_WEBGL)]}}throw new Error("can`t get webgl data")}function d(){return[screen.width,screen.height]}function f(){if(void 0===navigator.deviceMemory)throw new Error("navigator.deviceMemory is undefined");return navigator.deviceMemory}function l(){const t=new ArrayBuffer(4);return new Uint32Array(t)[0]=2852126720,170===new Uint8Array(t)[0]}function w(){try{const t=navigator.hardwareConcurrency;if("string"==typeof t){const n=parseInt(t);return isNaN(n)?1:n}return t}catch(t){throw new Error("navigator.hardwareConcurrency wrong type")}}function h(){return void 0!==window.chrome}function p(){return eval.toString().length}function v(){return navigator.plugins.length}function g(){return n(this,void 0,void 0,(function*(){const{plugins:t}=navigator;if(!t)return!1;let n=Object.getPrototypeOf(t)===PluginArray.prototype;for(let e=0;e<t.length;e++)n&&(n=Object.getPrototypeOf(t[e])===Plugin.prototype);return n}))}function m(){try{null[0]()}catch(t){return t.stack.toString()}throw new Error("wrong error trace behaviour")}function _(){try{throw"a"}catch(t){try{return t.toSource(),!0}catch(n){return!1}}}function y(){if(void 0===navigator.oscpu)throw new Error("navigator.oscpu is undefined");return navigator.oscpu}function b(){return navigator.platform}function E(){return navigator.productSub}function O(){return navigator.vendor}function P(t,n){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];if(Object.prototype.hasOwnProperty.call(n,r))return!0}return!1}function S(){return"callPhantom"in window||"_phantom"in window||"phantom"in window||"__phantomas"in window||"__nightmare"in window||"awesomium"in window||"geb"in window||"emit"in window||-1!==window.close.toString().toLowerCase().indexOf("electron")||"spawn"in window||"Buffer"in window||"domAutomation"in window||"domAutomationController"in window||function(){const t=window;return"external"in t&&-1!==t.external.toString().indexOf("Sequentum")}()||function(){const t=window;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.match(/[a-z]dc_/))return!0;return!1}()||function(){const t=document;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&n.match(/\$[a-z]dc_/)&&t[n].cache_)return!0;return!1}()||function(){const t=document,n=window,{documentElement:e}=t,r=["webdriver","__webdriver_script_fn","__driver_evaluate","__webdriver_evaluate","__fxdriver_evaluate","__webdriverFunc","__driver_unwrapped","__webdriver_unwrapped","__fxdriver_unwrapped","__webdriver_script_fn","__webdriver_script_func","__webdriver_script_function","$cdc_asdjflasutopfhvcZLmcf","$cdc_asdjflasutopfhvcZLmcfl_","$chrome_asyncScriptInfo","__$webdriverAsyncExecutor","__lastWatirAlert","__lastWatirConfirm","__lastWatirPrompt","_WEBDRIVER_ELEM_CACHE","ChromeDriverw"],o=P(r,n),i=P(r,t),c=null!==e.getAttribute("webdriver")||null!==e.getAttribute("driver");return o||i||c}()||function(){const t=document,n=window,{documentElement:e}=t,r=["__selenium_evaluate","__selenium_unwrapped","_Selenium_IDE_Recorder","_selenium","calledSelenium","selenium-evaluate"],o=P(r,n),i=P(r,t),c=null!==e.getAttribute("selenium");return o||i||c}()}function j(){if(null==navigator.webdriver)throw new Error("navigator.webdriver is undefined");return navigator.webdriver}function A(){const t=typeof window.InstallTrigger;if(void 0===t)throw new Error("typeof returned undefined");return"undefined"!==t}function x(){function t(){return performance.now()/1e3}function n(t,e){return t<1e-8?e:t<e?n(e-Math.floor(e/t)*t,t):t===e?t:n(e,t)}const e=t();let r=t()-e;for(let o=0;o<10;o++)r=n(r,t()-e);return Math.round(1/r)}function C(t,n=[]){return null==Object.getPrototypeOf(t)?n:C(Object.getPrototypeOf(t),n.concat(Object.getOwnPropertyNames(t)))}function k(){return C(window)}function N(){return C(window.document)}function D(){return C(window.navigator)}function T(){return n(this,void 0,void 0,(function*(){return function(t){return n(this,void 0,void 0,(function*(){const n={};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const o=t[r];n[r]=yield e(o)}return n}))}({s1:r,s2:o,s3:i,s4:c,s5:u,s6:s,s7:a,s8:d,s9:f,s10:l,s11:w,s12:h,s13:A,s14:S,s15:j,s16:p,s17:v,s18:g,s19:m,s20:_,s21:y,s22:b,s23:E,s24:O,s25:x,s26:k,s27:N,s28:D})}))}class R{constructor(t){this.async=null!=t.async&&t.async,this.endpoint=void 0===t.endpoint?"https://botd.fpapi.io/api/v1/":t.endpoint,this.endpoint.endsWith("/")||(this.endpoint+="/"),this.token=t.token}setTag(t){if(void 0!==this.sources){try{this.tag=void 0===t?"":JSON.stringify(t)}catch(n){this.tag=""}this.sources.s29={state:1,value:this.tag}}}collect(){return n(this,void 0,void 0,(function*(){return this.timestamp=Date.now(),this.sources=yield T(),this.performance=Date.now()-this.timestamp,this.sources}))}get(t){return n(this,void 0,void 0,(function*(){this.setTag(t);const n={async:this.async,timestamp:this.timestamp,performance:this.performance,signals:this.sources,version:"0.1.1",token:this.token};try{const t=yield fetch(this.endpoint+"detect",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":this.token},body:JSON.stringify(n)}),o=yield t.json();return this.async&&(e="botd-request-id",r=o.request_id,r=encodeURIComponent(r),document.cookie=e+"="+r),o}catch(o){return{error:{code:500,message:o.toString()}}}var e,r}))}poll(){return n(this,void 0,void 0,(function*(){if(!this.async)return{error:{code:400,message:'You are in sync mode, set "async" as true in load() method'}};const t=function(t){const n=document.cookie.match(new RegExp("(?:^|; )"+t.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return n?decodeURIComponent(n[1]):void 0}("botd-request-id");if(null==t)return{error:{code:400,message:"Call get() method first to make a request"}};try{const n=yield fetch(this.endpoint+"results?id="+t,{method:"GET",headers:{"Content-Type":"application/json","Auth-Token":this.token}});return yield n.json()}catch(n){return{error:{code:500,message:n.toString()}}}}))}}t.load=function(t){return n(this,void 0,void 0,(function*(){const n=new R(t);return yield n.collect(),n}))},Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@fpjs-incubator/botd", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/botd.umd.min.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9582
64
2