mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
reconcile apphost
This commit is contained in:
parent
6f1cdf9329
commit
1fcc7ed63e
27 changed files with 8058 additions and 194 deletions
37
dashboard-ui/bower_components/fingerprintjs2/.bower.json
vendored
Normal file
37
dashboard-ui/bower_components/fingerprintjs2/.bower.json
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"name": "fingerprintjs2",
|
||||||
|
"description": "Modern & flexible browser fingerprinting library",
|
||||||
|
"main": "dist/fingerprint2.min.js",
|
||||||
|
"moduleType": [
|
||||||
|
"es6"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"browser",
|
||||||
|
"fingerprint",
|
||||||
|
"fingerprinting",
|
||||||
|
"security",
|
||||||
|
"privacy"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
"Valentin Vasilev"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"spec"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/Valve/fingerprintjs2",
|
||||||
|
"version": "1.1.3",
|
||||||
|
"_release": "1.1.3",
|
||||||
|
"_resolution": {
|
||||||
|
"type": "version",
|
||||||
|
"tag": "1.1.3",
|
||||||
|
"commit": "49e2c11cf08c13e12bf38185cec9ae159025e526"
|
||||||
|
},
|
||||||
|
"_source": "https://github.com/Valve/fingerprintjs2.git",
|
||||||
|
"_target": "^1.1.3",
|
||||||
|
"_originalSource": "fingerprintjs2",
|
||||||
|
"_direct": true
|
||||||
|
}
|
35
dashboard-ui/bower_components/fingerprintjs2/CONTRIBUTING.md
vendored
Normal file
35
dashboard-ui/bower_components/fingerprintjs2/CONTRIBUTING.md
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
Contributing to FingerprintJS2
|
||||||
|
==============================
|
||||||
|
|
||||||
|
## Found a bug?
|
||||||
|
|
||||||
|
Please submit an issue.
|
||||||
|
Include in the issue:
|
||||||
|
|
||||||
|
* List of components you received in the `get` call (make sure values are not truncated)
|
||||||
|
* If FP is different every time you call the library, include 2 versions of components
|
||||||
|
* Include your OS version
|
||||||
|
* Include steps to reproduce
|
||||||
|
* Include library call code (I need all options you used when calling the library function)
|
||||||
|
|
||||||
|
## Want to add a feature / contribute?
|
||||||
|
|
||||||
|
* Fork the project and make the required changes in it (don't forget to add specs)
|
||||||
|
* PRs w/out specs will not be accepted
|
||||||
|
* Run `gulp` to catch stylistic errors and produce the minified version.
|
||||||
|
* Run specs by opening the `specs/spec_runner.html` or typing `npm test` (requires phantomjs for console running).
|
||||||
|
* Make a PR.
|
||||||
|
* Make sure you only make one commit per feature you want to add
|
||||||
|
* Make sure your commit message is descriptive and tells what you changed (`Updated the library` - that's a bad commit message)
|
||||||
|
|
||||||
|
If your code changes the list of fingerprinting sources, please update
|
||||||
|
the README.
|
||||||
|
|
||||||
|
If you're unsure about the feature you want to add, submit an issue with
|
||||||
|
a `question` tag.
|
||||||
|
|
||||||
|
## Want to ask?
|
||||||
|
* Please read FAQ first
|
||||||
|
* If you have not found the answer you were looking for - use gitter.im to ask your question (link is in the readme)
|
||||||
|
|
||||||
|
Happy Coding!
|
18
dashboard-ui/bower_components/fingerprintjs2/FAQ.md
vendored
Normal file
18
dashboard-ui/bower_components/fingerprintjs2/FAQ.md
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#### Can I use this library to uniquely identify users?
|
||||||
|
##### No, you cannot. This library is built to be able to associate string identifiers with devices. Since there are a lot of identical devices, you will get a lot of identical identifiers.
|
||||||
|
|
||||||
|
#### OK, I get it, I cannot _uniquely_ identify users, but can I identify users at all?
|
||||||
|
##### No, you cannot. This library is strictly for non-deterministic device identification.
|
||||||
|
|
||||||
|
|
||||||
|
#### How good is your library? Can you guarantee that different devices will have different identifiers?
|
||||||
|
##### This library is not good. It has an error margin of 10-20%
|
||||||
|
|
||||||
|
#### Can you improve the library to be 100% accurate for device identification?
|
||||||
|
##### I don't think it is possible now and don't think it will be possible in the future.
|
||||||
|
|
||||||
|
#### Can you improve the library to be more accurate (since you cannot make it 100% accurate)?
|
||||||
|
##### I can, but it takes a lot of time. I need a lot of devices, enviroments and more importantly - time. Since this is my hobby project, I spend very little time on it.
|
||||||
|
|
||||||
|
#### How can I build a complete identification solution?
|
||||||
|
##### You should either use commercial services, such as https://augur.io, or develop such service yourself. If you don't know how to do it, please use StackOverflow.
|
25
dashboard-ui/bower_components/fingerprintjs2/bower.json
vendored
Normal file
25
dashboard-ui/bower_components/fingerprintjs2/bower.json
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "fingerprintjs2",
|
||||||
|
"description": "Modern & flexible browser fingerprinting library",
|
||||||
|
"main": "dist/fingerprint2.min.js",
|
||||||
|
"moduleType": [
|
||||||
|
"es6"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"browser",
|
||||||
|
"fingerprint",
|
||||||
|
"fingerprinting",
|
||||||
|
"security",
|
||||||
|
"privacy"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
"Valentin Vasilev"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"spec"
|
||||||
|
]
|
||||||
|
}
|
2
dashboard-ui/bower_components/fingerprintjs2/dist/fingerprint2.min.js
vendored
Normal file
2
dashboard-ui/bower_components/fingerprintjs2/dist/fingerprint2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1209
dashboard-ui/bower_components/fingerprintjs2/fingerprint2.js
vendored
Normal file
1209
dashboard-ui/bower_components/fingerprintjs2/fingerprint2.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
31
dashboard-ui/bower_components/fingerprintjs2/flash/FontList.as
vendored
Normal file
31
dashboard-ui/bower_components/fingerprintjs2/flash/FontList.as
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package {
|
||||||
|
import flash.display.Sprite;
|
||||||
|
import flash.display.LoaderInfo;
|
||||||
|
import flash.text.Font;
|
||||||
|
import flash.external.ExternalInterface;
|
||||||
|
|
||||||
|
public class FontList extends Sprite {
|
||||||
|
|
||||||
|
public function FontList() {
|
||||||
|
var params:Object = loadParams();
|
||||||
|
loadExternalInterface(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function loadParams():Object {
|
||||||
|
return LoaderInfo(this.root.loaderInfo).parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function loadExternalInterface(params:Object):void {
|
||||||
|
ExternalInterface.call(params.onReady, fonts());
|
||||||
|
}
|
||||||
|
|
||||||
|
private function fonts():Array {
|
||||||
|
var fontNames:Array = [];
|
||||||
|
for each (var font:Font in Font.enumerateFonts(true) )
|
||||||
|
{
|
||||||
|
fontNames.push(font.fontName);
|
||||||
|
}
|
||||||
|
return fontNames;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
dashboard-ui/bower_components/fingerprintjs2/flash/Makefile
vendored
Normal file
7
dashboard-ui/bower_components/fingerprintjs2/flash/Makefile
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
all: FontList.swf
|
||||||
|
|
||||||
|
FontList.swf: clean
|
||||||
|
mxmlc -static-link-runtime-shared-libraries FontList.as
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f FontList.swf
|
BIN
dashboard-ui/bower_components/fingerprintjs2/flash/compiled/FontList.swf
vendored
Normal file
BIN
dashboard-ui/bower_components/fingerprintjs2/flash/compiled/FontList.swf
vendored
Normal file
Binary file not shown.
29
dashboard-ui/bower_components/fingerprintjs2/gulpfile.js
vendored
Normal file
29
dashboard-ui/bower_components/fingerprintjs2/gulpfile.js
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
var gulp = require("gulp"),
|
||||||
|
eslint = require("gulp-eslint"),
|
||||||
|
rename = require("gulp-rename"),
|
||||||
|
uglify = require("gulp-uglify");
|
||||||
|
|
||||||
|
gulp.task("lint", function() {
|
||||||
|
return gulp
|
||||||
|
.src("fingerprint2.js")
|
||||||
|
.pipe(eslint())
|
||||||
|
.pipe(eslint.format())
|
||||||
|
.pipe(eslint.failOnError());
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task("minify", function() {
|
||||||
|
return gulp
|
||||||
|
.src("fingerprint2.js")
|
||||||
|
.pipe(rename({suffix: ".min"}))
|
||||||
|
.pipe(uglify({
|
||||||
|
compress: {
|
||||||
|
global_defs: {
|
||||||
|
NODEBUG: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest("dist/"));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
gulp.task("default", ["lint", "minify"], function() {});
|
98
dashboard-ui/bower_components/fingerprintjs2/index.html
vendored
Normal file
98
dashboard-ui/bower_components/fingerprintjs2/index.html
vendored
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Fingerprintjs2 test</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', 'UA-42202458-2', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
</script>
|
||||||
|
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||||
|
<style>
|
||||||
|
body{
|
||||||
|
font-family: sans-serif;
|
||||||
|
max-width: 48em;
|
||||||
|
margin: auto;
|
||||||
|
padding: 0 5%;
|
||||||
|
background: #222;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 2em 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: 1.2em
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border: none;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 1.2em;
|
||||||
|
background: #27e;
|
||||||
|
padding: 0.5em 0.75em 0.6em;
|
||||||
|
border-radius: 3px;
|
||||||
|
box-shadow: 0 3px 0 #05c;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:active {
|
||||||
|
transform: translateY(3px);
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
strong {
|
||||||
|
display: block;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 32em) {
|
||||||
|
h1 {
|
||||||
|
font-size: 4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
strong {
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="container"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<h1>Fingerprintjs2</h1>
|
||||||
|
|
||||||
|
<p>Your browser fingerprint: <strong id="fp"></strong></p>
|
||||||
|
<p><code id="time"/></p>
|
||||||
|
|
||||||
|
<button type="button" id="btn">Get my fingerprint</button>
|
||||||
|
|
||||||
|
<a href="https://github.com/Valve/fingerprintjs2"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
|
||||||
|
|
||||||
|
<script src="fingerprint2.js"></script>
|
||||||
|
<script>
|
||||||
|
$("#btn").on("click", function () {
|
||||||
|
var d1 = new Date();
|
||||||
|
var fp = new Fingerprint2();
|
||||||
|
fp.get(function(result) {
|
||||||
|
var d2 = new Date();
|
||||||
|
var timeString = "Time took to calculate the fingerprint: " + (d2 - d1) + "ms";
|
||||||
|
if(typeof window.console !== "undefined") {
|
||||||
|
console.log(timeString);
|
||||||
|
console.log(result);
|
||||||
|
}
|
||||||
|
$("#fp").text(result);
|
||||||
|
$("#time").text(timeString);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
33
dashboard-ui/bower_components/fingerprintjs2/package.json
vendored
Normal file
33
dashboard-ui/bower_components/fingerprintjs2/package.json
vendored
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"name": "fingerprintjs2",
|
||||||
|
"version": "1.1.3",
|
||||||
|
"description": "Modern & flexible browser fingerprinting library",
|
||||||
|
"main": "dist/fingerprint2.min.js",
|
||||||
|
"devDependencies": {
|
||||||
|
"gulp": "^3.8.11",
|
||||||
|
"eslint": "^0.14.1",
|
||||||
|
"gulp-eslint": "^0.4.2",
|
||||||
|
"gulp-rename": "^1.2.2",
|
||||||
|
"gulp-uglify": "^1.1.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "specs/phantomjs.runner.sh specs/spec_runner.html"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Valve/fingerprintjs2.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"browser",
|
||||||
|
"identification",
|
||||||
|
"fingerprint",
|
||||||
|
"fingerprinting",
|
||||||
|
"privacy"
|
||||||
|
],
|
||||||
|
"author": "Valentin Vasilyev",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Valve/fingerprintjs2/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/Valve/fingerprintjs2"
|
||||||
|
}
|
121
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/boot.js
vendored
Normal file
121
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/boot.js
vendored
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/**
|
||||||
|
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
||||||
|
|
||||||
|
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
|
||||||
|
|
||||||
|
The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
|
||||||
|
|
||||||
|
[jasmine-gem]: http://github.com/pivotal/jasmine-gem
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Require & Instantiate
|
||||||
|
*
|
||||||
|
* Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
|
||||||
|
*/
|
||||||
|
window.jasmine = jasmineRequire.core(jasmineRequire);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
|
||||||
|
*/
|
||||||
|
jasmineRequire.html(jasmine);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the Jasmine environment. This is used to run all specs in a project.
|
||||||
|
*/
|
||||||
|
var env = jasmine.getEnv();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## The Global Interface
|
||||||
|
*
|
||||||
|
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
|
||||||
|
*/
|
||||||
|
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||||
|
*/
|
||||||
|
extend(window, jasmineInterface);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Runner Parameters
|
||||||
|
*
|
||||||
|
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var queryString = new jasmine.QueryString({
|
||||||
|
getWindowLocation: function() { return window.location; }
|
||||||
|
});
|
||||||
|
|
||||||
|
var catchingExceptions = queryString.getParam("catch");
|
||||||
|
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
||||||
|
|
||||||
|
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||||
|
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Reporters
|
||||||
|
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
||||||
|
*/
|
||||||
|
var htmlReporter = new jasmine.HtmlReporter({
|
||||||
|
env: env,
|
||||||
|
onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
|
||||||
|
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
||||||
|
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||||
|
getContainer: function() { return document.body; },
|
||||||
|
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||||
|
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
||||||
|
timer: new jasmine.Timer()
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
|
||||||
|
*/
|
||||||
|
env.addReporter(jasmineInterface.jsApiReporter);
|
||||||
|
env.addReporter(htmlReporter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
||||||
|
*/
|
||||||
|
var specFilter = new jasmine.HtmlSpecFilter({
|
||||||
|
filterString: function() { return queryString.getParam("spec"); }
|
||||||
|
});
|
||||||
|
|
||||||
|
env.specFilter = function(spec) {
|
||||||
|
return specFilter.matches(spec.getFullName());
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
|
||||||
|
*/
|
||||||
|
window.setTimeout = window.setTimeout;
|
||||||
|
window.setInterval = window.setInterval;
|
||||||
|
window.clearTimeout = window.clearTimeout;
|
||||||
|
window.clearInterval = window.clearInterval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ## Execution
|
||||||
|
*
|
||||||
|
* Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
|
||||||
|
*/
|
||||||
|
var currentWindowOnload = window.onload;
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
if (currentWindowOnload) {
|
||||||
|
currentWindowOnload();
|
||||||
|
}
|
||||||
|
htmlReporter.initialize();
|
||||||
|
env.execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for readability above.
|
||||||
|
*/
|
||||||
|
function extend(destination, source) {
|
||||||
|
for (var property in source) destination[property] = source[property];
|
||||||
|
return destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
}());
|
446
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine-html.js
vendored
Normal file
446
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine-html.js
vendored
Normal file
|
@ -0,0 +1,446 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2008-2015 Pivotal Labs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
jasmineRequire.html = function(j$) {
|
||||||
|
j$.ResultsNode = jasmineRequire.ResultsNode();
|
||||||
|
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
||||||
|
j$.QueryString = jasmineRequire.QueryString();
|
||||||
|
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmineRequire.HtmlReporter = function(j$) {
|
||||||
|
|
||||||
|
var noopTimer = {
|
||||||
|
start: function() {},
|
||||||
|
elapsed: function() { return 0; }
|
||||||
|
};
|
||||||
|
|
||||||
|
function HtmlReporter(options) {
|
||||||
|
var env = options.env || {},
|
||||||
|
getContainer = options.getContainer,
|
||||||
|
createElement = options.createElement,
|
||||||
|
createTextNode = options.createTextNode,
|
||||||
|
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
||||||
|
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
||||||
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||||
|
timer = options.timer || noopTimer,
|
||||||
|
results = [],
|
||||||
|
specsExecuted = 0,
|
||||||
|
failureCount = 0,
|
||||||
|
pendingSpecCount = 0,
|
||||||
|
htmlReporterMain,
|
||||||
|
symbols,
|
||||||
|
failedSuites = [];
|
||||||
|
|
||||||
|
this.initialize = function() {
|
||||||
|
clearPrior();
|
||||||
|
htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
|
||||||
|
createDom('div', {className: 'banner'},
|
||||||
|
createDom('a', {className: 'title', href: 'http://jasmine.github.io/', target: '_blank'}),
|
||||||
|
createDom('span', {className: 'version'}, j$.version)
|
||||||
|
),
|
||||||
|
createDom('ul', {className: 'symbol-summary'}),
|
||||||
|
createDom('div', {className: 'alert'}),
|
||||||
|
createDom('div', {className: 'results'},
|
||||||
|
createDom('div', {className: 'failures'})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
getContainer().appendChild(htmlReporterMain);
|
||||||
|
|
||||||
|
symbols = find('.symbol-summary');
|
||||||
|
};
|
||||||
|
|
||||||
|
var totalSpecsDefined;
|
||||||
|
this.jasmineStarted = function(options) {
|
||||||
|
totalSpecsDefined = options.totalSpecsDefined || 0;
|
||||||
|
timer.start();
|
||||||
|
};
|
||||||
|
|
||||||
|
var summary = createDom('div', {className: 'summary'});
|
||||||
|
|
||||||
|
var topResults = new j$.ResultsNode({}, '', null),
|
||||||
|
currentParent = topResults;
|
||||||
|
|
||||||
|
this.suiteStarted = function(result) {
|
||||||
|
currentParent.addChild(result, 'suite');
|
||||||
|
currentParent = currentParent.last();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.suiteDone = function(result) {
|
||||||
|
if (result.status == 'failed') {
|
||||||
|
failedSuites.push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentParent == topResults) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentParent = currentParent.parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.specStarted = function(result) {
|
||||||
|
currentParent.addChild(result, 'spec');
|
||||||
|
};
|
||||||
|
|
||||||
|
var failures = [];
|
||||||
|
this.specDone = function(result) {
|
||||||
|
if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
|
||||||
|
console.error('Spec \'' + result.fullName + '\' has no expectations.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.status != 'disabled') {
|
||||||
|
specsExecuted++;
|
||||||
|
}
|
||||||
|
|
||||||
|
symbols.appendChild(createDom('li', {
|
||||||
|
className: noExpectations(result) ? 'empty' : result.status,
|
||||||
|
id: 'spec_' + result.id,
|
||||||
|
title: result.fullName
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
if (result.status == 'failed') {
|
||||||
|
failureCount++;
|
||||||
|
|
||||||
|
var failure =
|
||||||
|
createDom('div', {className: 'spec-detail failed'},
|
||||||
|
createDom('div', {className: 'description'},
|
||||||
|
createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
|
||||||
|
),
|
||||||
|
createDom('div', {className: 'messages'})
|
||||||
|
);
|
||||||
|
var messages = failure.childNodes[1];
|
||||||
|
|
||||||
|
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||||
|
var expectation = result.failedExpectations[i];
|
||||||
|
messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
|
||||||
|
messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
|
||||||
|
}
|
||||||
|
|
||||||
|
failures.push(failure);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.status == 'pending') {
|
||||||
|
pendingSpecCount++;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.jasmineDone = function() {
|
||||||
|
var banner = find('.banner');
|
||||||
|
var alert = find('.alert');
|
||||||
|
alert.appendChild(createDom('span', {className: 'duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
|
||||||
|
|
||||||
|
banner.appendChild(
|
||||||
|
createDom('div', { className: 'run-options' },
|
||||||
|
createDom('span', { className: 'trigger' }, 'Options'),
|
||||||
|
createDom('div', { className: 'payload' },
|
||||||
|
createDom('div', { className: 'exceptions' },
|
||||||
|
createDom('input', {
|
||||||
|
className: 'raise',
|
||||||
|
id: 'raise-exceptions',
|
||||||
|
type: 'checkbox'
|
||||||
|
}),
|
||||||
|
createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions')),
|
||||||
|
createDom('div', { className: 'throw-failures' },
|
||||||
|
createDom('input', {
|
||||||
|
className: 'throw',
|
||||||
|
id: 'throw-failures',
|
||||||
|
type: 'checkbox'
|
||||||
|
}),
|
||||||
|
createDom('label', { className: 'label', 'for': 'throw-failures' }, 'stop spec on expectation failure'))
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
var raiseCheckbox = find('#raise-exceptions');
|
||||||
|
|
||||||
|
raiseCheckbox.checked = !env.catchingExceptions();
|
||||||
|
raiseCheckbox.onclick = onRaiseExceptionsClick;
|
||||||
|
|
||||||
|
var throwCheckbox = find('#throw-failures');
|
||||||
|
throwCheckbox.checked = env.throwingExpectationFailures();
|
||||||
|
throwCheckbox.onclick = onThrowExpectationsClick;
|
||||||
|
|
||||||
|
var optionsMenu = find('.run-options'),
|
||||||
|
optionsTrigger = optionsMenu.querySelector('.trigger'),
|
||||||
|
optionsPayload = optionsMenu.querySelector('.payload'),
|
||||||
|
isOpen = /\bopen\b/;
|
||||||
|
|
||||||
|
optionsTrigger.onclick = function() {
|
||||||
|
if (isOpen.test(optionsPayload.className)) {
|
||||||
|
optionsPayload.className = optionsPayload.className.replace(isOpen, '');
|
||||||
|
} else {
|
||||||
|
optionsPayload.className += ' open';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (specsExecuted < totalSpecsDefined) {
|
||||||
|
var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
|
||||||
|
alert.appendChild(
|
||||||
|
createDom('span', {className: 'bar skipped'},
|
||||||
|
createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var statusBarMessage = '';
|
||||||
|
var statusBarClassName = 'bar ';
|
||||||
|
|
||||||
|
if (totalSpecsDefined > 0) {
|
||||||
|
statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
|
||||||
|
if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
|
||||||
|
statusBarClassName += (failureCount > 0) ? 'failed' : 'passed';
|
||||||
|
} else {
|
||||||
|
statusBarClassName += 'skipped';
|
||||||
|
statusBarMessage += 'No specs found';
|
||||||
|
}
|
||||||
|
|
||||||
|
alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
|
||||||
|
|
||||||
|
for(i = 0; i < failedSuites.length; i++) {
|
||||||
|
var failedSuite = failedSuites[i];
|
||||||
|
for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
|
||||||
|
var errorBarMessage = 'AfterAll ' + failedSuite.failedExpectations[j].message;
|
||||||
|
var errorBarClassName = 'bar errored';
|
||||||
|
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = find('.results');
|
||||||
|
results.appendChild(summary);
|
||||||
|
|
||||||
|
summaryList(topResults, summary);
|
||||||
|
|
||||||
|
function summaryList(resultsTree, domParent) {
|
||||||
|
var specListNode;
|
||||||
|
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||||
|
var resultNode = resultsTree.children[i];
|
||||||
|
if (resultNode.type == 'suite') {
|
||||||
|
var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
|
||||||
|
createDom('li', {className: 'suite-detail'},
|
||||||
|
createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
summaryList(resultNode, suiteListNode);
|
||||||
|
domParent.appendChild(suiteListNode);
|
||||||
|
}
|
||||||
|
if (resultNode.type == 'spec') {
|
||||||
|
if (domParent.getAttribute('class') != 'specs') {
|
||||||
|
specListNode = createDom('ul', {className: 'specs'});
|
||||||
|
domParent.appendChild(specListNode);
|
||||||
|
}
|
||||||
|
var specDescription = resultNode.result.description;
|
||||||
|
if(noExpectations(resultNode.result)) {
|
||||||
|
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
||||||
|
}
|
||||||
|
if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
|
||||||
|
specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
|
||||||
|
}
|
||||||
|
specListNode.appendChild(
|
||||||
|
createDom('li', {
|
||||||
|
className: resultNode.result.status,
|
||||||
|
id: 'spec-' + resultNode.result.id
|
||||||
|
},
|
||||||
|
createDom('a', {href: specHref(resultNode.result)}, specDescription)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failures.length) {
|
||||||
|
alert.appendChild(
|
||||||
|
createDom('span', {className: 'menu bar spec-list'},
|
||||||
|
createDom('span', {}, 'Spec List | '),
|
||||||
|
createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
|
||||||
|
alert.appendChild(
|
||||||
|
createDom('span', {className: 'menu bar failure-list'},
|
||||||
|
createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
|
||||||
|
createDom('span', {}, ' | Failures ')));
|
||||||
|
|
||||||
|
find('.failures-menu').onclick = function() {
|
||||||
|
setMenuModeTo('failure-list');
|
||||||
|
};
|
||||||
|
find('.spec-list-menu').onclick = function() {
|
||||||
|
setMenuModeTo('spec-list');
|
||||||
|
};
|
||||||
|
|
||||||
|
setMenuModeTo('failure-list');
|
||||||
|
|
||||||
|
var failureNode = find('.failures');
|
||||||
|
for (var i = 0; i < failures.length; i++) {
|
||||||
|
failureNode.appendChild(failures[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
function find(selector) {
|
||||||
|
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearPrior() {
|
||||||
|
// return the reporter
|
||||||
|
var oldReporter = find('');
|
||||||
|
|
||||||
|
if(oldReporter) {
|
||||||
|
getContainer().removeChild(oldReporter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDom(type, attrs, childrenVarArgs) {
|
||||||
|
var el = createElement(type);
|
||||||
|
|
||||||
|
for (var i = 2; i < arguments.length; i++) {
|
||||||
|
var child = arguments[i];
|
||||||
|
|
||||||
|
if (typeof child === 'string') {
|
||||||
|
el.appendChild(createTextNode(child));
|
||||||
|
} else {
|
||||||
|
if (child) {
|
||||||
|
el.appendChild(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var attr in attrs) {
|
||||||
|
if (attr == 'className') {
|
||||||
|
el[attr] = attrs[attr];
|
||||||
|
} else {
|
||||||
|
el.setAttribute(attr, attrs[attr]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pluralize(singular, count) {
|
||||||
|
var word = (count == 1 ? singular : singular + 's');
|
||||||
|
|
||||||
|
return '' + count + ' ' + word;
|
||||||
|
}
|
||||||
|
|
||||||
|
function specHref(result) {
|
||||||
|
return addToExistingQueryString('spec', result.fullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
function defaultQueryString(key, value) {
|
||||||
|
return '?' + key + '=' + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMenuModeTo(mode) {
|
||||||
|
htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
function noExpectations(result) {
|
||||||
|
return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
|
||||||
|
result.status === 'passed';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return HtmlReporter;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmineRequire.HtmlSpecFilter = function() {
|
||||||
|
function HtmlSpecFilter(options) {
|
||||||
|
var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||||
|
var filterPattern = new RegExp(filterString);
|
||||||
|
|
||||||
|
this.matches = function(specName) {
|
||||||
|
return filterPattern.test(specName);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return HtmlSpecFilter;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmineRequire.ResultsNode = function() {
|
||||||
|
function ResultsNode(result, type, parent) {
|
||||||
|
this.result = result;
|
||||||
|
this.type = type;
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
|
this.children = [];
|
||||||
|
|
||||||
|
this.addChild = function(result, type) {
|
||||||
|
this.children.push(new ResultsNode(result, type, this));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.last = function() {
|
||||||
|
return this.children[this.children.length - 1];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultsNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmineRequire.QueryString = function() {
|
||||||
|
function QueryString(options) {
|
||||||
|
|
||||||
|
this.navigateWithNewParam = function(key, value) {
|
||||||
|
options.getWindowLocation().search = this.fullStringWithNewParam(key, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.fullStringWithNewParam = function(key, value) {
|
||||||
|
var paramMap = queryStringToParamMap();
|
||||||
|
paramMap[key] = value;
|
||||||
|
return toQueryString(paramMap);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getParam = function(key) {
|
||||||
|
return queryStringToParamMap()[key];
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
function toQueryString(paramMap) {
|
||||||
|
var qStrPairs = [];
|
||||||
|
for (var prop in paramMap) {
|
||||||
|
qStrPairs.push(encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]));
|
||||||
|
}
|
||||||
|
return '?' + qStrPairs.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
function queryStringToParamMap() {
|
||||||
|
var paramStr = options.getWindowLocation().search.substring(1),
|
||||||
|
params = [],
|
||||||
|
paramMap = {};
|
||||||
|
|
||||||
|
if (paramStr.length > 0) {
|
||||||
|
params = paramStr.split('&');
|
||||||
|
for (var i = 0; i < params.length; i++) {
|
||||||
|
var p = params[i].split('=');
|
||||||
|
var value = decodeURIComponent(p[1]);
|
||||||
|
if (value === 'true' || value === 'false') {
|
||||||
|
value = JSON.parse(value);
|
||||||
|
}
|
||||||
|
paramMap[decodeURIComponent(p[0])] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paramMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return QueryString;
|
||||||
|
};
|
1757
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine-matchers.js
vendored
Normal file
1757
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine-matchers.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
58
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine.css
vendored
Normal file
58
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine.css
vendored
Normal file
File diff suppressed because one or more lines are too long
3298
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine.js
vendored
Normal file
3298
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
BIN
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine_favicon.png
vendored
Normal file
BIN
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/jasmine_favicon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
261
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/terminal.js
vendored
Normal file
261
dashboard-ui/bower_components/fingerprintjs2/specs/lib/jasmine-2.3.4/terminal.js
vendored
Normal file
|
@ -0,0 +1,261 @@
|
||||||
|
(function(global) {
|
||||||
|
var UNDEFINED,
|
||||||
|
exportObject;
|
||||||
|
|
||||||
|
if (typeof module !== "undefined" && module.exports) {
|
||||||
|
exportObject = exports;
|
||||||
|
} else {
|
||||||
|
exportObject = global.jasmineReporters = global.jasmineReporters || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
function elapsed(start, end) { return (end - start)/1000; }
|
||||||
|
function isFailed(obj) { return obj.status === "failed"; }
|
||||||
|
function isSkipped(obj) { return obj.status === "pending"; }
|
||||||
|
function isDisabled(obj) { return obj.status === "disabled"; }
|
||||||
|
function extend(dupe, obj) { // performs a shallow copy of all props of `obj` onto `dupe`
|
||||||
|
for (var prop in obj) {
|
||||||
|
if (obj.hasOwnProperty(prop)) {
|
||||||
|
dupe[prop] = obj[prop];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dupe;
|
||||||
|
}
|
||||||
|
function log(str) {
|
||||||
|
var con = global.console || console;
|
||||||
|
if (con && con.log && str && str.length) {
|
||||||
|
con.log(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic reporter that outputs spec results to the terminal.
|
||||||
|
* Use this reporter in your build pipeline.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* jasmine.getEnv().addReporter(new jasmineReporters.TerminalReporter(options);
|
||||||
|
*
|
||||||
|
* @param {object} [options]
|
||||||
|
* @param {number} [options.verbosity] meaningful values are 0 through 3; anything
|
||||||
|
* greater than 3 is treated as 3 (default: 2)
|
||||||
|
* @param {boolean} [options.color] print in color or not (default: true)
|
||||||
|
* @param {boolean} [opts.showStack] show stack trace for failed specs (default: false)
|
||||||
|
*/
|
||||||
|
var DEFAULT_VERBOSITY = 2,
|
||||||
|
ATTRIBUTES_TO_ANSI = {
|
||||||
|
"off": 0,
|
||||||
|
"bold": 1,
|
||||||
|
"red": 31,
|
||||||
|
"green": 32,
|
||||||
|
"yellow": 33,
|
||||||
|
"blue": 34,
|
||||||
|
"magenta": 35,
|
||||||
|
"cyan": 36
|
||||||
|
};
|
||||||
|
|
||||||
|
exportObject.TerminalReporter = function(options) {
|
||||||
|
var self = this;
|
||||||
|
self.started = false;
|
||||||
|
self.finished = false;
|
||||||
|
|
||||||
|
// sanitize arguments
|
||||||
|
options = options || {};
|
||||||
|
self.verbosity = typeof options.verbosity === "number" ? options.verbosity : DEFAULT_VERBOSITY;
|
||||||
|
self.color = options.color;
|
||||||
|
self.showStack = options.showStack;
|
||||||
|
|
||||||
|
var indent_string = ' ',
|
||||||
|
startTime,
|
||||||
|
currentSuite = null,
|
||||||
|
totalSpecsExecuted = 0,
|
||||||
|
totalSpecsSkipped = 0,
|
||||||
|
totalSpecsDisabled = 0,
|
||||||
|
totalSpecsFailed = 0,
|
||||||
|
totalSpecsDefined,
|
||||||
|
// when use use fit, jasmine never calls suiteStarted / suiteDone, so make a fake one to use
|
||||||
|
fakeFocusedSuite = {
|
||||||
|
id: 'focused',
|
||||||
|
description: 'focused specs',
|
||||||
|
fullName: 'focused specs'
|
||||||
|
};
|
||||||
|
|
||||||
|
var __suites = {}, __specs = {};
|
||||||
|
function getSuite(suite) {
|
||||||
|
__suites[suite.id] = extend(__suites[suite.id] || {}, suite);
|
||||||
|
return __suites[suite.id];
|
||||||
|
}
|
||||||
|
function getSpec(spec) {
|
||||||
|
__specs[spec.id] = extend(__specs[spec.id] || {}, spec);
|
||||||
|
return __specs[spec.id];
|
||||||
|
}
|
||||||
|
|
||||||
|
self.jasmineStarted = function(summary) {
|
||||||
|
totalSpecsDefined = summary && summary.totalSpecsDefined || NaN;
|
||||||
|
startTime = exportObject.startTime = new Date();
|
||||||
|
self.started = true;
|
||||||
|
};
|
||||||
|
self.suiteStarted = function(suite) {
|
||||||
|
suite = getSuite(suite);
|
||||||
|
suite._specs = 0;
|
||||||
|
suite._nestedSpecs = 0;
|
||||||
|
suite._failures = 0;
|
||||||
|
suite._nestedFailures = 0;
|
||||||
|
suite._skipped = 0;
|
||||||
|
suite._nestedSkipped = 0;
|
||||||
|
suite._disabled = 0;
|
||||||
|
suite._nestedDisabled = 0;
|
||||||
|
suite._depth = currentSuite ? currentSuite._depth+1 : 1;
|
||||||
|
suite._parent = currentSuite;
|
||||||
|
currentSuite = suite;
|
||||||
|
if (self.verbosity > 2) {
|
||||||
|
log(indentWithLevel(suite._depth, inColor(suite.description, "bold")));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.specStarted = function(spec) {
|
||||||
|
if (!currentSuite) {
|
||||||
|
// focused spec (fit) -- suiteStarted was never called
|
||||||
|
self.suiteStarted(fakeFocusedSuite);
|
||||||
|
}
|
||||||
|
spec = getSpec(spec);
|
||||||
|
spec._suite = currentSuite;
|
||||||
|
spec._depth = currentSuite._depth+1;
|
||||||
|
currentSuite._specs++;
|
||||||
|
if (self.verbosity > 2) {
|
||||||
|
log(indentWithLevel(spec._depth, spec.description + ' ...'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.specDone = function(spec) {
|
||||||
|
spec = getSpec(spec);
|
||||||
|
var failed = false,
|
||||||
|
skipped = false,
|
||||||
|
disabled = false,
|
||||||
|
color = 'green',
|
||||||
|
resultText = '';
|
||||||
|
if (isSkipped(spec)) {
|
||||||
|
skipped = true;
|
||||||
|
color = '';
|
||||||
|
spec._suite._skipped++;
|
||||||
|
totalSpecsSkipped++;
|
||||||
|
}
|
||||||
|
if (isFailed(spec)) {
|
||||||
|
failed = true;
|
||||||
|
color = 'red';
|
||||||
|
spec._suite._failures++;
|
||||||
|
totalSpecsFailed++;
|
||||||
|
}
|
||||||
|
if (isDisabled(spec)) {
|
||||||
|
disabled = true;
|
||||||
|
color = 'yellow';
|
||||||
|
spec._suite._disabled++;
|
||||||
|
totalSpecsDisabled++;
|
||||||
|
}
|
||||||
|
totalSpecsExecuted++;
|
||||||
|
|
||||||
|
if (self.verbosity === 2) {
|
||||||
|
resultText = failed ? 'F' : skipped ? 'S' : disabled ? 'D' : '.';
|
||||||
|
} else if (self.verbosity > 2) {
|
||||||
|
resultText = ' ' + (failed ? 'Failed' : skipped ? 'Skipped' : disabled ? 'Disabled' : 'Passed');
|
||||||
|
}
|
||||||
|
log(inColor(resultText, color));
|
||||||
|
|
||||||
|
if (failed) {
|
||||||
|
if (self.verbosity === 1) {
|
||||||
|
log(spec.fullName);
|
||||||
|
} else if (self.verbosity === 2) {
|
||||||
|
log(' ');
|
||||||
|
log(indentWithLevel(spec._depth, spec.fullName));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < spec.failedExpectations.length; i++) {
|
||||||
|
log(inColor(indentWithLevel(spec._depth, indent_string + spec.failedExpectations[i].message), color));
|
||||||
|
if (self.showStack){
|
||||||
|
logStackLines(spec._depth, spec.failedExpectations[i].stack.split('\n'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.suiteDone = function(suite) {
|
||||||
|
suite = getSuite(suite);
|
||||||
|
if (suite._parent === UNDEFINED) {
|
||||||
|
// disabled suite (xdescribe) -- suiteStarted was never called
|
||||||
|
self.suiteStarted(suite);
|
||||||
|
}
|
||||||
|
if (suite._parent) {
|
||||||
|
suite._parent._specs += suite._specs + suite._nestedSpecs;
|
||||||
|
suite._parent._failures += suite._failures + suite._nestedFailures;
|
||||||
|
suite._parent._skipped += suite._skipped + suite._nestedSkipped;
|
||||||
|
suite._parent._disabled += suite._disabled + suite._nestedDisabled;
|
||||||
|
|
||||||
|
}
|
||||||
|
currentSuite = suite._parent;
|
||||||
|
if (self.verbosity < 3) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var total = suite._specs + suite._nestedSpecs,
|
||||||
|
failed = suite._failures + suite._nestedFailures,
|
||||||
|
skipped = suite._skipped + suite._nestedSkipped,
|
||||||
|
disabled = suite._disabled + suite._nestedDisabled,
|
||||||
|
passed = total - failed - skipped,
|
||||||
|
color = failed ? 'red+bold' : 'green+bold',
|
||||||
|
str = passed + ' of ' + total + ' passed (' + skipped + ' skipped, ' + disabled + ' disabled)';
|
||||||
|
log(indentWithLevel(suite._depth, inColor(str+'.', color)));
|
||||||
|
};
|
||||||
|
self.jasmineDone = function() {
|
||||||
|
if (currentSuite) {
|
||||||
|
// focused spec (fit) -- suiteDone was never called
|
||||||
|
self.suiteDone(fakeFocusedSuite);
|
||||||
|
}
|
||||||
|
var now = new Date(),
|
||||||
|
dur = elapsed(startTime, now),
|
||||||
|
total = totalSpecsDefined || totalSpecsExecuted,
|
||||||
|
disabled = total - totalSpecsExecuted + totalSpecsDisabled,
|
||||||
|
skipped = totalSpecsSkipped,
|
||||||
|
spec_str = total + (total === 1 ? " spec, " : " specs, "),
|
||||||
|
fail_str = totalSpecsFailed + (totalSpecsFailed === 1 ? " failure, " : " failures, "),
|
||||||
|
skip_str = skipped + " skipped, ",
|
||||||
|
disabled_str = disabled + " disabled in ",
|
||||||
|
summary_str = spec_str + fail_str + skip_str + disabled_str + dur + "s.",
|
||||||
|
result_str = (totalSpecsFailed && "FAILURE: " || "SUCCESS: ") + summary_str,
|
||||||
|
result_color = totalSpecsFailed && "red+bold" || "green+bold";
|
||||||
|
|
||||||
|
if (self.verbosity === 2) {
|
||||||
|
log('');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.verbosity > 0) {
|
||||||
|
log(inColor(result_str, result_color));
|
||||||
|
}
|
||||||
|
//log("Specs skipped but not reported (entire suite skipped or targeted to specific specs)", totalSpecsDefined - totalSpecsExecuted + totalSpecsDisabled);
|
||||||
|
|
||||||
|
self.finished = true;
|
||||||
|
// this is so phantomjs-testrunner.js can tell if we're done executing
|
||||||
|
exportObject.endTime = now;
|
||||||
|
};
|
||||||
|
function indentWithLevel(level, string) {
|
||||||
|
return new Array(level).join(indent_string) + string;
|
||||||
|
}
|
||||||
|
function logStackLines(depth, lines) {
|
||||||
|
lines.forEach(function(line){
|
||||||
|
log(inColor(indentWithLevel(depth, indent_string + line), 'magenta'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function inColor(string, color) {
|
||||||
|
var color_attributes = color && color.split("+"),
|
||||||
|
ansi_string = "",
|
||||||
|
i;
|
||||||
|
|
||||||
|
if (!self.color || !color_attributes) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; i < color_attributes.length; i++) {
|
||||||
|
ansi_string += "\033[" + ATTRIBUTES_TO_ANSI[color_attributes[i]] + "m";
|
||||||
|
}
|
||||||
|
ansi_string += string + "\033[" + ATTRIBUTES_TO_ANSI["off"] + "m";
|
||||||
|
|
||||||
|
return ansi_string;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})(this);
|
230
dashboard-ui/bower_components/fingerprintjs2/specs/phantomjs-testrunner.js
vendored
Normal file
230
dashboard-ui/bower_components/fingerprintjs2/specs/phantomjs-testrunner.js
vendored
Normal file
|
@ -0,0 +1,230 @@
|
||||||
|
/* globals jasmineRequire, phantom */
|
||||||
|
// Verify arguments
|
||||||
|
var system = require('system');
|
||||||
|
var args;
|
||||||
|
|
||||||
|
if(phantom.args) {
|
||||||
|
args = phantom.args;
|
||||||
|
} else {
|
||||||
|
args = system.args.slice(1);//use system args for phantom 2.0+
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length === 0) {
|
||||||
|
console.log("Simple JasmineBDD test runner for phantom.js");
|
||||||
|
console.log("Usage: phantomjs-testrunner.js url_to_runner.html");
|
||||||
|
console.log("Accepts http:// and file:// urls");
|
||||||
|
console.log("");
|
||||||
|
console.log("NOTE: This script depends on jasmine.HtmlReporter being used\non the page, for the DOM elements it creates.\n");
|
||||||
|
phantom.exit(2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var fs = require("fs"),
|
||||||
|
pages = [],
|
||||||
|
page, address, resultsKey, i, l;
|
||||||
|
|
||||||
|
|
||||||
|
var setupPageFn = function(p, k) {
|
||||||
|
return function() {
|
||||||
|
overloadPageEvaluate(p);
|
||||||
|
setupWriteFileFunction(p, k, fs.separator);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0, l = args.length; i < l; i++) {
|
||||||
|
address = args[i];
|
||||||
|
console.log("Loading " + address);
|
||||||
|
|
||||||
|
// if provided a url without a protocol, try to use file://
|
||||||
|
address = address.indexOf("://") === -1 ? "file://" + address : address;
|
||||||
|
|
||||||
|
// create a WebPage object to work with
|
||||||
|
page = require("webpage").create();
|
||||||
|
page.url = address;
|
||||||
|
|
||||||
|
// When initialized, inject the reporting functions before the page is loaded
|
||||||
|
// (and thus before it will try to utilize the functions)
|
||||||
|
resultsKey = "__jr" + Math.ceil(Math.random() * 1000000);
|
||||||
|
page.onInitialized = setupPageFn(page, resultsKey);
|
||||||
|
page.open(address, processPage(null, page, resultsKey));
|
||||||
|
pages.push(page);
|
||||||
|
|
||||||
|
page.onConsoleMessage = logAndWorkAroundDefaultLineBreaking;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bail when all pages have been processed
|
||||||
|
setInterval(function(){
|
||||||
|
var exit_code = 0;
|
||||||
|
for (i = 0, l = pages.length; i < l; i++) {
|
||||||
|
page = pages[i];
|
||||||
|
if (page.__exit_code === null) {
|
||||||
|
// wait until later
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
exit_code |= page.__exit_code;
|
||||||
|
}
|
||||||
|
phantom.exit(exit_code);
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Thanks to hoisting, these helpers are still available when needed above
|
||||||
|
/**
|
||||||
|
* Logs a message. Does not add a line-break for single characters '.' and 'F' or lines ending in ' ...'
|
||||||
|
*
|
||||||
|
* @param msg
|
||||||
|
*/
|
||||||
|
function logAndWorkAroundDefaultLineBreaking(msg) {
|
||||||
|
var interpretAsWithoutNewline = /(^(\033\[\d+m)*[\.F](\033\[\d+m)*$)|( \.\.\.$)/;
|
||||||
|
if (navigator.userAgent.indexOf("Windows") < 0 && interpretAsWithoutNewline.test(msg)) {
|
||||||
|
try {
|
||||||
|
system.stdout.write(msg);
|
||||||
|
} catch (e) {
|
||||||
|
var fs = require('fs');
|
||||||
|
fs.write('/dev/stdout', msg, 'w');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stringifies the function, replacing any %placeholders% with mapped values.
|
||||||
|
*
|
||||||
|
* @param {function} fn The function to replace occurrences within.
|
||||||
|
* @param {object} replacements Key => Value object of string replacements.
|
||||||
|
*/
|
||||||
|
function replaceFunctionPlaceholders(fn, replacements) {
|
||||||
|
if (replacements && typeof replacements === "object") {
|
||||||
|
fn = fn.toString();
|
||||||
|
for (var p in replacements) {
|
||||||
|
if (replacements.hasOwnProperty(p)) {
|
||||||
|
var match = new RegExp("%" + p + "%", "g");
|
||||||
|
do {
|
||||||
|
fn = fn.replace(match, replacements[p]);
|
||||||
|
} while(fn.indexOf(match) !== -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces the "evaluate" method with one we can easily do substitution with.
|
||||||
|
*
|
||||||
|
* @param {phantomjs.WebPage} page The WebPage object to overload
|
||||||
|
*/
|
||||||
|
function overloadPageEvaluate(page) {
|
||||||
|
page._evaluate = page.evaluate;
|
||||||
|
page.evaluate = function(fn, replacements) { return page._evaluate(replaceFunctionPlaceholders(fn, replacements)); };
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Stubs a fake writeFile function into the test runner.
|
||||||
|
*
|
||||||
|
* @param {phantomjs.WebPage} page The WebPage object to inject functions into.
|
||||||
|
* @param {string} key The name of the global object in which file data should
|
||||||
|
* be stored for later retrieval.
|
||||||
|
*/
|
||||||
|
// TODO: not bothering with error checking for now (closed environment)
|
||||||
|
function setupWriteFileFunction(page, key, path_separator) {
|
||||||
|
page.evaluate(function(){
|
||||||
|
window["%resultsObj%"] = {};
|
||||||
|
window.fs_path_separator = "%fs_path_separator%";
|
||||||
|
window.__phantom_writeFile = function(filename, text) {
|
||||||
|
window["%resultsObj%"][filename] = text;
|
||||||
|
};
|
||||||
|
}, {resultsObj: key, fs_path_separator: path_separator.replace("\\", "\\\\")});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the loaded page's filename => output object.
|
||||||
|
*
|
||||||
|
* @param {phantomjs.WebPage} page The WebPage object to retrieve data from.
|
||||||
|
* @param {string} key The name of the global object to be returned. Should
|
||||||
|
* be the same key provided to setupWriteFileFunction.
|
||||||
|
*/
|
||||||
|
function getXmlResults(page, key) {
|
||||||
|
return page.evaluate(function(){
|
||||||
|
return window["%resultsObj%"] || {};
|
||||||
|
}, {resultsObj: key});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes a page.
|
||||||
|
*
|
||||||
|
* @param {string} status The status from opening the page via WebPage#open.
|
||||||
|
* @param {phantomjs.WebPage} page The WebPage to be processed.
|
||||||
|
*/
|
||||||
|
function processPage(status, page, resultsKey) {
|
||||||
|
if (status === null && page) {
|
||||||
|
page.__exit_code = null;
|
||||||
|
return function(stat){
|
||||||
|
processPage(stat, page, resultsKey);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (status !== "success") {
|
||||||
|
console.error("Unable to load resource: " + address);
|
||||||
|
page.__exit_code = 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var isFinished = function() {
|
||||||
|
return page.evaluate(function(){
|
||||||
|
// if there's a JUnitXmlReporter, return a boolean indicating if it is finished
|
||||||
|
if (window.jasmineReporters && window.jasmineReporters.startTime) {
|
||||||
|
return !!window.jasmineReporters.endTime;
|
||||||
|
}
|
||||||
|
// otherwise, scrape the DOM for the HtmlReporter "finished in ..." output
|
||||||
|
var durElem = document.querySelector(".html-reporter .duration");
|
||||||
|
if (!durElem) {
|
||||||
|
durElem = document.querySelector(".jasmine_html-reporter .duration");
|
||||||
|
}
|
||||||
|
return durElem && durElem.textContent && durElem.textContent.toLowerCase().indexOf("finished in") === 0;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var getResultsFromHtmlRunner = function() {
|
||||||
|
return page.evaluate(function(){
|
||||||
|
var resultElem = document.querySelector(".html-reporter .alert .bar");
|
||||||
|
if (!resultElem) {
|
||||||
|
resultElem = document.querySelector(".jasmine_html-reporter .alert .bar");
|
||||||
|
}
|
||||||
|
return resultElem && resultElem.textContent &&
|
||||||
|
resultElem.textContent.match(/(\d+) spec.* (\d+) failure.*/) ||
|
||||||
|
["Unable to determine success or failure."];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var timeout = 60000;
|
||||||
|
var loopInterval = 100;
|
||||||
|
var ival = setInterval(function(){
|
||||||
|
if (isFinished()) {
|
||||||
|
// get the results that need to be written to disk
|
||||||
|
var fs = require("fs"),
|
||||||
|
xml_results = getXmlResults(page, resultsKey),
|
||||||
|
output;
|
||||||
|
for (var filename in xml_results) {
|
||||||
|
if (xml_results.hasOwnProperty(filename) && (output = xml_results[filename]) && typeof(output) === "string") {
|
||||||
|
fs.write(filename, output, "w");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print out a success / failure message of the results
|
||||||
|
var results = getResultsFromHtmlRunner();
|
||||||
|
var failures = Number(results[2]);
|
||||||
|
if (failures > 0) {
|
||||||
|
page.__exit_code = 1;
|
||||||
|
clearInterval(ival);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
page.__exit_code = 0;
|
||||||
|
clearInterval(ival);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
timeout -= loopInterval;
|
||||||
|
if (timeout <= 0) {
|
||||||
|
console.log('Page has timed out; aborting.');
|
||||||
|
page.__exit_code = 2;
|
||||||
|
clearInterval(ival);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, loopInterval);
|
||||||
|
}
|
||||||
|
}
|
40
dashboard-ui/bower_components/fingerprintjs2/specs/phantomjs.runner.sh
vendored
Normal file
40
dashboard-ui/bower_components/fingerprintjs2/specs/phantomjs.runner.sh
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# sanity check to make sure phantomjs exists in the PATH
|
||||||
|
hash /usr/bin/env phantomjs &> /dev/null
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
echo "ERROR: phantomjs is not installed"
|
||||||
|
echo "Please visit http://www.phantomjs.org/"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# sanity check number of args
|
||||||
|
if [ $# -lt 1 ]
|
||||||
|
then
|
||||||
|
echo "Usage: `basename $0` path_to_runner.html"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPTDIR=$(dirname `perl -e 'use Cwd "abs_path";print abs_path(shift)' $0`)
|
||||||
|
TESTFILE=""
|
||||||
|
while (( "$#" )); do
|
||||||
|
if [ ${1:0:7} == "http://" -o ${1:0:8} == "https://" ]; then
|
||||||
|
TESTFILE="$TESTFILE $1"
|
||||||
|
else
|
||||||
|
TESTFILE="$TESTFILE `perl -e 'use Cwd "abs_path";print abs_path(shift)' $1`"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# cleanup previous test runs
|
||||||
|
cd $SCRIPTDIR
|
||||||
|
rm -f *.xml
|
||||||
|
|
||||||
|
# make sure phantomjs submodule is initialized
|
||||||
|
cd ..
|
||||||
|
git submodule update --init
|
||||||
|
|
||||||
|
# fire up the phantomjs environment and run the test
|
||||||
|
cd $SCRIPTDIR
|
||||||
|
/usr/bin/env phantomjs $SCRIPTDIR/phantomjs-testrunner.js $TESTFILE
|
35
dashboard-ui/bower_components/fingerprintjs2/specs/spec_runner.html
vendored
Normal file
35
dashboard-ui/bower_components/fingerprintjs2/specs/spec_runner.html
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Fingerprint2 spec runner</title>
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/png" href="lib/jasmine-2.3.4/jasmine_favicon.png">
|
||||||
|
<link rel="stylesheet" href="lib/jasmine-2.3.4/jasmine.css">
|
||||||
|
|
||||||
|
<script src="lib/jasmine-2.3.4/jasmine.js"></script>
|
||||||
|
<script src="lib/jasmine-2.3.4/jasmine-html.js"></script>
|
||||||
|
<script src="lib/jasmine-2.3.4/boot.js"></script>
|
||||||
|
<script src="lib/jasmine-2.3.4/terminal.js"></script>
|
||||||
|
<script src="lib/jasmine-2.3.4/jasmine-matchers.js"></script>
|
||||||
|
|
||||||
|
<!-- include source files here... -->
|
||||||
|
<script src="../fingerprint2.js"></script>
|
||||||
|
|
||||||
|
<!-- include spec files here... -->
|
||||||
|
<script src="./specs.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
if(navigator.userAgent.match(/phantom/i)) {
|
||||||
|
jasmine.getEnv().addReporter(new jasmineReporters.TerminalReporter({
|
||||||
|
verbosity: 3,
|
||||||
|
color: true,
|
||||||
|
showStack: true
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
170
dashboard-ui/bower_components/fingerprintjs2/specs/specs.js
vendored
Normal file
170
dashboard-ui/bower_components/fingerprintjs2/specs/specs.js
vendored
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
"use strict";
|
||||||
|
describe("Fingerprint2", function () {
|
||||||
|
describe("new", function () {
|
||||||
|
it("creates a new instance of FP2", function () {
|
||||||
|
expect(new Fingerprint2()).not.toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("accepts an empty options object", function () {
|
||||||
|
expect(new Fingerprint2({})).not.toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses default options", function () {
|
||||||
|
var fp2 = new Fingerprint2();
|
||||||
|
expect(fp2.options.swfContainerId).toEqual("fingerprintjs2");
|
||||||
|
expect(fp2.options.swfPath).toEqual("flash/compiled/FontList.swf");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("allows to override default options", function () {
|
||||||
|
var fp2 = new Fingerprint2({swfPath: "newpath"});
|
||||||
|
expect(fp2.options.swfContainerId).toEqual("fingerprintjs2");
|
||||||
|
expect(fp2.options.swfPath).toEqual("newpath");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("allows to add new options", function () {
|
||||||
|
var fp2 = new Fingerprint2({excludeUserAgent: true});
|
||||||
|
expect(fp2.options.swfContainerId).toEqual("fingerprintjs2");
|
||||||
|
expect(fp2.options.swfPath).toEqual("flash/compiled/FontList.swf");
|
||||||
|
expect(fp2.options.excludeUserAgent).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("sortPluginsFor", function () {
|
||||||
|
it("has default value", function (){
|
||||||
|
var fp2 = new Fingerprint2();
|
||||||
|
expect(fp2.options.sortPluginsFor).toEqual([/palemoon/i]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("allows to set new array of regexes", function () {
|
||||||
|
var fp2 = new Fingerprint2({sortPluginsFor: [/firefox/i, /chrome/i]});
|
||||||
|
expect(fp2.options.sortPluginsFor).toEqual([/firefox/i, /chrome/i]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("get", function () {
|
||||||
|
describe("default options", function () {
|
||||||
|
it("calculates fingerprint", function (done) {
|
||||||
|
var fp2 = new Fingerprint2();
|
||||||
|
fp2.get(function(result){
|
||||||
|
expect(result).toMatch(/^[0-9a-f]{32}$/i);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not try calling flash font detection", function (done) {
|
||||||
|
var fp2 = new Fingerprint2();
|
||||||
|
spyOn(fp2, "flashFontsKey");
|
||||||
|
fp2.get(function(result) {
|
||||||
|
expect(fp2.flashFontsKey).not.toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("non-default options", function () {
|
||||||
|
it("does not use userAgent when excluded", function (done) {
|
||||||
|
var fp2 = new Fingerprint2({excludeUserAgent: true});
|
||||||
|
spyOn(fp2, "getUserAgent");
|
||||||
|
fp2.get(function(result) {
|
||||||
|
expect(fp2.getUserAgent).not.toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not use screen resolution when excluded", function (done) {
|
||||||
|
var fp2 = new Fingerprint2({excludeScreenResolution: true});
|
||||||
|
spyOn(fp2, "getScreenResolution");
|
||||||
|
fp2.get(function(result) {
|
||||||
|
expect(fp2.getScreenResolution).not.toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not use available screen resolution when excluded", function (done) {
|
||||||
|
var fp2 = new Fingerprint2({excludeAvailableScreenResolution: true});
|
||||||
|
spyOn(fp2, "getAvailableScreenResolution");
|
||||||
|
fp2.get(function(result) {
|
||||||
|
expect(fp2.getAvailableScreenResolution).not.toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not use plugins info when excluded", function (done) {
|
||||||
|
var fp2 = new Fingerprint2({excludePlugins: true});
|
||||||
|
spyOn(fp2, "getRegularPlugins");
|
||||||
|
fp2.get(function(result) {
|
||||||
|
expect(fp2.getRegularPlugins).not.toHaveBeenCalled();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("returns components", function () {
|
||||||
|
it("does it return components as a second argument to callback", function (done) {
|
||||||
|
var fp2 = new Fingerprint2();
|
||||||
|
fp2.get(function(result, components) {
|
||||||
|
expect(components).not.toBeNull();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("checks if returned components is array", function (done) {
|
||||||
|
var fp2 = new Fingerprint2();
|
||||||
|
fp2.get(function(result, components) {
|
||||||
|
expect(components).toBeArrayOfObjects();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("checks if js_fonts component is array", function (done) {
|
||||||
|
var fp2 = new Fingerprint2();
|
||||||
|
fp2.get(function(result, components) {
|
||||||
|
for(var x = 0; x < components.length; x++) {
|
||||||
|
if(components[x].key == "js_fonts") {
|
||||||
|
expect(components[x].value).toBeArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns user_agent as the first element", function (done) {
|
||||||
|
var fp2 = new Fingerprint2();
|
||||||
|
fp2.get(function(result, components) {
|
||||||
|
expect(components[0].key).toEqual("user_agent");
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("baseFontArray iteration", function () {
|
||||||
|
it("only iterates specified items", function (done) {
|
||||||
|
var baseFonts = ["monospace", "sans-serif", "serif"];
|
||||||
|
var ctr = 0;
|
||||||
|
for (var x in baseFonts) {
|
||||||
|
ctr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(baseFonts.length).toEqual(3);
|
||||||
|
expect(ctr).toEqual(baseFonts.length);
|
||||||
|
|
||||||
|
// Somewhere deep in your JavaScript library...
|
||||||
|
Array.prototype.foo = 1;
|
||||||
|
Array.prototype.bar = 2;
|
||||||
|
ctr = 0;
|
||||||
|
for (var x in baseFonts) {
|
||||||
|
console.log(x);
|
||||||
|
ctr++;
|
||||||
|
// Now foo & bar is a part of EVERY array and
|
||||||
|
// will show up here as a value of 'x'.
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(baseFonts.length).toEqual(3);
|
||||||
|
// sadface
|
||||||
|
expect(ctr).not.toEqual(baseFonts.length);
|
||||||
|
expect(ctr).toEqual(5);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -31,31 +31,21 @@ define(['appStorage', 'browser'], function (appStorage, browser) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
function getDeviceId() {
|
||||||
getWindowState: function () {
|
var key = '_deviceId2';
|
||||||
return document.windowState || 'Normal';
|
var deviceId = appStorage.getItem(key);
|
||||||
},
|
|
||||||
setWindowState: function (state) {
|
|
||||||
alert('setWindowState is not supported and should not be called');
|
|
||||||
},
|
|
||||||
exit: function () {
|
|
||||||
alert('exit is not supported and should not be called');
|
|
||||||
},
|
|
||||||
supports: function (command) {
|
|
||||||
|
|
||||||
var features = [
|
if (deviceId) {
|
||||||
'filedownload'
|
return Promise.resolve(deviceId);
|
||||||
];
|
} else {
|
||||||
|
return generateDeviceId().then(function (deviceId) {
|
||||||
|
appStorage.setItem(key, deviceId);
|
||||||
|
return deviceId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return features.indexOf(command.toLowerCase()) != -1;
|
function getDeviceName() {
|
||||||
},
|
|
||||||
appName: function () {
|
|
||||||
return 'Emby Mobile';
|
|
||||||
},
|
|
||||||
appVersion: function () {
|
|
||||||
return '2.0.1';
|
|
||||||
},
|
|
||||||
deviceName: function () {
|
|
||||||
var deviceName;
|
var deviceName;
|
||||||
|
|
||||||
if (browser.chrome) {
|
if (browser.chrome) {
|
||||||
|
@ -83,20 +73,59 @@ define(['appStorage', 'browser'], function (appStorage, browser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return deviceName;
|
return deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
var appInfo;
|
||||||
|
var version = window.dashboardVersion || '3.0';
|
||||||
|
|
||||||
|
return {
|
||||||
|
getWindowState: function () {
|
||||||
|
return document.windowState || 'Normal';
|
||||||
|
},
|
||||||
|
setWindowState: function (state) {
|
||||||
|
alert('setWindowState is not supported and should not be called');
|
||||||
|
},
|
||||||
|
exit: function () {
|
||||||
|
alert('exit is not supported and should not be called');
|
||||||
|
},
|
||||||
|
supports: function (command) {
|
||||||
|
|
||||||
|
var features = [
|
||||||
|
'filedownload'
|
||||||
|
];
|
||||||
|
|
||||||
|
return features.indexOf(command.toLowerCase()) != -1;
|
||||||
|
},
|
||||||
|
appInfo: function () {
|
||||||
|
|
||||||
|
if (appInfo) {
|
||||||
|
return Promise.resolve(appInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getDeviceId().then(function (deviceId) {
|
||||||
|
|
||||||
|
appInfo = {
|
||||||
|
deviceId: deviceId,
|
||||||
|
deviceName: getDeviceName(),
|
||||||
|
appName: 'Emby Mobile',
|
||||||
|
appVersion: version
|
||||||
|
};
|
||||||
|
|
||||||
|
return appInfo;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
appName: function () {
|
||||||
|
return 'Emby Mobile';
|
||||||
|
},
|
||||||
|
appVersion: function () {
|
||||||
|
return version;
|
||||||
|
},
|
||||||
|
deviceName: function () {
|
||||||
|
return getDeviceName();
|
||||||
},
|
},
|
||||||
deviceId: function () {
|
deviceId: function () {
|
||||||
|
|
||||||
var key = '_deviceId2';
|
return getDeviceId();
|
||||||
var deviceId = appStorage.getItem(key);
|
|
||||||
|
|
||||||
if (deviceId) {
|
|
||||||
return Promise.resolve(deviceId);
|
|
||||||
} else {
|
|
||||||
return generateDeviceId().then(function (deviceId) {
|
|
||||||
appStorage.setItem(key, deviceId);
|
|
||||||
return deviceId;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
capabilities: getCapabilities
|
capabilities: getCapabilities
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,7 @@ define(['appSettings', 'userSettings', 'appStorage'], function (appSettings, use
|
||||||
|
|
||||||
var targets = [{
|
var targets = [{
|
||||||
name: Globalize.translate('MyDevice'),
|
name: Globalize.translate('MyDevice'),
|
||||||
id: AppInfo.deviceId,
|
id: ConnectionManager.deviceId(),
|
||||||
playerName: self.name,
|
playerName: self.name,
|
||||||
playableMediaTypes: ['Audio', 'Video'],
|
playableMediaTypes: ['Audio', 'Video'],
|
||||||
isLocalPlayer: true,
|
isLocalPlayer: true,
|
||||||
|
|
|
@ -1401,6 +1401,9 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
function defineConnectionManager(connectionManager) {
|
function defineConnectionManager(connectionManager) {
|
||||||
|
|
||||||
|
window.ConnectionManager = connectionManager;
|
||||||
|
|
||||||
define('connectionManager', [], function () {
|
define('connectionManager', [], function () {
|
||||||
return connectionManager;
|
return connectionManager;
|
||||||
});
|
});
|
||||||
|
@ -1409,6 +1412,8 @@ var AppInfo = {};
|
||||||
var localApiClient;
|
var localApiClient;
|
||||||
function bindConnectionManagerEvents(connectionManager, events) {
|
function bindConnectionManagerEvents(connectionManager, events) {
|
||||||
|
|
||||||
|
Events.on(ConnectionManager, 'apiclientcreated', onApiClientCreated);
|
||||||
|
|
||||||
connectionManager.currentApiClient = function () {
|
connectionManager.currentApiClient = function () {
|
||||||
|
|
||||||
if (!localApiClient) {
|
if (!localApiClient) {
|
||||||
|
@ -1435,24 +1440,29 @@ var AppInfo = {};
|
||||||
//localStorage.clear();
|
//localStorage.clear();
|
||||||
function createConnectionManager(credentialProviderFactory, capabilities) {
|
function createConnectionManager(credentialProviderFactory, capabilities) {
|
||||||
|
|
||||||
var credentialKey = Dashboard.isConnectMode() ? null : 'servercredentials4';
|
|
||||||
var credentialProvider = new credentialProviderFactory(credentialKey);
|
|
||||||
|
|
||||||
return getSyncProfile().then(function (deviceProfile) {
|
return getSyncProfile().then(function (deviceProfile) {
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
|
require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events'], function (connectionManagerExports, apphost, credentialProvider, events) {
|
||||||
|
|
||||||
|
window.MediaBrowser = Object.assign(window.MediaBrowser || {}, connectionManagerExports);
|
||||||
|
|
||||||
|
var credentialProviderInstance = new credentialProvider();
|
||||||
|
|
||||||
|
apphost.appInfo().then(function (appInfo) {
|
||||||
|
|
||||||
|
var capabilities = Dashboard.capabilities();
|
||||||
capabilities.DeviceProfile = deviceProfile;
|
capabilities.DeviceProfile = deviceProfile;
|
||||||
|
|
||||||
window.ConnectionManager = new MediaBrowser.ConnectionManager(credentialProvider, AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId, capabilities, window.devicePixelRatio);
|
connectionManager = new MediaBrowser.ConnectionManager(credentialProviderInstance, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities, window.devicePixelRatio);
|
||||||
|
|
||||||
defineConnectionManager(window.ConnectionManager);
|
defineConnectionManager(connectionManager);
|
||||||
bindConnectionManagerEvents(window.ConnectionManager, Events);
|
bindConnectionManagerEvents(connectionManager, events);
|
||||||
|
|
||||||
console.log('binding to apiclientcreated');
|
|
||||||
Events.on(ConnectionManager, 'apiclientcreated', onApiClientCreated);
|
|
||||||
|
|
||||||
if (Dashboard.isConnectMode()) {
|
if (Dashboard.isConnectMode()) {
|
||||||
|
|
||||||
return Promise.resolve();
|
resolve();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1462,16 +1472,20 @@ var AppInfo = {};
|
||||||
|
|
||||||
console.log('creating ApiClient singleton');
|
console.log('creating ApiClient singleton');
|
||||||
|
|
||||||
var apiClient = new apiClientFactory(Dashboard.serverAddress(), AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId, window.devicePixelRatio);
|
var apiClient = new apiClientFactory(Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, window.devicePixelRatio);
|
||||||
apiClient.enableAutomaticNetworking = false;
|
apiClient.enableAutomaticNetworking = false;
|
||||||
ConnectionManager.addApiClient(apiClient);
|
connectionManager.addApiClient(apiClient);
|
||||||
require(['css!' + apiClient.getUrl('Branding/Css')]);
|
require(['css!' + apiClient.getUrl('Branding/Css')]);
|
||||||
window.ApiClient = apiClient;
|
window.ApiClient = apiClient;
|
||||||
localApiClient = apiClient;
|
localApiClient = apiClient;
|
||||||
console.log('loaded ApiClient singleton');
|
console.log('loaded ApiClient singleton');
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initFastClick() {
|
function initFastClick() {
|
||||||
|
@ -1609,7 +1623,7 @@ var AppInfo = {};
|
||||||
events: apiClientBowerPath + '/events',
|
events: apiClientBowerPath + '/events',
|
||||||
credentialprovider: apiClientBowerPath + '/credentials',
|
credentialprovider: apiClientBowerPath + '/credentials',
|
||||||
apiclient: apiClientBowerPath + '/apiclient',
|
apiclient: apiClientBowerPath + '/apiclient',
|
||||||
connectionmanagerfactory: apiClientBowerPath + '/connectionmanager',
|
connectionManagerFactory: bowerPath + '/emby-apiclient/connectionmanager',
|
||||||
visibleinviewport: embyWebComponentsBowerPath + "/visibleinviewport",
|
visibleinviewport: embyWebComponentsBowerPath + "/visibleinviewport",
|
||||||
browserdeviceprofile: embyWebComponentsBowerPath + "/browserdeviceprofile",
|
browserdeviceprofile: embyWebComponentsBowerPath + "/browserdeviceprofile",
|
||||||
browser: embyWebComponentsBowerPath + "/browser",
|
browser: embyWebComponentsBowerPath + "/browser",
|
||||||
|
@ -1766,6 +1780,7 @@ var AppInfo = {};
|
||||||
define('objectassign', [embyWebComponentsBowerPath + '/objectassign']);
|
define('objectassign', [embyWebComponentsBowerPath + '/objectassign']);
|
||||||
define('webcomponentsjs', [bowerPath + '/webcomponentsjs/webcomponents-lite.min.js']);
|
define('webcomponentsjs', [bowerPath + '/webcomponentsjs/webcomponents-lite.min.js']);
|
||||||
define('native-promise-only', [bowerPath + '/native-promise-only/lib/npo.src']);
|
define('native-promise-only', [bowerPath + '/native-promise-only/lib/npo.src']);
|
||||||
|
define("fingerprintjs2", [bowerPath + '/fingerprintjs2/fingerprint2'], returnFirstDependency);
|
||||||
|
|
||||||
if (Dashboard.isRunningInCordova()) {
|
if (Dashboard.isRunningInCordova()) {
|
||||||
define('registrationservices', ['cordova/registrationservices']);
|
define('registrationservices', ['cordova/registrationservices']);
|
||||||
|
@ -2005,10 +2020,6 @@ var AppInfo = {};
|
||||||
|
|
||||||
window.Events = events;
|
window.Events = events;
|
||||||
|
|
||||||
for (var i in hostingAppInfo) {
|
|
||||||
AppInfo[i] = hostingAppInfo[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
initAfterDependencies();
|
initAfterDependencies();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2040,9 +2051,6 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
var deps = [];
|
var deps = [];
|
||||||
deps.push('connectionmanagerfactory');
|
|
||||||
deps.push('credentialprovider');
|
|
||||||
|
|
||||||
deps.push('scripts/extensions');
|
deps.push('scripts/extensions');
|
||||||
|
|
||||||
if (!window.fetch) {
|
if (!window.fetch) {
|
||||||
|
@ -2053,14 +2061,9 @@ var AppInfo = {};
|
||||||
deps.push('objectassign');
|
deps.push('objectassign');
|
||||||
}
|
}
|
||||||
|
|
||||||
require(deps, function (connectionManagerExports, credentialProviderFactory) {
|
require(deps, function () {
|
||||||
|
|
||||||
window.MediaBrowser = window.MediaBrowser || {};
|
createConnectionManager().then(function () {
|
||||||
for (var i in connectionManagerExports) {
|
|
||||||
MediaBrowser[i] = connectionManagerExports[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
createConnectionManager(credentialProviderFactory, Dashboard.capabilities()).then(function () {
|
|
||||||
|
|
||||||
console.log('initAfterDependencies promises resolved');
|
console.log('initAfterDependencies promises resolved');
|
||||||
MediaController.init();
|
MediaController.init();
|
||||||
|
@ -2982,117 +2985,6 @@ var AppInfo = {};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCordovaHostingAppInfo() {
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
|
|
||||||
document.addEventListener("deviceready", function () {
|
|
||||||
|
|
||||||
cordova.getAppVersion.getVersionNumber(function (appVersion) {
|
|
||||||
|
|
||||||
require(['appStorage'], function (appStorage) {
|
|
||||||
|
|
||||||
var name = browserInfo.android ? "Emby for Android Mobile" : (browserInfo.safari ? "Emby for iOS" : "Emby Mobile");
|
|
||||||
|
|
||||||
// Remove special characters
|
|
||||||
var cleanDeviceName = device.model.replace(/[^\w\s]/gi, '');
|
|
||||||
|
|
||||||
var deviceId = null;
|
|
||||||
|
|
||||||
if (window.MainActivity) {
|
|
||||||
|
|
||||||
deviceId = appStorage.getItem('legacyDeviceId');
|
|
||||||
|
|
||||||
if (!deviceId) {
|
|
||||||
deviceId = MainActivity.getLegacyDeviceId();
|
|
||||||
appStorage.setItem('legacyDeviceId', deviceId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve({
|
|
||||||
deviceId: deviceId || device.uuid,
|
|
||||||
deviceName: cleanDeviceName,
|
|
||||||
appName: name,
|
|
||||||
appVersion: appVersion
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWebHostingAppInfo() {
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
|
|
||||||
require(['appStorage'], function (appStorage) {
|
|
||||||
var deviceName;
|
|
||||||
|
|
||||||
if (browserInfo.chrome) {
|
|
||||||
deviceName = "Chrome";
|
|
||||||
} else if (browserInfo.edge) {
|
|
||||||
deviceName = "Edge";
|
|
||||||
} else if (browserInfo.firefox) {
|
|
||||||
deviceName = "Firefox";
|
|
||||||
} else if (browserInfo.msie) {
|
|
||||||
deviceName = "Internet Explorer";
|
|
||||||
} else {
|
|
||||||
deviceName = "Web Browser";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browserInfo.version) {
|
|
||||||
deviceName += " " + browserInfo.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browserInfo.ipad) {
|
|
||||||
deviceName += " Ipad";
|
|
||||||
} else if (browserInfo.iphone) {
|
|
||||||
deviceName += " Iphone";
|
|
||||||
} else if (browserInfo.android) {
|
|
||||||
deviceName += " Android";
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDeviceAdAcquired(id) {
|
|
||||||
|
|
||||||
resolve({
|
|
||||||
deviceId: id,
|
|
||||||
deviceName: deviceName,
|
|
||||||
appName: "Emby Web Client",
|
|
||||||
appVersion: window.dashboardVersion
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var deviceIdKey = '_deviceId1';
|
|
||||||
var deviceId = appStorage.getItem(deviceIdKey);
|
|
||||||
|
|
||||||
if (deviceId) {
|
|
||||||
onDeviceAdAcquired(deviceId);
|
|
||||||
} else {
|
|
||||||
require(['cryptojs-sha1'], function () {
|
|
||||||
var keys = [];
|
|
||||||
keys.push(navigator.userAgent);
|
|
||||||
keys.push((navigator.cpuClass || ""));
|
|
||||||
keys.push(new Date().getTime());
|
|
||||||
var randomId = CryptoJS.SHA1(keys.join('|')).toString();
|
|
||||||
appStorage.setItem(deviceIdKey, randomId);
|
|
||||||
onDeviceAdAcquired(randomId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHostingAppInfo() {
|
|
||||||
|
|
||||||
if (Dashboard.isRunningInCordova()) {
|
|
||||||
return getCordovaHostingAppInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
return getWebHostingAppInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
initRequire();
|
initRequire();
|
||||||
|
|
||||||
function onWebComponentsReady() {
|
function onWebComponentsReady() {
|
||||||
|
@ -3114,7 +3006,7 @@ var AppInfo = {};
|
||||||
setAppInfo();
|
setAppInfo();
|
||||||
setDocumentClasses(browser);
|
setDocumentClasses(browser);
|
||||||
|
|
||||||
getHostingAppInfo().then(init);
|
init();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['jQuery'], function ($) {
|
define(['apphost', 'jQuery'], function (appHost, $) {
|
||||||
|
|
||||||
var currentDialogOptions;
|
var currentDialogOptions;
|
||||||
|
|
||||||
|
@ -82,12 +82,15 @@
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
require(['paper-checkbox', 'paper-input', 'emby-collapsible'], function () {
|
require(['paper-checkbox', 'paper-input', 'emby-collapsible'], function () {
|
||||||
renderFormInternal(options, resolve);
|
|
||||||
|
appHost.appInfo().then(function (appInfo) {
|
||||||
|
renderFormInternal(options, appInfo, resolve);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderFormInternal(options, resolve) {
|
function renderFormInternal(options, appInfo, resolve) {
|
||||||
|
|
||||||
var elem = options.elem;
|
var elem = options.elem;
|
||||||
var dialogOptions = options.dialogOptions;
|
var dialogOptions = options.dialogOptions;
|
||||||
|
@ -113,7 +116,7 @@
|
||||||
|
|
||||||
html += targets.map(function (t) {
|
html += targets.map(function (t) {
|
||||||
|
|
||||||
var isSelected = t.Id == AppInfo.deviceId;
|
var isSelected = t.Id == appInfo.deviceId;
|
||||||
var selectedHtml = isSelected ? ' selected="selected"' : '';
|
var selectedHtml = isSelected ? ' selected="selected"' : '';
|
||||||
return '<option' + selectedHtml + ' value="' + t.Id + '">' + t.Name + '</option>';
|
return '<option' + selectedHtml + ' value="' + t.Id + '">' + t.Name + '</option>';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue