mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
17
web/node_modules/universal-cookie/lib/Cookies.d.ts
generated
vendored
Normal file
17
web/node_modules/universal-cookie/lib/Cookies.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { Cookie, CookieChangeListener, CookieGetOptions, CookieParseOptions, CookieSetOptions } from './types';
|
||||
export default class Cookies {
|
||||
private cookies;
|
||||
private changeListeners;
|
||||
private HAS_DOCUMENT_COOKIE;
|
||||
constructor(cookies?: string | object | null, options?: CookieParseOptions);
|
||||
private _updateBrowserValues;
|
||||
private _emitChange;
|
||||
get(name: string, options?: CookieGetOptions): any;
|
||||
get<T>(name: string, options?: CookieGetOptions): T;
|
||||
getAll(options?: CookieGetOptions): any;
|
||||
getAll<T>(options?: CookieGetOptions): T;
|
||||
set(name: string, value: Cookie, options?: CookieSetOptions): void;
|
||||
remove(name: string, options?: CookieSetOptions): void;
|
||||
addChangeListener(callback: CookieChangeListener): void;
|
||||
removeChangeListener(callback: CookieChangeListener): void;
|
||||
}
|
145
web/node_modules/universal-cookie/lib/Cookies.js
generated
vendored
Normal file
145
web/node_modules/universal-cookie/lib/Cookies.js
generated
vendored
Normal file
|
@ -0,0 +1,145 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var cookie = _interopRequireWildcard(require("cookie"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
var __assign = void 0 && (void 0).__assign || function () {
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
|
||||
for (var p in s) {
|
||||
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
}
|
||||
|
||||
return t;
|
||||
};
|
||||
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
|
||||
var Cookies =
|
||||
/** @class */
|
||||
function () {
|
||||
function Cookies(cookies, options) {
|
||||
var _this = this;
|
||||
|
||||
this.changeListeners = [];
|
||||
this.HAS_DOCUMENT_COOKIE = false;
|
||||
this.cookies = (0, _utils.parseCookies)(cookies, options);
|
||||
new Promise(function () {
|
||||
_this.HAS_DOCUMENT_COOKIE = (0, _utils.hasDocumentCookie)();
|
||||
})["catch"](function () {});
|
||||
}
|
||||
|
||||
Cookies.prototype._updateBrowserValues = function (parseOptions) {
|
||||
if (!this.HAS_DOCUMENT_COOKIE) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.cookies = cookie.parse(document.cookie, parseOptions);
|
||||
};
|
||||
|
||||
Cookies.prototype._emitChange = function (params) {
|
||||
for (var i = 0; i < this.changeListeners.length; ++i) {
|
||||
this.changeListeners[i](params);
|
||||
}
|
||||
};
|
||||
|
||||
Cookies.prototype.get = function (name, options, parseOptions) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
this._updateBrowserValues(parseOptions);
|
||||
|
||||
return (0, _utils.readCookie)(this.cookies[name], options);
|
||||
};
|
||||
|
||||
Cookies.prototype.getAll = function (options, parseOptions) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
this._updateBrowserValues(parseOptions);
|
||||
|
||||
var result = {};
|
||||
|
||||
for (var name_1 in this.cookies) {
|
||||
result[name_1] = (0, _utils.readCookie)(this.cookies[name_1], options);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Cookies.prototype.set = function (name, value, options) {
|
||||
var _a;
|
||||
|
||||
if (_typeof(value) === 'object') {
|
||||
value = JSON.stringify(value);
|
||||
}
|
||||
|
||||
this.cookies = __assign(__assign({}, this.cookies), (_a = {}, _a[name] = value, _a));
|
||||
|
||||
if (this.HAS_DOCUMENT_COOKIE) {
|
||||
document.cookie = cookie.serialize(name, value, options);
|
||||
}
|
||||
|
||||
this._emitChange({
|
||||
name: name,
|
||||
value: value,
|
||||
options: options
|
||||
});
|
||||
};
|
||||
|
||||
Cookies.prototype.remove = function (name, options) {
|
||||
var finalOptions = options = __assign(__assign({}, options), {
|
||||
expires: new Date(1970, 1, 1, 0, 0, 1),
|
||||
maxAge: 0
|
||||
});
|
||||
|
||||
this.cookies = __assign({}, this.cookies);
|
||||
delete this.cookies[name];
|
||||
|
||||
if (this.HAS_DOCUMENT_COOKIE) {
|
||||
document.cookie = cookie.serialize(name, '', finalOptions);
|
||||
}
|
||||
|
||||
this._emitChange({
|
||||
name: name,
|
||||
value: undefined,
|
||||
options: options
|
||||
});
|
||||
};
|
||||
|
||||
Cookies.prototype.addChangeListener = function (callback) {
|
||||
this.changeListeners.push(callback);
|
||||
};
|
||||
|
||||
Cookies.prototype.removeChangeListener = function (callback) {
|
||||
var idx = this.changeListeners.indexOf(callback);
|
||||
|
||||
if (idx >= 0) {
|
||||
this.changeListeners.splice(idx, 1);
|
||||
}
|
||||
};
|
||||
|
||||
return Cookies;
|
||||
}();
|
||||
|
||||
var _default = Cookies;
|
||||
exports["default"] = _default;
|
||||
module.exports = exports.default;
|
3
web/node_modules/universal-cookie/lib/index.d.ts
generated
vendored
Normal file
3
web/node_modules/universal-cookie/lib/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import Cookies from './Cookies';
|
||||
export default Cookies;
|
||||
export * from './types';
|
14
web/node_modules/universal-cookie/lib/index.js
generated
vendored
Normal file
14
web/node_modules/universal-cookie/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Cookies = _interopRequireDefault(require("./Cookies"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var _default = _Cookies["default"];
|
||||
exports["default"] = _default;
|
||||
module.exports = exports.default;
|
23
web/node_modules/universal-cookie/lib/types.d.ts
generated
vendored
Normal file
23
web/node_modules/universal-cookie/lib/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
export declare type Cookie = any;
|
||||
export interface CookieGetOptions {
|
||||
doNotParse?: boolean;
|
||||
}
|
||||
export interface CookieSetOptions {
|
||||
path?: string;
|
||||
expires?: Date;
|
||||
maxAge?: number;
|
||||
domain?: string;
|
||||
secure?: boolean;
|
||||
httpOnly?: boolean;
|
||||
sameSite?: boolean | 'none' | 'lax' | 'strict';
|
||||
encode?: (value: string) => string;
|
||||
}
|
||||
export interface CookieChangeOptions {
|
||||
name: string;
|
||||
value?: any;
|
||||
options?: CookieSetOptions;
|
||||
}
|
||||
export interface CookieParseOptions {
|
||||
decode: (value: string) => string;
|
||||
}
|
||||
export declare type CookieChangeListener = (options: CookieChangeOptions) => void;
|
1
web/node_modules/universal-cookie/lib/types.js
generated
vendored
Normal file
1
web/node_modules/universal-cookie/lib/types.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
"use strict";
|
6
web/node_modules/universal-cookie/lib/utils.d.ts
generated
vendored
Normal file
6
web/node_modules/universal-cookie/lib/utils.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
import { Cookie, CookieGetOptions, CookieParseOptions } from './types';
|
||||
export declare function hasDocumentCookie(): boolean;
|
||||
export declare function cleanCookies(): void;
|
||||
export declare function parseCookies(cookies?: string | object | null, options?: CookieParseOptions): object;
|
||||
export declare function isParsingCookie(value: Cookie, doNotParse?: boolean): boolean;
|
||||
export declare function readCookie(value: Cookie, options?: CookieGetOptions): any;
|
76
web/node_modules/universal-cookie/lib/utils.js
generated
vendored
Normal file
76
web/node_modules/universal-cookie/lib/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.hasDocumentCookie = hasDocumentCookie;
|
||||
exports.cleanCookies = cleanCookies;
|
||||
exports.parseCookies = parseCookies;
|
||||
exports.isParsingCookie = isParsingCookie;
|
||||
exports.readCookie = readCookie;
|
||||
|
||||
var cookie = _interopRequireWildcard(require("cookie"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function hasDocumentCookie() {
|
||||
// Can we get/set cookies on document.cookie?
|
||||
return (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && typeof document.cookie === 'string';
|
||||
}
|
||||
|
||||
function cleanCookies() {
|
||||
document.cookie.split(';').forEach(function (c) {
|
||||
document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/');
|
||||
});
|
||||
}
|
||||
|
||||
function parseCookies(cookies, options) {
|
||||
if (typeof cookies === 'string') {
|
||||
return cookie.parse(cookies, options);
|
||||
} else if (_typeof(cookies) === 'object' && cookies !== null) {
|
||||
return cookies;
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function isParsingCookie(value, doNotParse) {
|
||||
if (typeof doNotParse === 'undefined') {
|
||||
// We guess if the cookie start with { or [, it has been serialized
|
||||
doNotParse = !value || value[0] !== '{' && value[0] !== '[' && value[0] !== '"';
|
||||
}
|
||||
|
||||
return !doNotParse;
|
||||
}
|
||||
|
||||
function readCookie(value, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var cleanValue = cleanupCookieValue(value);
|
||||
|
||||
if (isParsingCookie(cleanValue, options.doNotParse)) {
|
||||
try {
|
||||
return JSON.parse(cleanValue);
|
||||
} catch (e) {// At least we tried
|
||||
}
|
||||
} // Ignore clean value if we failed the deserialization
|
||||
// It is not relevant anymore to trim those values
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function cleanupCookieValue(value) {
|
||||
// express prepend j: before serializing a cookie
|
||||
if (value && value[0] === 'j' && value[1] === ':') {
|
||||
return value.substr(2);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue