tractive-device-farm 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/auth/middleware.js +14 -4
- package/lib/helpers.js +2 -2
- package/lib/plugin.js +20 -5
- package/lib/public/dashboard/asset-manifest.json +3 -3
- package/lib/public/dashboard/index.html +1 -1
- package/lib/public/dashboard/static/js/main.9652282b.chunk.js +2 -0
- package/lib/public/dashboard/static/js/main.9652282b.chunk.js.map +1 -0
- package/lib/public/version.txt +1 -1
- package/package.json +1 -1
- package/lib/commands/handle.js +0 -19
- package/lib/commands/index.js +0 -10
- package/lib/public/dashboard/static/js/main.f68d4156.chunk.js +0 -2
- package/lib/public/dashboard/static/js/main.f68d4156.chunk.js.map +0 -1
package/lib/auth/middleware.js
CHANGED
|
@@ -5,11 +5,21 @@ const tokens_service_1 = require("../data-service/tokens-service");
|
|
|
5
5
|
const users_service_1 = require("../data-service/users-service");
|
|
6
6
|
const bootstrap_admin_1 = require("./bootstrap-admin");
|
|
7
7
|
function extractBearer(req) {
|
|
8
|
+
var _a;
|
|
8
9
|
const header = req.headers['authorization'];
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if (header && typeof header === 'string') {
|
|
11
|
+
const match = header.match(/^Bearer\s+(.+)$/i);
|
|
12
|
+
if (match)
|
|
13
|
+
return match[1].trim();
|
|
14
|
+
}
|
|
15
|
+
// Fallback for browser media requests (<video src>, <img src>) which
|
|
16
|
+
// can't carry custom Authorization headers. The same plaintext token is
|
|
17
|
+
// accepted as a ?token= query param — still validated against the DB.
|
|
18
|
+
const queryToken = (_a = req.query) === null || _a === void 0 ? void 0 : _a.token;
|
|
19
|
+
if (typeof queryToken === 'string' && queryToken.length > 0) {
|
|
20
|
+
return queryToken.trim();
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
13
23
|
}
|
|
14
24
|
function requireAuth(req, res, next) {
|
|
15
25
|
if (!(0, bootstrap_admin_1.isAuthEnabled)()) {
|
package/lib/helpers.js
CHANGED
|
@@ -106,11 +106,11 @@ function isPortBusy(port) {
|
|
|
106
106
|
}
|
|
107
107
|
exports.isPortBusy = isPortBusy;
|
|
108
108
|
function hasHubArgument(cliArgs) {
|
|
109
|
-
return lodash_1.default.has(cliArgs, 'plugin["device-farm"].hub');
|
|
109
|
+
return lodash_1.default.has(cliArgs, 'plugin["tractive-device-farm"].hub');
|
|
110
110
|
}
|
|
111
111
|
exports.hasHubArgument = hasHubArgument;
|
|
112
112
|
function isCloud(cliArgs) {
|
|
113
|
-
return lodash_1.default.has(cliArgs, 'plugin["device-farm"].cloud');
|
|
113
|
+
return lodash_1.default.has(cliArgs, 'plugin["tractive-device-farm"].cloud');
|
|
114
114
|
}
|
|
115
115
|
exports.isCloud = isCloud;
|
|
116
116
|
// Standard, non-prefixed capabilities (see https://www.w3.org/TR/webdriver/#dfn-table-of-standard-capabilities)
|
package/lib/plugin.js
CHANGED
|
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.DevicePlugin = void 0;
|
|
16
16
|
/* eslint-disable no-prototype-builtins */
|
|
17
17
|
require("reflect-metadata");
|
|
18
|
-
const index_1 = __importDefault(require("./commands/index"));
|
|
19
18
|
const base_plugin_1 = __importDefault(require("@appium/base-plugin"));
|
|
20
19
|
const app_1 = require("./app");
|
|
21
20
|
const async_lock_1 = __importDefault(require("async-lock"));
|
|
@@ -155,7 +154,7 @@ class DevicePlugin extends base_plugin_1.default {
|
|
|
155
154
|
});
|
|
156
155
|
}
|
|
157
156
|
static setIncludeSimulatorState(cliArgs, deviceTypes) {
|
|
158
|
-
const cloudExists = lodash_1.default.has(cliArgs, 'plugin["device-farm"].cloud');
|
|
157
|
+
const cloudExists = lodash_1.default.has(cliArgs, 'plugin["tractive-device-farm"].cloud');
|
|
159
158
|
if (cloudExists) {
|
|
160
159
|
deviceTypes = 'real';
|
|
161
160
|
logger_1.default.info('ℹ️ Skipping Simulators as per the configuration ℹ️');
|
|
@@ -180,8 +179,11 @@ class DevicePlugin extends base_plugin_1.default {
|
|
|
180
179
|
}
|
|
181
180
|
handle(next, driver, commandName, ...args) {
|
|
182
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
//
|
|
184
|
-
//
|
|
182
|
+
// Keep the device-farm idle timer fresh on every command, then route
|
|
183
|
+
// through the dashboard's command-tracking handler so per-command logs,
|
|
184
|
+
// dashboard: scripts, and session termination all work. createSession and
|
|
185
|
+
// deleteSession are intercepted by their specialized methods below.
|
|
186
|
+
(0, device_service_1.updateCmdExecutedTime)(driver.sessionId);
|
|
185
187
|
return yield (0, session_handler_1.dashboardHandle)(next, driver, commandName, ...args);
|
|
186
188
|
});
|
|
187
189
|
}
|
|
@@ -307,7 +309,21 @@ class DevicePlugin extends base_plugin_1.default {
|
|
|
307
309
|
throw new Error(`"${error}", Please check the remote appium server log to know the reason for failure`);
|
|
308
310
|
}
|
|
309
311
|
deleteSession(next, driver, sessionId) {
|
|
312
|
+
var _a;
|
|
310
313
|
return __awaiter(this, void 0, void 0, function* () {
|
|
314
|
+
// Within a single plugin, Appium routes deleteSession to this dedicated
|
|
315
|
+
// method instead of handle(), so dashboardHandle never sees it. Invoke
|
|
316
|
+
// the dashboard's terminate path here BEFORE next() — once next() tears
|
|
317
|
+
// the driver down, the stop-recording POST returns NoSuchDriverError and
|
|
318
|
+
// the screen recording is lost. Without this, sessionTerminated only
|
|
319
|
+
// runs via SessionManager's 5-min idle timer, by which point the session
|
|
320
|
+
// is gone and video_path stays NULL in the DB.
|
|
321
|
+
try {
|
|
322
|
+
yield (0, session_handler_1.dashboardHandle)(() => Promise.resolve(), driver, 'deleteSession', sessionId);
|
|
323
|
+
}
|
|
324
|
+
catch (err) {
|
|
325
|
+
logger_1.default.warn(`Dashboard deleteSession handling failed: ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
|
|
326
|
+
}
|
|
311
327
|
(0, device_service_1.unblockDevice)({ session_id: sessionId });
|
|
312
328
|
logger_1.default.info(`📱 Unblocking the device that is blocked for session ${sessionId}`);
|
|
313
329
|
return yield next();
|
|
@@ -315,4 +331,3 @@ class DevicePlugin extends base_plugin_1.default {
|
|
|
315
331
|
}
|
|
316
332
|
}
|
|
317
333
|
exports.DevicePlugin = DevicePlugin;
|
|
318
|
-
Object.assign(DevicePlugin.prototype, index_1.default);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "/device-farm/dashboard/static/css/main.52778f63.chunk.css",
|
|
4
|
-
"main.js": "/device-farm/dashboard/static/js/main.
|
|
5
|
-
"main.js.map": "/device-farm/dashboard/static/js/main.
|
|
4
|
+
"main.js": "/device-farm/dashboard/static/js/main.9652282b.chunk.js",
|
|
5
|
+
"main.js.map": "/device-farm/dashboard/static/js/main.9652282b.chunk.js.map",
|
|
6
6
|
"runtime-main.js": "/device-farm/dashboard/static/js/runtime-main.6dc6563e.js",
|
|
7
7
|
"runtime-main.js.map": "/device-farm/dashboard/static/js/runtime-main.6dc6563e.js.map",
|
|
8
8
|
"static/css/2.58a45539.chunk.css": "/device-farm/dashboard/static/css/2.58a45539.chunk.css",
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"static/css/2.58a45539.chunk.css",
|
|
21
21
|
"static/js/2.f7672eec.chunk.js",
|
|
22
22
|
"static/css/main.52778f63.chunk.css",
|
|
23
|
-
"static/js/main.
|
|
23
|
+
"static/js/main.9652282b.chunk.js"
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/device-farm/dashboard/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/device-farm/dashboard/logo192.png"/><link rel="manifest" href="/device-farm/dashboard/manifest.json"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet"/><title>Appium Dashboard</title><link href="/device-farm/dashboard/static/css/2.58a45539.chunk.css" rel="stylesheet"><link href="/device-farm/dashboard/static/css/main.52778f63.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,u,i=r[0],c=r[1],l=r[2],p=0,s=[];p<i.length;p++)u=i[p],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&s.push(o[u][0]),o[u]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return a.push.apply(a,l||[]),t()}function t(){for(var e,r=0;r<a.length;r++){for(var t=a[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(a.splice(r--,1),e=u(u.s=t[0]))}return e}var n={},o={1:0},a=[];function u(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"static/js/"+({}[e]||e)+"."+{3:"39e9d0dc"}[e]+".chunk.js"}(e);var c=new Error;a=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",c.name="ChunkLoadError",c.type=n,c.request=a,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}return Promise.all(r)},u.m=e,u.c=n,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)u.d(t,n,function(r){return e[r]}.bind(null,n));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/device-farm/dashboard/",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonpappium-dashboard-web"]=this["webpackJsonpappium-dashboard-web"]||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="/device-farm/dashboard/static/js/2.f7672eec.chunk.js"></script><script src="/device-farm/dashboard/static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/device-farm/dashboard/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/device-farm/dashboard/logo192.png"/><link rel="manifest" href="/device-farm/dashboard/manifest.json"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet"/><title>Appium Dashboard</title><link href="/device-farm/dashboard/static/css/2.58a45539.chunk.css" rel="stylesheet"><link href="/device-farm/dashboard/static/css/main.52778f63.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,u,i=r[0],c=r[1],l=r[2],p=0,s=[];p<i.length;p++)u=i[p],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&s.push(o[u][0]),o[u]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);s.length;)s.shift()();return a.push.apply(a,l||[]),t()}function t(){for(var e,r=0;r<a.length;r++){for(var t=a[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(a.splice(r--,1),e=u(u.s=t[0]))}return e}var n={},o={1:0},a=[];function u(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,u.nc&&i.setAttribute("nonce",u.nc),i.src=function(e){return u.p+"static/js/"+({}[e]||e)+"."+{3:"39e9d0dc"}[e]+".chunk.js"}(e);var c=new Error;a=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",c.name="ChunkLoadError",c.type=n,c.request=a,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}return Promise.all(r)},u.m=e,u.c=n,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)u.d(t,n,function(r){return e[r]}.bind(null,n));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/device-farm/dashboard/",u.oe=function(e){throw console.error(e),e};var i=this["webpackJsonpappium-dashboard-web"]=this["webpackJsonpappium-dashboard-web"]||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="/device-farm/dashboard/static/js/2.f7672eec.chunk.js"></script><script src="/device-farm/dashboard/static/js/main.9652282b.chunk.js"></script></body></html>
|