Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,58 @@
define(function(require, exports) {
'use strict';
/**
* Get the port of the url.
* @param {string} url full url.
* @return {?number} port number, null if none found.
*/
exports.getPort = function(url) {
var parts = url.split(':');
if (parts.length < 2) {
return null;
}
// If we found a port and path, it's the last part
var candidate = parts[parts.length - 1];
parts = candidate.split('/');
// If we found a port, it's the first part
candidate = parts[0];
if (!isInteger(candidate)) {
return null;
}
return parseInt(candidate, 10);
};
/**
* Get the scheme of the url. Note that this only detects http and https.
* @param {string} url full url.
* @return {?string} uri scheme (ie http), null if none found.
*/
exports.getScheme = function(url) {
var parts = url.split(':');
if (parts.length < 2) {
return null;
}
// If we found a scheme, it's the first part
var candidate = parts[0];
if (candidate !== 'http' && candidate !== 'https') {
return null;
}
return candidate;
};
/**
* Decide whether or not this string represents an integer.
* @param {string} str some string.
* @param {boolean} whether or not str represents an integer.
*/
function isInteger(str) {
return (/^\d+$/).test(str);
}
});