- sistemato timeout corto
- corretto errori sulla generazione del PDF - corretto alcune directory - corretto fs.promise - corretto CORS !
4
.env
@@ -1,6 +1,6 @@
|
|||||||
VITE_APP_VERSION="1.2.42"
|
VITE_APP_VERSION="1.2.44"
|
||||||
VITE_LANG_DEFAULT="it"
|
VITE_LANG_DEFAULT="it"
|
||||||
VITE_PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF"
|
VITE_PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF"
|
||||||
VITE_SERVICE_WORKER_FILE="sw-1.2.42.js"
|
VITE_SERVICE_WORKER_FILE="sw-1.2.44.js"
|
||||||
VITE_PROJECT_ID_MAIN="5cc0a13fe5c9d156728f400a"
|
VITE_PROJECT_ID_MAIN="5cc0a13fe5c9d156728f400a"
|
||||||
VITE_VUE_ROUTER_MODE="history"
|
VITE_VUE_ROUTER_MODE="history"
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
VITE_APP_ID="18"
|
VITE_APP_ID="18"
|
||||||
VITE_APP_URL="https://gruppomacro.app"
|
VITE_APP_URL="https://test.gruppomacro.app"
|
||||||
VITE_MONGODB_HOST="https://api.gruppomacro.app"
|
VITE_MONGODB_HOST="https://testapi.gruppomacro.app"
|
||||||
VITE_LOGO_REG='gruppomacro-logo-full.png'
|
VITE_LOGO_REG="gruppomacro-logo-full.png"
|
||||||
VITE_PUBLICKEY_PUSH="BJgo8XR_upbnbMLWgCAUELo6DK7dRXffYAnFOxbaMMz5favBgcQBKT-eISqouO-jRad4Sw8l5nd2wCF6KorGiTc"
|
VITE_PUBLICKEY_PUSH="BJgo8XR_upbnbMLWgCAUELo6DK7dRXffYAnFOxbaMMz5favBgcQBKT-eISqouO-jRad4Sw8l5nd2wCF6KorGiTc"
|
||||||
VITE_DEBUG="0"
|
VITE_DEBUG="1"
|
||||||
VITE_VUE_APP_ISTEST="0"
|
VITE_VUE_APP_ISTEST="1"
|
||||||
DIRECTORY_LOCAL="myprojplanet_vite"
|
DIRECTORY_LOCAL="myprojplanet_vite"
|
||||||
DIRECTORY_SERVER="/var/www/nodejs_piuchebuono_server"
|
DIRECTORY_SERVER="/var/www/nodejs_test.piuchebuono_server"
|
||||||
SERVERDIR_WEBSITE="/var/www/gruppomacro.app"
|
SERVERDIR_WEBSITE="/var/www/test.gruppomacro.app"
|
||||||
SERVERPW_WEBSITE="pwdadmin@1AOK"
|
SERVERPW_WEBSITE="pwdadmin@1AOK"
|
||||||
PORT_SPA="8092"
|
|
||||||
PORT_PWA="8099"
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<meta name="description" content="<%= productDescription %>">
|
<meta name="description" content="<%= productDescription %>">
|
||||||
<meta name="format-detection" content="telephone=no">
|
<meta name="format-detection" content="telephone=no">
|
||||||
<meta name="msapplication-tap-highlight" content="no">
|
<meta name="msapplication-tap-highlight" content="no">
|
||||||
<meta name="version" content="1.2.42">
|
<meta name="version" content="1.2.44">
|
||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>">
|
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>">
|
||||||
|
|
||||||
|
|||||||
14
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gruppomacro",
|
"name": "gruppomacro",
|
||||||
"version": "1.2.42",
|
"version": "1.2.44",
|
||||||
"description": "Gruppo Macro",
|
"description": "Gruppo Macro",
|
||||||
"productName": "Gruppo Macro",
|
"productName": "Gruppo Macro",
|
||||||
"author": "Surya",
|
"author": "Surya",
|
||||||
@@ -9,20 +9,20 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "PORT=8089 APP_VERSION='1.2.42' quasar dev",
|
"dev": "PORT=8089 APP_VERSION='1.2.44' quasar dev",
|
||||||
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
||||||
"build": "quasar build",
|
"build": "quasar build",
|
||||||
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"type-check:watch": "vue-tsc --noEmit --watch",
|
"type-check:watch": "vue-tsc --noEmit --watch",
|
||||||
"buildspa": "APP_VERSION='1.2.42' quasar build -m spa",
|
"buildspa": "APP_VERSION='1.2.44' quasar build -m spa",
|
||||||
"lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"",
|
"lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"",
|
||||||
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
||||||
"pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.42' quasar dev -m pwa",
|
"pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.44' quasar dev -m pwa",
|
||||||
"spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.42' quasar dev",
|
"spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.44' quasar dev",
|
||||||
"debug": "quasar dev --mode debug",
|
"debug": "quasar dev --mode debug",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "echo \"No test specified\" && exit 0",
|
||||||
"generate-sw": "workbox generateSW workbox-config.js",
|
"generate-sw": "workbox generateSW workbox-config.js",
|
||||||
|
|||||||
457
public/js/fetch.js
Executable file
@@ -0,0 +1,457 @@
|
|||||||
|
(function (self) {
|
||||||
|
if (self.fetch) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const support = {
|
||||||
|
searchParams: 'URLSearchParams' in self,
|
||||||
|
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
||||||
|
blob: 'FileReader' in self && 'Blob' in self && (function () {
|
||||||
|
try {
|
||||||
|
new Blob()
|
||||||
|
return true
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}()),
|
||||||
|
formData: 'FormData' in self,
|
||||||
|
arrayBuffer: 'ArrayBuffer' in self,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support.arrayBuffer) {
|
||||||
|
const viewClasses = [
|
||||||
|
'[object Int8Array]',
|
||||||
|
'[object Uint8Array]',
|
||||||
|
'[object Uint8ClampedArray]',
|
||||||
|
'[object Int16Array]',
|
||||||
|
'[object Uint16Array]',
|
||||||
|
'[object Int32Array]',
|
||||||
|
'[object Uint32Array]',
|
||||||
|
'[object Float32Array]',
|
||||||
|
'[object Float64Array]',
|
||||||
|
]
|
||||||
|
|
||||||
|
var isDataView = function (obj) {
|
||||||
|
return obj && DataView.prototype.isPrototypeOf(obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
var isArrayBufferView = ArrayBuffer.isView || function (obj) {
|
||||||
|
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeName(name) {
|
||||||
|
if (typeof name !== 'string') {
|
||||||
|
name = String(name)
|
||||||
|
}
|
||||||
|
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
|
||||||
|
throw new TypeError('Invalid character in header field nametranslate')
|
||||||
|
}
|
||||||
|
return name.toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeValue(value) {
|
||||||
|
if (typeof value !== 'string') {
|
||||||
|
value = String(value)
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a destructive iterator for the value list
|
||||||
|
function iteratorFor(items) {
|
||||||
|
const iterator = {
|
||||||
|
next() {
|
||||||
|
const value = items.shift()
|
||||||
|
return { done: value === undefined, value }
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support.iterable) {
|
||||||
|
iterator[Symbol.iterator] = function () {
|
||||||
|
return iterator
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return iterator
|
||||||
|
}
|
||||||
|
|
||||||
|
function Headers(headers) {
|
||||||
|
this.map = {}
|
||||||
|
|
||||||
|
if (headers instanceof Headers) {
|
||||||
|
headers.forEach(function (value, name) {
|
||||||
|
this.append(name, value)
|
||||||
|
}, this)
|
||||||
|
} else if (Array.isArray(headers)) {
|
||||||
|
headers.forEach(function (header) {
|
||||||
|
this.append(header[0], header[1])
|
||||||
|
}, this)
|
||||||
|
} else if (headers) {
|
||||||
|
Object.getOwnPropertyNames(headers).forEach(function (name) {
|
||||||
|
this.append(name, headers[name])
|
||||||
|
}, this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.append = function (name, value) {
|
||||||
|
name = normalizeName(name)
|
||||||
|
value = normalizeValue(value)
|
||||||
|
const oldValue = this.map[name]
|
||||||
|
this.map[name] = oldValue ? `${oldValue},${value}` : value
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.delete = function (name) {
|
||||||
|
delete this.map[normalizeName(name)]
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.get = function (name) {
|
||||||
|
name = normalizeName(name)
|
||||||
|
return this.has(name) ? this.map[name] : null
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.has = function (name) {
|
||||||
|
return this.map.hasOwnProperty(normalizeName(name))
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.set = function (name, value) {
|
||||||
|
this.map[normalizeName(name)] = normalizeValue(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.forEach = function (callback, thisArg) {
|
||||||
|
for (const name in this.map) {
|
||||||
|
if (this.map.hasOwnProperty(name)) {
|
||||||
|
callback.call(thisArg, this.map[name], name, this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.keys = function () {
|
||||||
|
const items = []
|
||||||
|
this.forEach((value, name) => { items.push(name) })
|
||||||
|
return iteratorFor(items)
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.values = function () {
|
||||||
|
const items = []
|
||||||
|
this.forEach((value) => { items.push(value) })
|
||||||
|
return iteratorFor(items)
|
||||||
|
}
|
||||||
|
|
||||||
|
Headers.prototype.entries = function () {
|
||||||
|
const items = []
|
||||||
|
this.forEach((value, name) => { items.push([name, value]) })
|
||||||
|
return iteratorFor(items)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support.iterable) {
|
||||||
|
Headers.prototype[Symbol.iterator] = Headers.prototype.entries
|
||||||
|
}
|
||||||
|
|
||||||
|
function consumed(body) {
|
||||||
|
if (body.bodyUsed) {
|
||||||
|
return Promise.reject(new TypeError('Already read'))
|
||||||
|
}
|
||||||
|
body.bodyUsed = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function fileReaderReady(reader) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
reader.onload = function () {
|
||||||
|
resolve(reader.result)
|
||||||
|
}
|
||||||
|
reader.onerror = function () {
|
||||||
|
reject(reader.error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function readBlobAsArrayBuffer(blob) {
|
||||||
|
const reader = new FileReader()
|
||||||
|
const promise = fileReaderReady(reader)
|
||||||
|
reader.readAsArrayBuffer(blob)
|
||||||
|
return promise
|
||||||
|
}
|
||||||
|
|
||||||
|
function readBlobAsText(blob) {
|
||||||
|
const reader = new FileReader()
|
||||||
|
const promise = fileReaderReady(reader)
|
||||||
|
reader.readAsText(blob)
|
||||||
|
return promise
|
||||||
|
}
|
||||||
|
|
||||||
|
function readArrayBufferAsText(buf) {
|
||||||
|
const view = new Uint8Array(buf)
|
||||||
|
const chars = new Array(view.length)
|
||||||
|
|
||||||
|
for (let i = 0; i < view.length; i++) {
|
||||||
|
chars[i] = String.fromCharCode(view[i])
|
||||||
|
}
|
||||||
|
return chars.join('')
|
||||||
|
}
|
||||||
|
|
||||||
|
function bufferClone(buf) {
|
||||||
|
if (buf.slice) {
|
||||||
|
return buf.slice(0)
|
||||||
|
}
|
||||||
|
const view = new Uint8Array(buf.byteLength)
|
||||||
|
view.set(new Uint8Array(buf))
|
||||||
|
return view.buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
function Body() {
|
||||||
|
this.bodyUsed = false
|
||||||
|
|
||||||
|
this._initBody = function (body) {
|
||||||
|
this._bodyInit = body
|
||||||
|
if (!body) {
|
||||||
|
this._bodyText = ''
|
||||||
|
} else if (typeof body === 'string') {
|
||||||
|
this._bodyText = body
|
||||||
|
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
||||||
|
this._bodyBlob = body
|
||||||
|
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
||||||
|
this._bodyFormData = body
|
||||||
|
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
||||||
|
this._bodyText = body.toString()
|
||||||
|
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
||||||
|
this._bodyArrayBuffer = bufferClone(body.buffer)
|
||||||
|
// IE 10-11 can't handle a DataView body.
|
||||||
|
this._bodyInit = new Blob([this._bodyArrayBuffer])
|
||||||
|
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
||||||
|
this._bodyArrayBuffer = bufferClone(body)
|
||||||
|
} else {
|
||||||
|
throw new Error('unsupported BodyInit type')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.headers.get('content-type')) {
|
||||||
|
if (typeof body === 'string') {
|
||||||
|
this.headers.set('content-type', 'text/plain;charset=UTF-8')
|
||||||
|
} else if (this._bodyBlob && this._bodyBlob.type) {
|
||||||
|
this.headers.set('content-type', this._bodyBlob.type)
|
||||||
|
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
||||||
|
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support.blob) {
|
||||||
|
this.blob = function () {
|
||||||
|
const rejected = consumed(this)
|
||||||
|
if (rejected) {
|
||||||
|
return rejected
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._bodyBlob) {
|
||||||
|
return Promise.resolve(this._bodyBlob)
|
||||||
|
} if (this._bodyArrayBuffer) {
|
||||||
|
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
||||||
|
} if (this._bodyFormData) {
|
||||||
|
throw new Error('could not read FormData body as blob')
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(new Blob([this._bodyText]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.arrayBuffer = function () {
|
||||||
|
if (this._bodyArrayBuffer) {
|
||||||
|
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
||||||
|
}
|
||||||
|
return this.blob().then(readBlobAsArrayBuffer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.text = function () {
|
||||||
|
const rejected = consumed(this)
|
||||||
|
if (rejected) {
|
||||||
|
return rejected
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._bodyBlob) {
|
||||||
|
return readBlobAsText(this._bodyBlob)
|
||||||
|
} if (this._bodyArrayBuffer) {
|
||||||
|
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
||||||
|
} if (this._bodyFormData) {
|
||||||
|
throw new Error('could not read FormData body as text')
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(this._bodyText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support.formData) {
|
||||||
|
this.formData = function () {
|
||||||
|
return this.text().then(decode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.json = function () {
|
||||||
|
return this.text().then(JSON.parse)
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
// HTTP methods whose capitalization should be normalized
|
||||||
|
const methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
|
||||||
|
|
||||||
|
function normalizeMethod(method) {
|
||||||
|
const upcased = method.toUpperCase()
|
||||||
|
return (methods.indexOf(upcased) > -1) ? upcased : method
|
||||||
|
}
|
||||||
|
|
||||||
|
function Request(input, options) {
|
||||||
|
options = options || {}
|
||||||
|
let { body } = options
|
||||||
|
|
||||||
|
if (input instanceof Request) {
|
||||||
|
if (input.bodyUsed) {
|
||||||
|
throw new TypeError('Already read')
|
||||||
|
}
|
||||||
|
this.url = input.url
|
||||||
|
this.credentials = input.credentials
|
||||||
|
if (!options.headers) {
|
||||||
|
this.headers = new Headers(input.headers)
|
||||||
|
}
|
||||||
|
this.method = input.method
|
||||||
|
this.mode = input.mode
|
||||||
|
if (!body && input._bodyInit != null) {
|
||||||
|
body = input._bodyInit
|
||||||
|
input.bodyUsed = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.url = String(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.credentials = options.credentials || this.credentials || 'omit'
|
||||||
|
if (options.headers || !this.headers) {
|
||||||
|
this.headers = new Headers(options.headers)
|
||||||
|
}
|
||||||
|
this.method = normalizeMethod(options.method || this.method || 'GET')
|
||||||
|
this.mode = options.mode || this.mode || null
|
||||||
|
this.referrer = null
|
||||||
|
|
||||||
|
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
||||||
|
throw new TypeError('Body not allowed for GET or HEAD requests')
|
||||||
|
}
|
||||||
|
this._initBody(body)
|
||||||
|
}
|
||||||
|
|
||||||
|
Request.prototype.clone = function () {
|
||||||
|
return new Request(this, { body: this._bodyInit })
|
||||||
|
}
|
||||||
|
|
||||||
|
function decode(body) {
|
||||||
|
const form = new FormData()
|
||||||
|
body.trim().split('&').forEach((bytes) => {
|
||||||
|
if (bytes) {
|
||||||
|
const split = bytes.split('=')
|
||||||
|
const name = split.shift().replace(/\+/g, ' ')
|
||||||
|
const value = split.join('=').replace(/\+/g, ' ')
|
||||||
|
form.append(decodeURIComponent(name), decodeURIComponent(value))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return form
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseHeaders(rawHeaders) {
|
||||||
|
const headers = new Headers()
|
||||||
|
rawHeaders.split(/\r?\n/).forEach((line) => {
|
||||||
|
const parts = line.split(':')
|
||||||
|
const key = parts.shift().trim()
|
||||||
|
if (key) {
|
||||||
|
const value = parts.join(':').trim()
|
||||||
|
headers.append(key, value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return headers
|
||||||
|
}
|
||||||
|
|
||||||
|
Body.call(Request.prototype)
|
||||||
|
|
||||||
|
function Response(bodyInit, options) {
|
||||||
|
if (!options) {
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.type = 'default'
|
||||||
|
this.status = 'status' in options ? options.status : 200
|
||||||
|
this.ok = this.status >= 200 && this.status < 300
|
||||||
|
this.statusText = 'statusText' in options ? options.statusText : 'OK'
|
||||||
|
this.headers = new Headers(options.headers)
|
||||||
|
this.url = options.url || ''
|
||||||
|
this._initBody(bodyInit)
|
||||||
|
}
|
||||||
|
|
||||||
|
Body.call(Response.prototype)
|
||||||
|
|
||||||
|
Response.prototype.clone = function () {
|
||||||
|
return new Response(this._bodyInit, {
|
||||||
|
status: this.status,
|
||||||
|
statusText: this.statusText,
|
||||||
|
headers: new Headers(this.headers),
|
||||||
|
url: this.url,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Response.error = function () {
|
||||||
|
const response = new Response(null, { status: 0, statusText: '' })
|
||||||
|
response.type = 'error'
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
|
const redirectStatuses = [301, 302, 303, 307, 308]
|
||||||
|
|
||||||
|
Response.redirect = function (url, status) {
|
||||||
|
if (redirectStatuses.indexOf(status) === -1) {
|
||||||
|
throw new RangeError('Invalid status code')
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response(null, { status, headers: { location: url } })
|
||||||
|
}
|
||||||
|
|
||||||
|
self.Headers = Headers
|
||||||
|
self.Request = Request
|
||||||
|
self.Response = Response
|
||||||
|
|
||||||
|
self.fetch = function (input, init) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const request = new Request(input, init)
|
||||||
|
const xhr = new XMLHttpRequest()
|
||||||
|
|
||||||
|
xhr.onload = function () {
|
||||||
|
const options = {
|
||||||
|
status: xhr.status,
|
||||||
|
statusText: xhr.statusText,
|
||||||
|
headers: parseHeaders(xhr.getAllResponseHeaders() || ''),
|
||||||
|
}
|
||||||
|
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')
|
||||||
|
const body = 'response' in xhr ? xhr.response : xhr.responseText
|
||||||
|
resolve(new Response(body, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.onerror = function () {
|
||||||
|
reject(new TypeError('Network request failed'))
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.ontimeout = function () {
|
||||||
|
reject(new TypeError('Network request failed'))
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.open(request.method, request.url, true)
|
||||||
|
|
||||||
|
if (request.credentials === 'include') {
|
||||||
|
xhr.withCredentials = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('responseType' in xhr && support.blob) {
|
||||||
|
xhr.responseType = 'blob'
|
||||||
|
}
|
||||||
|
|
||||||
|
request.headers.forEach((value, name) => {
|
||||||
|
xhr.setRequestHeader(name, value)
|
||||||
|
})
|
||||||
|
|
||||||
|
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
self.fetch.polyfill = true
|
||||||
|
}(typeof self !== 'undefined' ? self : this));
|
||||||
25
public/js/globalenv.js
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
// importScripts('/public/js/immortal-db.min.js');
|
||||||
|
|
||||||
|
/*
|
||||||
|
const cfgenv = {
|
||||||
|
website: 'http://localhost:8081',
|
||||||
|
serverweb: 'http://localhost:3000',
|
||||||
|
dbname: 'mydb3',
|
||||||
|
dbversion: 10,
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
async function clearAllDataImmortal(table) {
|
||||||
|
console.log('clearAllDataImmortal', table)
|
||||||
|
const db = ImmortalDB.ImmortalDB
|
||||||
|
await db.remove(table)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function writeDataImmortal(table, datavalue) {
|
||||||
|
console.log('writeDataImmortal', table, datavalue)
|
||||||
|
const db = ImmortalDB.ImmortalDB
|
||||||
|
await db.set(table, datavalue)
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
307
public/js/idb.js
Executable file
@@ -0,0 +1,307 @@
|
|||||||
|
(function () {
|
||||||
|
// console.log('LOADING IDB.JS .....')
|
||||||
|
function toArray(arr) {
|
||||||
|
return Array.prototype.slice.call(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function promisifyRequest(request) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request.onsuccess = function () {
|
||||||
|
resolve(request.result);
|
||||||
|
};
|
||||||
|
|
||||||
|
request.onerror = function () {
|
||||||
|
reject(request.error);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function promisifyRequestCall(obj, method, args) {
|
||||||
|
let request;
|
||||||
|
const p = new Promise((resolve, reject) => {
|
||||||
|
request = obj[method].apply(obj, args);
|
||||||
|
promisifyRequest(request).then(resolve, reject);
|
||||||
|
});
|
||||||
|
|
||||||
|
p.request = request;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
function promisifyCursorRequestCall(obj, method, args) {
|
||||||
|
const p = promisifyRequestCall(obj, method, args);
|
||||||
|
return p.then((value) => {
|
||||||
|
if (!value) return;
|
||||||
|
return new Cursor(value, p.request);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function proxyProperties(ProxyClass, targetProp, properties) {
|
||||||
|
properties.forEach((prop) => {
|
||||||
|
Object.defineProperty(ProxyClass.prototype, prop, {
|
||||||
|
get() {
|
||||||
|
return this[targetProp][prop];
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this[targetProp][prop] = val;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function proxyRequestMethods(ProxyClass, targetProp, Constructor, properties) {
|
||||||
|
properties.forEach((prop) => {
|
||||||
|
if (!(prop in Constructor.prototype)) return;
|
||||||
|
ProxyClass.prototype[prop] = function () {
|
||||||
|
return promisifyRequestCall(this[targetProp], prop, arguments);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function proxyMethods(ProxyClass, targetProp, Constructor, properties) {
|
||||||
|
properties.forEach((prop) => {
|
||||||
|
if (!(prop in Constructor.prototype)) return;
|
||||||
|
ProxyClass.prototype[prop] = function () {
|
||||||
|
return this[targetProp][prop].apply(this[targetProp], arguments);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function proxyCursorRequestMethods(ProxyClass, targetProp, Constructor, properties) {
|
||||||
|
properties.forEach((prop) => {
|
||||||
|
if (!(prop in Constructor.prototype)) return;
|
||||||
|
ProxyClass.prototype[prop] = function () {
|
||||||
|
return promisifyCursorRequestCall(this[targetProp], prop, arguments);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function Index(index) {
|
||||||
|
this._index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
proxyProperties(Index, '_index', [
|
||||||
|
'name',
|
||||||
|
'keyPath',
|
||||||
|
'multiEntry',
|
||||||
|
'unique',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyRequestMethods(Index, '_index', IDBIndex, [
|
||||||
|
'get',
|
||||||
|
'getKey',
|
||||||
|
'getAll',
|
||||||
|
'getAllKeys',
|
||||||
|
'count',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyCursorRequestMethods(Index, '_index', IDBIndex, [
|
||||||
|
'openCursor',
|
||||||
|
'openKeyCursor',
|
||||||
|
]);
|
||||||
|
|
||||||
|
function Cursor(cursor, request) {
|
||||||
|
this._cursor = cursor;
|
||||||
|
this._request = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
proxyProperties(Cursor, '_cursor', [
|
||||||
|
'direction',
|
||||||
|
'key',
|
||||||
|
'primaryKey',
|
||||||
|
'value',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyRequestMethods(Cursor, '_cursor', IDBCursor, [
|
||||||
|
'update',
|
||||||
|
'delete',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// proxy 'next' methods
|
||||||
|
['advance', 'continue', 'continuePrimaryKey'].forEach((methodName) => {
|
||||||
|
if (!(methodName in IDBCursor.prototype)) return;
|
||||||
|
Cursor.prototype[methodName] = function () {
|
||||||
|
const cursor = this;
|
||||||
|
const args = arguments;
|
||||||
|
return Promise.resolve().then(() => {
|
||||||
|
cursor._cursor[methodName].apply(cursor._cursor, args);
|
||||||
|
return promisifyRequest(cursor._request).then((value) => {
|
||||||
|
if (!value) return;
|
||||||
|
return new Cursor(value, cursor._request);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function ObjectStore(store) {
|
||||||
|
this._store = store;
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectStore.prototype.createIndex = function () {
|
||||||
|
return new Index(this._store.createIndex.apply(this._store, arguments));
|
||||||
|
};
|
||||||
|
|
||||||
|
ObjectStore.prototype.index = function () {
|
||||||
|
return new Index(this._store.index.apply(this._store, arguments));
|
||||||
|
};
|
||||||
|
|
||||||
|
proxyProperties(ObjectStore, '_store', [
|
||||||
|
'name',
|
||||||
|
'keyPath',
|
||||||
|
'indexNames',
|
||||||
|
'autoIncrement',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyRequestMethods(ObjectStore, '_store', IDBObjectStore, [
|
||||||
|
'put',
|
||||||
|
'add',
|
||||||
|
'delete',
|
||||||
|
'clear',
|
||||||
|
'get',
|
||||||
|
'getAll',
|
||||||
|
'getKey',
|
||||||
|
'getAllKeys',
|
||||||
|
'count',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyCursorRequestMethods(ObjectStore, '_store', IDBObjectStore, [
|
||||||
|
'openCursor',
|
||||||
|
'openKeyCursor',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyMethods(ObjectStore, '_store', IDBObjectStore, [
|
||||||
|
'deleteIndex',
|
||||||
|
]);
|
||||||
|
|
||||||
|
function Transaction(idbTransaction) {
|
||||||
|
this._tx = idbTransaction;
|
||||||
|
this.complete = new Promise((resolve, reject) => {
|
||||||
|
idbTransaction.oncomplete = function () {
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
idbTransaction.onerror = function () {
|
||||||
|
reject(idbTransaction.error);
|
||||||
|
};
|
||||||
|
idbTransaction.onabort = function () {
|
||||||
|
reject(idbTransaction.error);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Transaction.prototype.objectStore = function () {
|
||||||
|
return new ObjectStore(this._tx.objectStore.apply(this._tx, arguments));
|
||||||
|
};
|
||||||
|
|
||||||
|
proxyProperties(Transaction, '_tx', [
|
||||||
|
'objectStoreNames',
|
||||||
|
'mode',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyMethods(Transaction, '_tx', IDBTransaction, [
|
||||||
|
'abort',
|
||||||
|
]);
|
||||||
|
|
||||||
|
function UpgradeDB(db, oldVersion, transaction) {
|
||||||
|
this._db = db;
|
||||||
|
this.oldVersion = oldVersion;
|
||||||
|
this.transaction = new Transaction(transaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
UpgradeDB.prototype.createObjectStore = function () {
|
||||||
|
return new ObjectStore(this._db.createObjectStore.apply(this._db, arguments));
|
||||||
|
};
|
||||||
|
|
||||||
|
proxyProperties(UpgradeDB, '_db', [
|
||||||
|
'name',
|
||||||
|
'version',
|
||||||
|
'objectStoreNames',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyMethods(UpgradeDB, '_db', IDBDatabase, [
|
||||||
|
'deleteObjectStore',
|
||||||
|
'close',
|
||||||
|
]);
|
||||||
|
|
||||||
|
function DB(db) {
|
||||||
|
this._db = db;
|
||||||
|
}
|
||||||
|
|
||||||
|
DB.prototype.transaction = function () {
|
||||||
|
return new Transaction(this._db.transaction.apply(this._db, arguments));
|
||||||
|
};
|
||||||
|
|
||||||
|
proxyProperties(DB, '_db', [
|
||||||
|
'name',
|
||||||
|
'version',
|
||||||
|
'objectStoreNames',
|
||||||
|
]);
|
||||||
|
|
||||||
|
proxyMethods(DB, '_db', IDBDatabase, [
|
||||||
|
'close',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Add cursor iterators
|
||||||
|
// TODO: remove this once browsers do the right thing with promises
|
||||||
|
['openCursor', 'openKeyCursor'].forEach((funcName) => {
|
||||||
|
[ObjectStore, Index].forEach((Constructor) => {
|
||||||
|
Constructor.prototype[funcName.replace('open', 'iterate')] = function () {
|
||||||
|
const args = toArray(arguments);
|
||||||
|
const callback = args[args.length - 1];
|
||||||
|
const nativeObject = this._store || this._index;
|
||||||
|
const request = nativeObject[funcName].apply(nativeObject, args.slice(0, -1));
|
||||||
|
request.onsuccess = function () {
|
||||||
|
callback(request.result);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// polyfill getAll
|
||||||
|
[Index, ObjectStore].forEach((Constructor) => {
|
||||||
|
if (Constructor.prototype.getAll) return;
|
||||||
|
Constructor.prototype.getAll = function (query, count) {
|
||||||
|
const instance = this;
|
||||||
|
const items = [];
|
||||||
|
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
instance.iterateCursor(query, (cursor) => {
|
||||||
|
if (!cursor) {
|
||||||
|
resolve(items);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
items.push(cursor.value);
|
||||||
|
|
||||||
|
if (!!count && items.length == count) {
|
||||||
|
resolve(items);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cursor.continue();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const exp = {
|
||||||
|
open(name, version, upgradeCallback) {
|
||||||
|
const p = promisifyRequestCall(indexedDB, 'open', [name, version]);
|
||||||
|
const { request } = p;
|
||||||
|
|
||||||
|
request.onupgradeneeded = function (event) {
|
||||||
|
if (upgradeCallback) {
|
||||||
|
upgradeCallback(new UpgradeDB(request.result, event.oldVersion, request.transaction));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return p.then((db) => new DB(db));
|
||||||
|
},
|
||||||
|
delete(name) {
|
||||||
|
return promisifyRequestCall(indexedDB, 'deleteDatabase', [name]);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof module !== 'undefined') {
|
||||||
|
module.exports = exp;
|
||||||
|
module.exports.default = module.exports;
|
||||||
|
} else {
|
||||||
|
self.idb = exp;
|
||||||
|
}
|
||||||
|
}());
|
||||||
10
public/js/material.min.js
vendored
Executable file
368
public/js/promise.js
Executable file
@@ -0,0 +1,368 @@
|
|||||||
|
/**
|
||||||
|
* setImmediate polyfill v1.0.1, supports IE9+
|
||||||
|
* © 2014–2015 Dmitry Korobkin
|
||||||
|
* Released under the MIT license
|
||||||
|
* github.com/Octane/setImmediate
|
||||||
|
*/
|
||||||
|
window.setImmediate || (function () {
|
||||||
|
let uid = 0;
|
||||||
|
const storage = {};
|
||||||
|
let firstCall = true;
|
||||||
|
const { slice } = Array.prototype;
|
||||||
|
const message = 'setImmediatePolyfillMessage';
|
||||||
|
|
||||||
|
function fastApply(args) {
|
||||||
|
const func = args[0];
|
||||||
|
switch (args.length) {
|
||||||
|
case 1:
|
||||||
|
return func();
|
||||||
|
case 2:
|
||||||
|
return func(args[1]);
|
||||||
|
case 3:
|
||||||
|
return func(args[1], args[2]);
|
||||||
|
}
|
||||||
|
return func.apply(window, slice.call(args, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
function callback(event) {
|
||||||
|
const key = event.data;
|
||||||
|
let data;
|
||||||
|
if (typeof key === 'string' && key.indexOf(message) == 0) {
|
||||||
|
data = storage[key];
|
||||||
|
if (data) {
|
||||||
|
delete storage[key];
|
||||||
|
fastApply(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.setImmediate = function setImmediate() {
|
||||||
|
const id = uid++;
|
||||||
|
const key = message + id;
|
||||||
|
let i = arguments.length;
|
||||||
|
const args = new Array(i);
|
||||||
|
while (i--) {
|
||||||
|
args[i] = arguments[i];
|
||||||
|
}
|
||||||
|
storage[key] = args;
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
window.addEventListener('message', callback);
|
||||||
|
}
|
||||||
|
window.postMessage(key, '*');
|
||||||
|
return id;
|
||||||
|
};
|
||||||
|
|
||||||
|
window.clearImmediate = function clearImmediate(id) {
|
||||||
|
delete storage[message + id];
|
||||||
|
};
|
||||||
|
}());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Promise polyfill v1.0.10
|
||||||
|
* requires setImmediate
|
||||||
|
*
|
||||||
|
* © 2014–2015 Dmitry Korobkin
|
||||||
|
* Released under the MIT license
|
||||||
|
* github.com/Octane/Promise
|
||||||
|
*/
|
||||||
|
(function (global) {
|
||||||
|
const STATUS = '[[PromiseStatus]]';
|
||||||
|
const VALUE = '[[PromiseValue]]';
|
||||||
|
const ON_FUlFILLED = '[[OnFulfilled]]';
|
||||||
|
const ON_REJECTED = '[[OnRejected]]';
|
||||||
|
const ORIGINAL_ERROR = '[[OriginalError]]';
|
||||||
|
const PENDING = 'pending';
|
||||||
|
const INTERNAL_PENDING = 'internal pending';
|
||||||
|
const FULFILLED = 'fulfilled';
|
||||||
|
const REJECTED = 'rejected';
|
||||||
|
const NOT_ARRAY = 'not an array.';
|
||||||
|
const REQUIRES_NEW = 'constructor Promise requires "new".';
|
||||||
|
const CHAINING_CYCLE = 'then() cannot return same Promise that it resolves.';
|
||||||
|
|
||||||
|
const setImmediate = global.setImmediate || require('timers').setImmediate;
|
||||||
|
const isArray = Array.isArray || function (anything) {
|
||||||
|
return Object.prototype.toString.call(anything) == '[object Array]';
|
||||||
|
};
|
||||||
|
|
||||||
|
function InternalError(originalError) {
|
||||||
|
this[ORIGINAL_ERROR] = originalError;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isInternalError(anything) {
|
||||||
|
return anything instanceof InternalError;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isObject(anything) {
|
||||||
|
// Object.create(null) instanceof Object → false
|
||||||
|
return Object(anything) === anything;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCallable(anything) {
|
||||||
|
return typeof anything === 'function';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isPromise(anything) {
|
||||||
|
return anything instanceof Promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
function identity(value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function thrower(reason) {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enqueue(promise, onFulfilled, onRejected) {
|
||||||
|
if (!promise[ON_FUlFILLED]) {
|
||||||
|
promise[ON_FUlFILLED] = [];
|
||||||
|
promise[ON_REJECTED] = [];
|
||||||
|
}
|
||||||
|
promise[ON_FUlFILLED].push(onFulfilled);
|
||||||
|
promise[ON_REJECTED].push(onRejected);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearAllQueues(promise) {
|
||||||
|
delete promise[ON_FUlFILLED];
|
||||||
|
delete promise[ON_REJECTED];
|
||||||
|
}
|
||||||
|
|
||||||
|
function callEach(queue) {
|
||||||
|
let i;
|
||||||
|
const { length } = queue;
|
||||||
|
for (i = 0; i < length; i++) {
|
||||||
|
queue[i]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function call(resolve, reject, value) {
|
||||||
|
const anything = toPromise(value);
|
||||||
|
if (isPromise(anything)) {
|
||||||
|
anything.then(resolve, reject);
|
||||||
|
} else if (isInternalError(anything)) {
|
||||||
|
reject(anything[ORIGINAL_ERROR]);
|
||||||
|
} else {
|
||||||
|
resolve(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toPromise(anything) {
|
||||||
|
let then;
|
||||||
|
if (isPromise(anything)) {
|
||||||
|
return anything;
|
||||||
|
}
|
||||||
|
if (isObject(anything)) {
|
||||||
|
try {
|
||||||
|
then = anything.then;
|
||||||
|
} catch (error) {
|
||||||
|
return new InternalError(error);
|
||||||
|
}
|
||||||
|
if (isCallable(then)) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
setImmediate(() => {
|
||||||
|
try {
|
||||||
|
then.call(anything, resolve, reject);
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolvePromise(promise, resolver) {
|
||||||
|
function resolve(value) {
|
||||||
|
if (promise[STATUS] == PENDING) {
|
||||||
|
fulfillPromise(promise, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function reject(reason) {
|
||||||
|
if (promise[STATUS] == PENDING) {
|
||||||
|
rejectPromise(promise, reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
resolver(resolve, reject);
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fulfillPromise(promise, value) {
|
||||||
|
let queue;
|
||||||
|
const anything = toPromise(value);
|
||||||
|
if (isPromise(anything)) {
|
||||||
|
promise[STATUS] = INTERNAL_PENDING;
|
||||||
|
anything.then(
|
||||||
|
(value) => {
|
||||||
|
fulfillPromise(promise, value);
|
||||||
|
},
|
||||||
|
(reason) => {
|
||||||
|
rejectPromise(promise, reason);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else if (isInternalError(anything)) {
|
||||||
|
rejectPromise(promise, anything[ORIGINAL_ERROR]);
|
||||||
|
} else {
|
||||||
|
promise[STATUS] = FULFILLED;
|
||||||
|
promise[VALUE] = value;
|
||||||
|
queue = promise[ON_FUlFILLED];
|
||||||
|
if (queue && queue.length) {
|
||||||
|
clearAllQueues(promise);
|
||||||
|
callEach(queue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rejectPromise(promise, reason) {
|
||||||
|
const queue = promise[ON_REJECTED];
|
||||||
|
promise[STATUS] = REJECTED;
|
||||||
|
promise[VALUE] = reason;
|
||||||
|
if (queue && queue.length) {
|
||||||
|
clearAllQueues(promise);
|
||||||
|
callEach(queue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Promise(resolver) {
|
||||||
|
const promise = this;
|
||||||
|
if (!isPromise(promise)) {
|
||||||
|
throw new TypeError(REQUIRES_NEW);
|
||||||
|
}
|
||||||
|
promise[STATUS] = PENDING;
|
||||||
|
promise[VALUE] = undefined;
|
||||||
|
resolvePromise(promise, resolver);
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.prototype.then = function (onFulfilled, onRejected) {
|
||||||
|
const promise = this;
|
||||||
|
let nextPromise;
|
||||||
|
onFulfilled = isCallable(onFulfilled) ? onFulfilled : identity;
|
||||||
|
onRejected = isCallable(onRejected) ? onRejected : thrower;
|
||||||
|
nextPromise = new Promise((resolve, reject) => {
|
||||||
|
function tryCall(func) {
|
||||||
|
let value;
|
||||||
|
try {
|
||||||
|
value = func(promise[VALUE]);
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (value === nextPromise) {
|
||||||
|
reject(new TypeError(CHAINING_CYCLE));
|
||||||
|
} else {
|
||||||
|
call(resolve, reject, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function asyncOnFulfilled() {
|
||||||
|
setImmediate(tryCall, onFulfilled);
|
||||||
|
}
|
||||||
|
function asyncOnRejected() {
|
||||||
|
setImmediate(tryCall, onRejected);
|
||||||
|
}
|
||||||
|
switch (promise[STATUS]) {
|
||||||
|
case FULFILLED:
|
||||||
|
asyncOnFulfilled();
|
||||||
|
break;
|
||||||
|
case REJECTED:
|
||||||
|
asyncOnRejected();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
enqueue(promise, asyncOnFulfilled, asyncOnRejected);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return nextPromise;
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.prototype.catch = function (onRejected) {
|
||||||
|
return this.then(identity, onRejected);
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.resolve = function (value) {
|
||||||
|
const anything = toPromise(value);
|
||||||
|
if (isPromise(anything)) {
|
||||||
|
return anything;
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (isInternalError(anything)) {
|
||||||
|
reject(anything[ORIGINAL_ERROR]);
|
||||||
|
} else {
|
||||||
|
resolve(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.reject = function (reason) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
reject(reason);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.race = function (values) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let i;
|
||||||
|
let length;
|
||||||
|
if (isArray(values)) {
|
||||||
|
length = values.length;
|
||||||
|
for (i = 0; i < length; i++) {
|
||||||
|
call(resolve, reject, values[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reject(new TypeError(NOT_ARRAY));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Promise.all = function (values) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let fulfilledCount = 0;
|
||||||
|
let promiseCount = 0;
|
||||||
|
let anything;
|
||||||
|
let length;
|
||||||
|
let value;
|
||||||
|
let i;
|
||||||
|
if (isArray(values)) {
|
||||||
|
values = values.slice(0);
|
||||||
|
length = values.length;
|
||||||
|
for (i = 0; i < length; i++) {
|
||||||
|
value = values[i];
|
||||||
|
anything = toPromise(value);
|
||||||
|
if (isPromise(anything)) {
|
||||||
|
promiseCount++;
|
||||||
|
anything.then(
|
||||||
|
(function (index) {
|
||||||
|
return function (value) {
|
||||||
|
values[index] = value;
|
||||||
|
fulfilledCount++;
|
||||||
|
if (fulfilledCount == promiseCount) {
|
||||||
|
resolve(values);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}(i)),
|
||||||
|
reject,
|
||||||
|
);
|
||||||
|
} else if (isInternalError(anything)) {
|
||||||
|
reject(anything[ORIGINAL_ERROR]);
|
||||||
|
} else {
|
||||||
|
// [1, , 3] → [1, undefined, 3]
|
||||||
|
values[i] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!promiseCount) {
|
||||||
|
resolve(values);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reject(new TypeError(NOT_ARRAY));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
module.exports = global.Promise || Promise;
|
||||||
|
} else if (!global.Promise) {
|
||||||
|
global.Promise = Promise;
|
||||||
|
}
|
||||||
|
}(this));
|
||||||
156
public/js/storage.js
Executable file
@@ -0,0 +1,156 @@
|
|||||||
|
const OtherTables = ['categories', 'config', 'swmsg', 'notifications']
|
||||||
|
const MainTables = ['todos', 'projects']
|
||||||
|
const allMethod = ['sync_post_', 'sync_patch_', 'delete_']
|
||||||
|
|
||||||
|
// -------------------------------------
|
||||||
|
|
||||||
|
let idbKeyval = (() => {
|
||||||
|
let db;
|
||||||
|
|
||||||
|
// console.log('idbKeyval...')
|
||||||
|
|
||||||
|
function getDB() {
|
||||||
|
if (!db) {
|
||||||
|
// console.log('CREO DB STORAGE JS !')
|
||||||
|
db = new Promise((resolve, reject) => {
|
||||||
|
const openreq = indexedDB.open('mydb3', 13);
|
||||||
|
|
||||||
|
openreq.onerror = () => {
|
||||||
|
reject(openreq.error);
|
||||||
|
};
|
||||||
|
|
||||||
|
openreq.onupgradeneeded = () => {
|
||||||
|
// First time setup: create an empty object store
|
||||||
|
for (const mytab of MainTables) {
|
||||||
|
openreq.result.createObjectStore(mytab, { keyPath: '_id' });
|
||||||
|
for (const mymeth of allMethod) {
|
||||||
|
const tab = mymeth + mytab
|
||||||
|
openreq.result.createObjectStore(tab, { keyPath: '_id' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const mytab of OtherTables) {
|
||||||
|
openreq.result.createObjectStore(mytab, { keyPath: '_id' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
openreq.onsuccess = () => {
|
||||||
|
resolve(openreq.result);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function withStore(type, table, callback) {
|
||||||
|
const db = await getDB();
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const transaction = db.transaction(table, type);
|
||||||
|
transaction.oncomplete = () => resolve();
|
||||||
|
transaction.onerror = () => reject(transaction.error);
|
||||||
|
callback(transaction.objectStore(table));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
getArrayByTable(nametable, data) {
|
||||||
|
if (nametable === 'todos') {
|
||||||
|
return data.todos
|
||||||
|
} if (nametable === 'projects') {
|
||||||
|
return data.projects
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async get(key) {
|
||||||
|
let req;
|
||||||
|
await withStore('readonly', 'keyval', store => {
|
||||||
|
req = store.get(key);
|
||||||
|
});
|
||||||
|
return req.result;
|
||||||
|
},
|
||||||
|
|
||||||
|
// jsonCopy(src) {
|
||||||
|
// return JSON.parse(JSON.stringify(src));
|
||||||
|
// },
|
||||||
|
|
||||||
|
// contains(a, b) {
|
||||||
|
// // array matches
|
||||||
|
// if (Array.isArray(b)) {
|
||||||
|
// return b.some(x => a.indexOf(x) > -1);
|
||||||
|
// }
|
||||||
|
// // string match
|
||||||
|
// return a.indexOf(b) > -1;
|
||||||
|
// },
|
||||||
|
|
||||||
|
async getdata(table, key) {
|
||||||
|
let req;
|
||||||
|
|
||||||
|
console.log('getdata', table, key)
|
||||||
|
|
||||||
|
await withStore('readonly', table, store => {
|
||||||
|
// console.log('store', store, 'key', key)
|
||||||
|
req = store.get(key);
|
||||||
|
// console.log(' req', req)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (req) {
|
||||||
|
return req.result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getalldata(table) {
|
||||||
|
let req;
|
||||||
|
await withStore('readonly', table, store => {
|
||||||
|
req = store.getAll();
|
||||||
|
});
|
||||||
|
return req.result;
|
||||||
|
},
|
||||||
|
set(key, value) {
|
||||||
|
let req;
|
||||||
|
/*await withStore('readwrite', 'keyval', store => {
|
||||||
|
req = store.put(value, key);
|
||||||
|
});
|
||||||
|
|
||||||
|
*/
|
||||||
|
if (req)
|
||||||
|
return req.result;
|
||||||
|
else
|
||||||
|
return null
|
||||||
|
},
|
||||||
|
async setdata(table, value) {
|
||||||
|
let req;
|
||||||
|
// console.log('setdata', table, value)
|
||||||
|
|
||||||
|
await withStore('readwrite', table, store => {
|
||||||
|
req = store.put(value);
|
||||||
|
});
|
||||||
|
return req.result;
|
||||||
|
},
|
||||||
|
async delete(key) {
|
||||||
|
return withStore('readwrite', 'keyval', store => {
|
||||||
|
store.delete(key);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async deletedata(table, key) {
|
||||||
|
return withStore('readwrite', table, store => {
|
||||||
|
store.delete(key);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async clearalldata(table) {
|
||||||
|
// console.log('clearalldata', table)
|
||||||
|
return withStore('readwrite', table, store => {
|
||||||
|
store.clear();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
// iOS add-to-homescreen is missing IDB, or at least it used to.
|
||||||
|
// I haven't tested this in a while.
|
||||||
|
if (!self.indexedDB) {
|
||||||
|
idbKeyval = {
|
||||||
|
get: key => Promise.resolve(localStorage.getItem(key)),
|
||||||
|
set: (key, val) => Promise.resolve(localStorage.setItem(key, val)),
|
||||||
|
delete: key => Promise.resolve(localStorage.removeItem(key)),
|
||||||
|
};
|
||||||
|
}
|
||||||
34
public/js/track.js
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
function geturl() {
|
||||||
|
const miaurl = document.location.href
|
||||||
|
|
||||||
|
if (miaurl.includes('localhost')) {
|
||||||
|
return 'https://127.0.0.1:8084'
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function getidtrack() {
|
||||||
|
const miaurl = document.location.href
|
||||||
|
|
||||||
|
if (miaurl.includes('test.') || miaurl.includes('localhost')) {
|
||||||
|
return '4c40a07bc88a9c50c9b70dc9c5cd8e2e'
|
||||||
|
}
|
||||||
|
return 'ccfd6c90e17b6809f9717675764c3f5d' // Associazione Shen
|
||||||
|
}
|
||||||
|
|
||||||
|
let owa_baseUrl = `${geturl()}owa/`;
|
||||||
|
if (owa_cmds) var owa_cmds = [];
|
||||||
|
else var owa_cmds = owa_cmds || [];
|
||||||
|
owa_cmds.push(['setSiteId', getidtrack()]);
|
||||||
|
owa_cmds.push(['trackPageView']);
|
||||||
|
// owa_cmds.push(['trackClicks']);
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
const _owa = document.createElement('script');
|
||||||
|
_owa.type = 'text/javascript';
|
||||||
|
_owa.async = true;
|
||||||
|
owa_baseUrl = (document.location.protocol == 'https:' ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl);
|
||||||
|
_owa.src = `${owa_baseUrl}modules/base/js/owa.tracker-combined-min.js`;
|
||||||
|
const _owa_s = document.getElementsByTagName('script')[0];
|
||||||
|
_owa_s.parentNode.insertBefore(_owa, _owa_s);
|
||||||
|
}());
|
||||||
2
public/js/workbox-sw-6-1.js
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
!function(){'use strict';try{self['workbox:sw:6.1.0']&&_()}catch(t){}const t={backgroundSync:'background-sync',broadcastUpdate:'broadcast-update',cacheableResponse:'cacheable-response',core:'core',expiration:'expiration',googleAnalytics:'offline-ga',navigationPreload:'navigation-preload',precaching:'precaching',rangeRequests:'range-requests',routing:'routing',strategies:'strategies',streams:'streams',recipes:'recipes'};self.workbox=new class{constructor(){return this.v={},this.Pt={debug:'localhost'===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.$t=this.Pt.debug?'dev':'prod',this.jt=!1,new Proxy(this,{get(e,s){if(e[s])return e[s];const o=t[s];return o&&e.loadModule('workbox-'+o),e[s]}})}setConfig(t={}){if(this.jt)throw new Error('Config must be set before accessing workbox.* modules');Object.assign(this.Pt,t),this.$t=this.Pt.debug?'dev':'prod'}loadModule(t){const e=this.St(t);try{importScripts(e),this.jt=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}St(t){if(this.Pt.modulePathCb)return this.Pt.modulePathCb(t,this.Pt.debug);let e=['https://storage.googleapis.com/workbox-cdn/releases/6.1.0'];const s=`${t}.${this.$t}.js`,o=this.Pt.modulePathPrefix;return o&&(e=o.split('/'),''===e[e.length-1]&&e.splice(e.length-1,1)),e.push(s),e.join('/')}}}();
|
||||||
|
//# sourceMappingURL=workbox-sw.js.map
|
||||||
2
public/js/workbox-sw.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
!function(){"use strict";try{self["workbox:sw:5.1.4"]&&_()}catch(t){}const t={backgroundSync:"background-sync",broadcastUpdate:"broadcast-update",cacheableResponse:"cacheable-response",core:"core",expiration:"expiration",googleAnalytics:"offline-ga",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};self.workbox=new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.s=this.t.debug?"dev":"prod",this.o=!1,new Proxy(this,{get(e,s){if(e[s])return e[s];const o=t[s];return o&&e.loadModule("workbox-"+o),e[s]}})}setConfig(t={}){if(this.o)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.s=this.t.debug?"dev":"prod"}loadModule(t){const e=this.i(t);try{importScripts(e),this.o=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}i(t){if(this.t.modulePathCb)return this.t.modulePathCb(t,this.t.debug);let e=["https://storage.googleapis.com/workbox-cdn/releases/5.1.4"];const s=`${t}.${this.s}.js`,o=this.t.modulePathPrefix;return o&&(e=o.split("/"),""===e[e.length-1]&&e.splice(e.length-1,1)),e.push(s),e.join("/")}}}();
|
||||||
|
//# sourceMappingURL=workbox-sw.js.map
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cnm",
|
"name": "cnm",
|
||||||
"version": "1.2.42",
|
"version": "1.2.44",
|
||||||
"description": "Comunita Nuovo Mondo",
|
"description": "Comunita Nuovo Mondo",
|
||||||
"productName": "ComunitaNuovoMondo",
|
"productName": "ComunitaNuovoMondo",
|
||||||
"author": "Surya",
|
"author": "Surya",
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "PORT=8083 APP_VERSION='1.2.42' quasar dev",
|
"dev": "PORT=8083 APP_VERSION='1.2.44' quasar dev",
|
||||||
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
||||||
"build": "quasar build",
|
"build": "quasar build",
|
||||||
"buildpwa": "NODE_ENV=production quasar build -m pwa",
|
"buildpwa": "NODE_ENV=production quasar build -m pwa",
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
||||||
"pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.42' quasar dev -m pwa",
|
"pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.44' quasar dev -m pwa",
|
||||||
"spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.42' quasar dev",
|
"spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.44' quasar dev",
|
||||||
"debug": "quasar dev --mode debug",
|
"debug": "quasar dev --mode debug",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "echo \"No test specified\" && exit 0",
|
||||||
"generate-sw": "workbox generateSW workbox-config.js",
|
"generate-sw": "workbox generateSW workbox-config.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "freeplanet",
|
"name": "freeplanet",
|
||||||
"version": "1.2.42",
|
"version": "1.2.44",
|
||||||
"description": "freeplanet",
|
"description": "freeplanet",
|
||||||
"productName": "freeplanet",
|
"productName": "freeplanet",
|
||||||
"author": "Surya",
|
"author": "Surya",
|
||||||
@@ -9,11 +9,11 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "PORT=8087 APP_VERSION='1.2.42' quasar dev",
|
"dev": "PORT=8087 APP_VERSION='1.2.44' quasar dev",
|
||||||
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
||||||
"build": "quasar build",
|
"build": "quasar build",
|
||||||
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"type-check:watch": "vue-tsc --noEmit --watch",
|
"type-check:watch": "vue-tsc --noEmit --watch",
|
||||||
"buildspa": "quasar build -m spa",
|
"buildspa": "quasar build -m spa",
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
||||||
"pwa": "NODE_ENV=development PORT=8097 APP_VERSION='1.2.42' quasar dev -m pwa",
|
"pwa": "NODE_ENV=development PORT=8097 APP_VERSION='1.2.44' quasar dev -m pwa",
|
||||||
"spa": "NODE_ENV=development PORT=8087 APP_VERSION='1.2.42' quasar dev",
|
"spa": "NODE_ENV=development PORT=8087 APP_VERSION='1.2.44' quasar dev",
|
||||||
"debug": "quasar dev --mode debug",
|
"debug": "quasar dev --mode debug",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "echo \"No test specified\" && exit 0",
|
||||||
"generate-sw": "workbox generateSW workbox-config.js",
|
"generate-sw": "workbox generateSW workbox-config.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gruppomacro",
|
"name": "gruppomacro",
|
||||||
"version": "1.2.42",
|
"version": "1.2.44",
|
||||||
"description": "Gruppo Macro",
|
"description": "Gruppo Macro",
|
||||||
"productName": "Gruppo Macro",
|
"productName": "Gruppo Macro",
|
||||||
"author": "Surya",
|
"author": "Surya",
|
||||||
@@ -9,20 +9,20 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "PORT=8089 APP_VERSION='1.2.42' quasar dev",
|
"dev": "PORT=8089 APP_VERSION='1.2.44' quasar dev",
|
||||||
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
||||||
"build": "quasar build",
|
"build": "quasar build",
|
||||||
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"type-check:watch": "vue-tsc --noEmit --watch",
|
"type-check:watch": "vue-tsc --noEmit --watch",
|
||||||
"buildspa": "APP_VERSION='1.2.42' quasar build -m spa",
|
"buildspa": "APP_VERSION='1.2.44' quasar build -m spa",
|
||||||
"lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"",
|
"lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"",
|
||||||
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
||||||
"pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.42' quasar dev -m pwa",
|
"pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.44' quasar dev -m pwa",
|
||||||
"spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.42' quasar dev",
|
"spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.44' quasar dev",
|
||||||
"debug": "quasar dev --mode debug",
|
"debug": "quasar dev --mode debug",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "echo \"No test specified\" && exit 0",
|
||||||
"generate-sw": "workbox generateSW workbox-config.js",
|
"generate-sw": "workbox generateSW workbox-config.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "kolibrilab",
|
"name": "kolibrilab",
|
||||||
"version": "1.2.42",
|
"version": "1.2.44",
|
||||||
"description": "kolibrilab",
|
"description": "kolibrilab",
|
||||||
"productName": "kolibrilab",
|
"productName": "kolibrilab",
|
||||||
"author": "Surya Paolo",
|
"author": "Surya Paolo",
|
||||||
@@ -8,11 +8,11 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "PORT=8083 APP_VERSION='1.2.42' quasar dev",
|
"dev": "PORT=8083 APP_VERSION='1.2.44' quasar dev",
|
||||||
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
||||||
"build": "quasar build",
|
"build": "quasar build",
|
||||||
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"type-check:watch": "vue-tsc --noEmit --watch",
|
"type-check:watch": "vue-tsc --noEmit --watch",
|
||||||
"buildspa": "quasar build -m spa",
|
"buildspa": "quasar build -m spa",
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"fix": "eslint --ext .ts,.vue --ignore-path .gitignore ./ --fix > file.out.txt",
|
"fix": "eslint --ext .ts,.vue --ignore-path .gitignore ./ --fix > file.out.txt",
|
||||||
"pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.42' quasar dev -m pwa",
|
"pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.44' quasar dev -m pwa",
|
||||||
"spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.42' quasar dev",
|
"spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.44' quasar dev",
|
||||||
"spanorefresh": "NODE_ENV=development NODE_OPTIONS=--max_old_space_size=4096 DEBUG=v8:* quasar dev -m spa",
|
"spanorefresh": "NODE_ENV=development NODE_OPTIONS=--max_old_space_size=4096 DEBUG=v8:* quasar dev -m spa",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "echo \"No test specified\" && exit 0",
|
||||||
"generate-sw": "workbox generateSW workbox-config.js"
|
"generate-sw": "workbox generateSW workbox-config.js"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nutriben",
|
"name": "nutriben",
|
||||||
"version": "1.2.42",
|
"version": "1.2.44",
|
||||||
"description": "Nutriben",
|
"description": "Nutriben",
|
||||||
"productName": "Nutriben",
|
"productName": "Nutriben",
|
||||||
"author": "Surya",
|
"author": "Surya",
|
||||||
@@ -9,20 +9,20 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "PORT=8093 APP_VERSION='1.2.42' quasar dev",
|
"dev": "PORT=8093 APP_VERSION='1.2.44' quasar dev",
|
||||||
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
||||||
"build": "quasar build",
|
"build": "quasar build",
|
||||||
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"type-check:watch": "vue-tsc --noEmit --watch",
|
"type-check:watch": "vue-tsc --noEmit --watch",
|
||||||
"buildspa": "APP_VERSION='1.2.42' quasar build -m spa",
|
"buildspa": "APP_VERSION='1.2.44' quasar build -m spa",
|
||||||
"lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"",
|
"lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"",
|
||||||
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
||||||
"pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.42' quasar dev -m pwa",
|
"pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.44' quasar dev -m pwa",
|
||||||
"spa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.42' quasar dev",
|
"spa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.44' quasar dev",
|
||||||
"debug": "quasar dev --mode debug",
|
"debug": "quasar dev --mode debug",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "echo \"No test specified\" && exit 0",
|
||||||
"generate-sw": "workbox generateSW workbox-config.js",
|
"generate-sw": "workbox generateSW workbox-config.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "piuchebuono",
|
"name": "piuchebuono",
|
||||||
"version": "1.2.42",
|
"version": "1.2.44",
|
||||||
"description": "PiuCheBuono",
|
"description": "PiuCheBuono",
|
||||||
"productName": "PiuCheBuono",
|
"productName": "PiuCheBuono",
|
||||||
"author": "Surya",
|
"author": "Surya",
|
||||||
@@ -9,11 +9,11 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "PORT=8085 APP_VERSION='1.2.42' quasar dev",
|
"dev": "PORT=8085 APP_VERSION='1.2.44' quasar dev",
|
||||||
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
||||||
"build": "quasar build",
|
"build": "quasar build",
|
||||||
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"type-check:watch": "vue-tsc --noEmit --watch",
|
"type-check:watch": "vue-tsc --noEmit --watch",
|
||||||
"buildspa": "quasar build -m spa",
|
"buildspa": "quasar build -m spa",
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
||||||
"pwa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.42' quasar dev -m pwa",
|
"pwa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.44' quasar dev -m pwa",
|
||||||
"spa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.42' quasar dev",
|
"spa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.44' quasar dev",
|
||||||
"debug": "quasar dev --mode debug",
|
"debug": "quasar dev --mode debug",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "echo \"No test specified\" && exit 0",
|
||||||
"generate-sw": "workbox generateSW workbox-config.js",
|
"generate-sw": "workbox generateSW workbox-config.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "riso",
|
"name": "riso",
|
||||||
"version": "1.2.42",
|
"version": "1.2.44",
|
||||||
"description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.",
|
"description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.",
|
||||||
"productName": "Riso",
|
"productName": "Riso",
|
||||||
"author": "Surya",
|
"author": "Surya",
|
||||||
@@ -9,11 +9,11 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "APP_VERSION='1.2.42' PORT=8084 quasar dev",
|
"dev": "APP_VERSION='1.2.44' PORT=8084 quasar dev",
|
||||||
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
"dev_noCheck": "SKIP_TSC=true quasar dev",
|
||||||
"build": "quasar build",
|
"build": "quasar build",
|
||||||
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwa": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.42' quasar build -m pwa",
|
"buildpwatest": "NODE_ENV=production APP_VERSION='1.2.44' quasar build -m pwa",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"type-check:watch": "vue-tsc --noEmit --watch",
|
"type-check:watch": "vue-tsc --noEmit --watch",
|
||||||
"buildspa": "quasar build -m spa",
|
"buildspa": "quasar build -m spa",
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
|
||||||
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
|
||||||
"pwa": "NODE_ENV=development PORT=8094 APP_VERSION='1.2.42' quasar dev -m pwa",
|
"pwa": "NODE_ENV=development PORT=8094 APP_VERSION='1.2.44' quasar dev -m pwa",
|
||||||
"spa": "NODE_ENV=development PORT=8084 APP_VERSION='1.2.42' quasar dev",
|
"spa": "NODE_ENV=development PORT=8084 APP_VERSION='1.2.44' quasar dev",
|
||||||
"debug": "quasar dev --mode debug",
|
"debug": "quasar dev --mode debug",
|
||||||
"test": "echo \"No test specified\" && exit 0",
|
"test": "echo \"No test specified\" && exit 0",
|
||||||
"generate-sw": "workbox generateSW workbox-config.js",
|
"generate-sw": "workbox generateSW workbox-config.js",
|
||||||
|
|||||||
@@ -19,12 +19,10 @@ fi
|
|||||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||||
|
|
||||||
mv public/upload/products ../../
|
mv public/upload/products ../../
|
||||||
mv public/upload/profile ../../
|
|
||||||
|
|
||||||
npm run buildpwa
|
npm run buildpwa
|
||||||
|
|
||||||
mv ../../products public/upload/
|
mv ../../products public/upload/
|
||||||
mv ../../profile public/upload/
|
|
||||||
|
|
||||||
echo "Sincronizzazione in remoto $SERVERDIR_WEBSITE ..."
|
echo "Sincronizzazione in remoto $SERVERDIR_WEBSITE ..."
|
||||||
rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
|
rsync -e 'ssh -p 8822' -a dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
|
||||||
|
|||||||
@@ -17,12 +17,10 @@ cp .env.test.gruppomacro .env.production
|
|||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
mv public/upload/products ../../
|
mv public/upload/products ../../
|
||||||
mv public/upload/profile ../../
|
|
||||||
|
|
||||||
npm run buildpwatest
|
npm run buildpwatest
|
||||||
|
|
||||||
mv ../../products public/upload/
|
mv ../../products public/upload/
|
||||||
mv ../../profile public/upload/
|
|
||||||
|
|
||||||
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
|
echo "Sincronizzazione $SERVERDIR_WEBSITE in remoto..."
|
||||||
rsync -e 'ssh -p 8822' -a --exclude 'upload' dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
|
rsync -e 'ssh -p 8822' -a --exclude 'upload' dist/pwa/ pcbuser@pcb:$SERVERDIR_WEBSITE
|
||||||
|
|||||||
@@ -3,12 +3,15 @@
|
|||||||
/* global workbox */
|
/* global workbox */
|
||||||
/* global cfgenv */
|
/* global cfgenv */
|
||||||
|
|
||||||
const VITE_APP_VERSION = "1.2.42";
|
const VITE_APP_VERSION = '1.2.44';
|
||||||
|
|
||||||
// Costanti di configurazione
|
// Costanti di configurazione
|
||||||
const DYNAMIC_CACHE = 'dynamic-cache-v2';
|
const DYNAMIC_CACHE = 'dynamic-cache-v2';
|
||||||
const baseUrl = self.location.origin;
|
const baseUrl = self.location.origin;
|
||||||
|
|
||||||
|
const CACHE_VERSION = VITE_APP_VERSION;
|
||||||
|
const CACHE_PREFIX = self.location.hostname || 'app';
|
||||||
|
|
||||||
function extractDomain(url) {
|
function extractDomain(url) {
|
||||||
return url.replace(/^https?:\/\//, '');
|
return url.replace(/^https?:\/\//, '');
|
||||||
}
|
}
|
||||||
@@ -32,38 +35,30 @@ console.log('API_DOMAIN', API_DOMAIN);
|
|||||||
|
|
||||||
const CACHE_NAME = 'pwa-cache-' + VITE_APP_VERSION; // Nome della cache
|
const CACHE_NAME = 'pwa-cache-' + VITE_APP_VERSION; // Nome della cache
|
||||||
|
|
||||||
importScripts('workbox/workbox-sw.js')
|
importScripts('workbox/workbox-sw.js');
|
||||||
|
|
||||||
import { clientsClaim } from 'workbox-core'
|
import { clientsClaim } from 'workbox-core';
|
||||||
import { precacheAndRoute, cleanupOutdatedCaches, createHandlerBoundToURL } from 'workbox-precaching';
|
import { precacheAndRoute, cleanupOutdatedCaches, createHandlerBoundToURL } from 'workbox-precaching';
|
||||||
import { registerRoute, NavigationRoute } from 'workbox-routing';
|
import { registerRoute, NavigationRoute } from 'workbox-routing';
|
||||||
import { setCacheNameDetails } from 'workbox-core';
|
import { setCacheNameDetails } from 'workbox-core';
|
||||||
import {
|
import { NetworkOnly, NetworkFirst, StaleWhileRevalidate, CacheFirst } from 'workbox-strategies';
|
||||||
NetworkOnly,
|
|
||||||
NetworkFirst,
|
|
||||||
StaleWhileRevalidate,
|
|
||||||
CacheFirst,
|
|
||||||
} from 'workbox-strategies';
|
|
||||||
|
|
||||||
import { CacheableResponsePlugin } from 'workbox-cacheable-response';
|
import { CacheableResponsePlugin } from 'workbox-cacheable-response';
|
||||||
import { ExpirationPlugin } from 'workbox-expiration';
|
import { ExpirationPlugin } from 'workbox-expiration';
|
||||||
|
|
||||||
const debug = false; //process.env.NODE_ENV !== 'production';
|
const debug = false; //process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
if (workbox) {
|
if (workbox) {
|
||||||
|
|
||||||
// Imposta configurazione prima di tutto
|
// Imposta configurazione prima di tutto
|
||||||
workbox.setConfig({ debug });
|
workbox.setConfig({ debug });
|
||||||
|
|
||||||
workbox.loadModule('workbox-strategies');
|
workbox.loadModule('workbox-strategies');
|
||||||
|
|
||||||
console.log('Workbox ESISTE ✅ ');
|
console.log('Workbox ESISTE ✅ ');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Workbox NON CARICATO ! ❌');
|
console.error('Workbox NON CARICATO ! ❌');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setCacheNameDetails({
|
setCacheNameDetails({
|
||||||
prefix: self.location.hostname,
|
prefix: self.location.hostname,
|
||||||
suffix: 'v2',
|
suffix: 'v2',
|
||||||
@@ -71,7 +66,7 @@ setCacheNameDetails({
|
|||||||
runtime: 'runtime',
|
runtime: 'runtime',
|
||||||
});
|
});
|
||||||
|
|
||||||
const precacheList = (self.__WB_MANIFEST || []).filter(entry => {
|
const precacheList = (self.__WB_MANIFEST || []).filter((entry) => {
|
||||||
// Esclude tutto ciò che si trova nella cartella 'upload'
|
// Esclude tutto ciò che si trova nella cartella 'upload'
|
||||||
if (entry.url.includes('/upload/')) {
|
if (entry.url.includes('/upload/')) {
|
||||||
return false;
|
return false;
|
||||||
@@ -82,13 +77,12 @@ const precacheList = (self.__WB_MANIFEST || []).filter(entry => {
|
|||||||
// Precache solo i file filtrati
|
// Precache solo i file filtrati
|
||||||
precacheAndRoute(precacheList);
|
precacheAndRoute(precacheList);
|
||||||
|
|
||||||
cleanupOutdatedCaches()
|
cleanupOutdatedCaches();
|
||||||
|
|
||||||
|
|
||||||
// Installazione del Service Worker
|
// Installazione del Service Worker
|
||||||
self.addEventListener('install', () => {
|
self.addEventListener('install', () => {
|
||||||
console.log('[Service Worker] Installing ...');
|
console.log('[Service Worker] Installing ...');
|
||||||
self.skipWaiting()
|
self.skipWaiting();
|
||||||
clientsClaim();
|
clientsClaim();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -98,15 +92,12 @@ self.addEventListener('activate', (event) => {
|
|||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
caches.keys().then((cacheNames) => {
|
caches.keys().then((cacheNames) => {
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
cacheNames
|
cacheNames.filter((name) => name !== CACHE_NAME && name !== DYNAMIC_CACHE).map((name) => caches.delete(name))
|
||||||
.filter(name => name !== CACHE_NAME && name !== DYNAMIC_CACHE)
|
|
||||||
.map((name) => caches.delete(name))
|
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
console.log(' [ VER-' + VITE_APP_VERSION + ' ] _---------________------ PAO: this is my custom service worker: ');
|
console.log(' [ VER-' + VITE_APP_VERSION + ' ] _---------________------ PAO: this is my custom service worker: ');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -121,7 +112,6 @@ let ISTEST = self.location.hostname.startsWith('test');
|
|||||||
let ISLOCALE = self.location.hostname.startsWith('localhost');
|
let ISLOCALE = self.location.hostname.startsWith('localhost');
|
||||||
console.log('SW- app ver ' + VITE_APP_VERSION);
|
console.log('SW- app ver ' + VITE_APP_VERSION);
|
||||||
|
|
||||||
|
|
||||||
// Function helpers
|
// Function helpers
|
||||||
async function writeData(table, data) {
|
async function writeData(table, data) {
|
||||||
console.log('writeData', table, data);
|
console.log('writeData', table, data);
|
||||||
@@ -141,8 +131,6 @@ async function deleteItemFromData(table, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (workbox) {
|
if (workbox) {
|
||||||
|
|
||||||
|
|
||||||
/*if (process.env.MODE !== 'ssr' || process.env.PROD) {
|
/*if (process.env.MODE !== 'ssr' || process.env.PROD) {
|
||||||
registerRoute(
|
registerRoute(
|
||||||
new NavigationRoute(
|
new NavigationRoute(
|
||||||
@@ -152,101 +140,76 @@ if (workbox) {
|
|||||||
)
|
)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Gestione richieste statiche
|
// Static assets (JS, CSS, Fonts) - CacheFirst: caricamento rapidissimo
|
||||||
registerRoute(
|
registerRoute(
|
||||||
({ request }) => request.destination === 'document' || request.destination === 'script' || request.destination === 'style',
|
({ request }) => ['script', 'style', 'font'].includes(request.destination),
|
||||||
new StaleWhileRevalidate({ cacheName: CACHE_NAME })
|
|
||||||
);
|
|
||||||
|
|
||||||
// Cache strategy registrations
|
|
||||||
registerRoute(
|
|
||||||
new RegExp(/\.(?:png|gif|jpg|jpeg)$/),
|
|
||||||
new CacheFirst({
|
new CacheFirst({
|
||||||
cacheName: `images-upload-${VITE_APP_VERSION}`,
|
cacheName: `${CACHE_PREFIX}-static-assets-${CACHE_VERSION}`,
|
||||||
plugins: [
|
plugins: [
|
||||||
new CacheableResponsePlugin({ statuses: [200] }),
|
new CacheableResponsePlugin({ statuses: [0, 200] }),
|
||||||
new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
|
new ExpirationPlugin({ maxEntries: 50, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 giorni
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Immagini - CacheFirst con scadenza e limite
|
||||||
registerRoute(
|
registerRoute(
|
||||||
new RegExp(/\.(?:svg)$/),
|
({ request }) => request.destination === 'image',
|
||||||
new CacheFirst({
|
new CacheFirst({
|
||||||
cacheName: `svg-${VITE_APP_VERSION}`,
|
cacheName: `${CACHE_PREFIX}-images-${CACHE_VERSION}`,
|
||||||
plugins: [
|
plugins: [
|
||||||
new CacheableResponsePlugin({ statuses: [200] }),
|
new CacheableResponsePlugin({ statuses: [0, 200] }),
|
||||||
new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
|
new ExpirationPlugin({ maxEntries: 60, maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 giorni
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Google Fonts - StaleWhileRevalidate per aggiornamenti trasparenti
|
||||||
registerRoute(
|
registerRoute(
|
||||||
new RegExp(/.*(?:googleapis|gstatic)\.com.*$/),
|
/^https:\/\/fonts\.(?:googleapis|gstatic)\.com/,
|
||||||
new StaleWhileRevalidate({
|
new StaleWhileRevalidate({
|
||||||
cacheName: `google-fonts-${VITE_APP_VERSION}`,
|
cacheName: `${CACHE_PREFIX}-google-fonts-${CACHE_VERSION}`,
|
||||||
plugins: [
|
plugins: [new CacheableResponsePlugin({ statuses: [0, 200] }), new ExpirationPlugin({ maxEntries: 30 })],
|
||||||
new CacheableResponsePlugin({ statuses: [200] }),
|
|
||||||
new ExpirationPlugin({ maxEntries: 30 }),
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
/*registerRoute(
|
// HTML documents - NetworkFirst: garantisce contenuti aggiornati e fallback cache
|
||||||
new RegExp('^/myicons/.*$'), // Corrisponde a percorsi come "/icons/miaicona.ico"
|
|
||||||
new CacheFirst({
|
|
||||||
cacheName: `icon-cache-${VITE_APP_VERSION}`,
|
|
||||||
plugins: [
|
|
||||||
new CacheableResponsePlugin({ statuses: [200] }),
|
|
||||||
new ExpirationPlugin({ maxAgeSeconds: 30 * 24 * 60 * 60 }), // 30 Days
|
|
||||||
],
|
|
||||||
})
|
|
||||||
);*/
|
|
||||||
|
|
||||||
registerRoute(
|
registerRoute(
|
||||||
new RegExp(/\.(?:js|css|font)$/),
|
({ request }) => request.destination === 'document',
|
||||||
new StaleWhileRevalidate({
|
new NetworkFirst({
|
||||||
cacheName: `js-css-fonts-${VITE_APP_VERSION}`,
|
cacheName: `${CACHE_PREFIX}-html-cache-${CACHE_VERSION}`,
|
||||||
|
networkTimeoutSeconds: 5, // timeout rapido
|
||||||
plugins: [
|
plugins: [
|
||||||
new CacheableResponsePlugin({ statuses: [200] }),
|
new CacheableResponsePlugin({ statuses: [0, 200] }),
|
||||||
|
new ExpirationPlugin({ maxEntries: 20, maxAgeSeconds: 24 * 60 * 60 }), // 1 giorno
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Gestione API
|
// API calls - NetworkFirst con fallback cache e timeout veloce
|
||||||
registerRoute(
|
registerRoute(
|
||||||
({ url }) => url.hostname === API_DOMAIN,
|
({ url }) => url.hostname === API_DOMAIN,
|
||||||
new NetworkFirst({ fetchOptions: { credentials: 'include' } })
|
new NetworkFirst({
|
||||||
|
cacheName: `${CACHE_PREFIX}-api-cache-${CACHE_VERSION}`,
|
||||||
|
networkTimeoutSeconds: 5,
|
||||||
|
fetchOptions: { credentials: 'include' },
|
||||||
|
plugins: [
|
||||||
|
new CacheableResponsePlugin({ statuses: [0, 200] }),
|
||||||
|
new ExpirationPlugin({ maxEntries: 50, maxAgeSeconds: 5 * 60 }), // 5 minuti
|
||||||
|
],
|
||||||
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
/*registerRoute(
|
|
||||||
(routeData) => routeData.event.request.headers.get('accept').includes('text/html'),
|
|
||||||
async (args) => {
|
|
||||||
let response = await caches.match(args.event.request);
|
|
||||||
if (response) return response;
|
|
||||||
|
|
||||||
try {
|
|
||||||
response = await fetch(args.event.request);
|
|
||||||
const cache = await caches.open('dynamic');
|
|
||||||
cache.put(args.event.request.url, response.clone());
|
|
||||||
return response;
|
|
||||||
} catch (err) {
|
|
||||||
return caches.match('/offline');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);*/
|
|
||||||
|
|
||||||
registerRoute(new RegExp('/admin/'), new NetworkOnly());
|
registerRoute(new RegExp('/admin/'), new NetworkOnly());
|
||||||
|
|
||||||
function generateUUID() {
|
function generateUUID() {
|
||||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
|
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
|
||||||
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const syncStore = {};
|
const syncStore = {};
|
||||||
self.addEventListener('message', event => {
|
self.addEventListener('message', (event) => {
|
||||||
if (event.data && (event.data.type === 'SKIP_WAITING' || event.data.action === 'skipWaiting')) {
|
if (event.data && (event.data.type === 'SKIP_WAITING' || event.data.action === 'skipWaiting')) {
|
||||||
self.skipWaiting();
|
self.skipWaiting();
|
||||||
}
|
}
|
||||||
@@ -259,8 +222,6 @@ if (workbox) {
|
|||||||
console.log(event.data);
|
console.log(event.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Funzione per gestire richieste API
|
// Funzione per gestire richieste API
|
||||||
async function handleApiRequest(request) {
|
async function handleApiRequest(request) {
|
||||||
try {
|
try {
|
||||||
@@ -269,10 +230,13 @@ if (workbox) {
|
|||||||
// Se la risposta non è valida, restituisci un errore personalizzato
|
// Se la risposta non è valida, restituisci un errore personalizzato
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.warn('[SW] API Response Error:', response.status, response.statusText);
|
console.warn('[SW] API Response Error:', response.status, response.statusText);
|
||||||
return new Response(JSON.stringify({
|
return new Response(
|
||||||
error: 'API error',
|
JSON.stringify({
|
||||||
message: `❌ Invalid response from API: ${response.status} ${response.statusText}`,
|
error: 'API error',
|
||||||
}), { status: response.status, headers: { 'Content-Type': 'application/json' } });
|
message: `❌ Invalid response from API: ${response.status} ${response.statusText}`,
|
||||||
|
}),
|
||||||
|
{ status: response.status, headers: { 'Content-Type': 'application/json' } }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -280,10 +244,13 @@ if (workbox) {
|
|||||||
console.error('[Service Worker] API request error ❌:', error);
|
console.error('[Service Worker] API request error ❌:', error);
|
||||||
|
|
||||||
// Restituisci una risposta di errore personalizzata
|
// Restituisci una risposta di errore personalizzata
|
||||||
return new Response(JSON.stringify({
|
return new Response(
|
||||||
error: 'Network error',
|
JSON.stringify({
|
||||||
message: '❌ Unable to fetch from API: ' + error.message,
|
error: 'Network error',
|
||||||
}), { status: 503, headers: { 'Content-Type': 'application/json' } });
|
message: '❌ Unable to fetch from API: ' + error.message,
|
||||||
|
}),
|
||||||
|
{ status: 503, headers: { 'Content-Type': 'application/json' } }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,9 +281,11 @@ if (workbox) {
|
|||||||
const cachedResponse = await cache.match(request);
|
const cachedResponse = await cache.match(request);
|
||||||
if (cachedResponse) {
|
if (cachedResponse) {
|
||||||
// Aggiorna in background mentre restituisci la risposta in cache
|
// Aggiorna in background mentre restituisci la risposta in cache
|
||||||
event.waitUntil(fetchAndCache(request).catch((error) => {
|
event.waitUntil(
|
||||||
console.error('[SW] Background fetch and cache error ❌:', error);
|
fetchAndCache(request).catch((error) => {
|
||||||
}));
|
console.error('[SW] Background fetch and cache error ❌:', error);
|
||||||
|
})
|
||||||
|
);
|
||||||
return cachedResponse;
|
return cachedResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,10 +296,13 @@ if (workbox) {
|
|||||||
console.error('[SW] Cache miss and network error ❌:', error);
|
console.error('[SW] Cache miss and network error ❌:', error);
|
||||||
|
|
||||||
// Restituisci una risposta di fallback personalizzata
|
// Restituisci una risposta di fallback personalizzata
|
||||||
return new Response(JSON.stringify({
|
return new Response(
|
||||||
error: 'Network error',
|
JSON.stringify({
|
||||||
message: 'Unable to fetch resource from network or cache.',
|
error: 'Network error',
|
||||||
}), { status: 503, headers: { 'Content-Type': 'application/json' } });
|
message: 'Unable to fetch resource from network or cache.',
|
||||||
|
}),
|
||||||
|
{ status: 503, headers: { 'Content-Type': 'application/json' } }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +311,6 @@ if (workbox) {
|
|||||||
const { request } = event;
|
const { request } = event;
|
||||||
const url = new URL(request.url);
|
const url = new URL(request.url);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Ignora richieste non gestibili
|
// Ignora richieste non gestibili
|
||||||
if (request.method !== 'GET' || url.protocol !== 'https:') {
|
if (request.method !== 'GET' || url.protocol !== 'https:') {
|
||||||
return;
|
return;
|
||||||
@@ -352,13 +323,13 @@ if (workbox) {
|
|||||||
|
|
||||||
// Gestione richieste API
|
// Gestione richieste API
|
||||||
if (url.hostname === API_DOMAIN) {
|
if (url.hostname === API_DOMAIN) {
|
||||||
if (debug) console.log('E\' una RICHIESTA API!');
|
if (debug) console.log("E' una RICHIESTA API!");
|
||||||
event.respondWith(handleApiRequest(request));
|
event.respondWith(handleApiRequest(request));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gestione risorse statiche e altre richieste
|
// Gestione risorse statiche e altre richieste
|
||||||
if (debug) console.log('E\' una RICHIESTA statica...');
|
if (debug) console.log("E' una RICHIESTA statica...");
|
||||||
event.respondWith(cacheWithStaleWhileRevalidate(request, event));
|
event.respondWith(cacheWithStaleWhileRevalidate(request, event));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[Service Worker] Fetch error ❌:', error);
|
console.error('[Service Worker] Fetch error ❌:', error);
|
||||||
@@ -366,12 +337,12 @@ if (workbox) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Gestione degli errori non catturati
|
// Gestione degli errori non catturati
|
||||||
self.addEventListener('unhandledrejection', event => {
|
self.addEventListener('unhandledrejection', (event) => {
|
||||||
console.error('[Service Worker] Unhandled rejection ❌:', event.reason);
|
console.error('[Service Worker] Unhandled rejection ❌:', event.reason);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Gestione degli errori globali
|
// Gestione degli errori globali
|
||||||
self.addEventListener('error', event => {
|
self.addEventListener('error', (event) => {
|
||||||
console.error('[Service Worker] Global error ❌:', event.error);
|
console.error('[Service Worker] Global error ❌:', event.error);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -382,8 +353,7 @@ if (workbox) {
|
|||||||
// console.log('Request mode:', request.mode);
|
// console.log('Request mode:', request.mode);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
self.addEventListener('sync', (event) => {
|
||||||
self.addEventListener('sync', event => {
|
|
||||||
console.log('[Service Worker V5] Background syncing', event);
|
console.log('[Service Worker V5] Background syncing', event);
|
||||||
|
|
||||||
let mystrparam = event.tag;
|
let mystrparam = event.tag;
|
||||||
@@ -401,7 +371,7 @@ if (workbox) {
|
|||||||
headers.append('x-refrtok', refreshToken);
|
headers.append('x-refrtok', refreshToken);
|
||||||
|
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
readAllData(table).then(alldata => {
|
readAllData(table).then((alldata) => {
|
||||||
const myrecs = [...alldata];
|
const myrecs = [...alldata];
|
||||||
let errorfromserver = false;
|
let errorfromserver = false;
|
||||||
|
|
||||||
@@ -420,11 +390,12 @@ if (workbox) {
|
|||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
body: JSON.stringify(rec),
|
body: JSON.stringify(rec),
|
||||||
}).then(() => {
|
|
||||||
deleteItemFromData(table, rec._id);
|
|
||||||
deleteItemFromData('swmsg', mystrparam);
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.then(() => {
|
||||||
|
deleteItemFromData(table, rec._id);
|
||||||
|
deleteItemFromData('swmsg', mystrparam);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
if (err.message === 'Failed to fetch') {
|
if (err.message === 'Failed to fetch') {
|
||||||
errorfromserver = true;
|
errorfromserver = true;
|
||||||
}
|
}
|
||||||
@@ -461,7 +432,7 @@ if (workbox) {
|
|||||||
self.clients.openWindow(notification.data.url);
|
self.clients.openWindow(notification.data.url);
|
||||||
}
|
}
|
||||||
notification.close();
|
notification.close();
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 356 360">
|
|
||||||
<path
|
|
||||||
d="M43.4 303.4c0 3.8-2.3 6.3-7.1 6.3h-15v-22h14.4c4.3 0 6.2 2.2 6.2 5.2 0 2.6-1.5 4.4-3.4 5 2.8.4 4.9 2.5 4.9 5.5zm-8-13H24.1v6.9H35c2.1 0 4-1.3 4-3.8 0-2.2-1.3-3.1-3.7-3.1zm5.1 12.6c0-2.3-1.8-3.7-4-3.7H24.2v7.7h11.7c3.4 0 4.6-1.8 4.6-4zm36.3 4v2.7H56v-22h20.6v2.7H58.9v6.8h14.6v2.3H58.9v7.5h17.9zm23-5.8v8.5H97v-8.5l-11-13.4h3.4l8.9 11 8.8-11h3.4l-10.8 13.4zm19.1-1.8V298c0-7.9 5.2-10.7 12.7-10.7 7.5 0 13 2.8 13 10.7v1.4c0 7.9-5.5 10.8-13 10.8s-12.7-3-12.7-10.8zm22.7 0V298c0-5.7-3.9-8-10-8-6 0-9.8 2.3-9.8 8v1.4c0 5.8 3.8 8.1 9.8 8.1 6 0 10-2.3 10-8.1zm37.2-11.6v21.9h-2.9l-15.8-17.9v17.9h-2.8v-22h3l15.6 18v-18h2.9zm37.9 10.2v1.3c0 7.8-5.2 10.4-12.4 10.4H193v-22h11.2c7.2 0 12.4 2.8 12.4 10.3zm-3 0c0-5.3-3.3-7.6-9.4-7.6h-8.4V307h8.4c6 0 9.5-2 9.5-7.7V298zm50.8-7.6h-9.7v19.3h-3v-19.3h-9.7v-2.6h22.4v2.6zm34.4-2.6v21.9h-3v-10.1h-16.8v10h-2.8v-21.8h2.8v9.2H296v-9.2h2.9zm34.9 19.2v2.7h-20.7v-22h20.6v2.7H316v6.8h14.5v2.3H316v7.5h17.8zM24 340.2v7.3h13.9v2.4h-14v9.6H21v-22h20v2.7H24zm41.5 11.4h-9.8v7.9H53v-22h13.3c5.1 0 8 1.9 8 6.8 0 3.7-2 6.3-5.6 7l6 8.2h-3.3l-5.8-8zm-9.8-2.6H66c3.1 0 5.3-1.5 5.3-4.7 0-3.3-2.2-4.1-5.3-4.1H55.7v8.8zm47.9 6.2H89l-2 4.3h-3.2l10.7-22.2H98l10.7 22.2h-3.2l-2-4.3zm-1-2.3l-6.3-13-6 13h12.2zm46.3-15.3v21.9H146v-17.2L135.7 358h-2.1l-10.2-15.6v17h-2.8v-21.8h3l11 16.9 11.3-17h3zm35 19.3v2.6h-20.7v-22h20.6v2.7H166v6.8h14.5v2.3H166v7.6h17.8zm47-19.3l-8.3 22h-3l-7.1-18.6-7 18.6h-3l-8.2-22h3.3L204 356l6.8-18.5h3.4L221 356l6.6-18.5h3.3zm10 11.6v-1.4c0-7.8 5.2-10.7 12.7-10.7 7.6 0 13 2.9 13 10.7v1.4c0 7.9-5.4 10.8-13 10.8-7.5 0-12.7-3-12.7-10.8zm22.8 0v-1.4c0-5.7-4-8-10-8s-9.9 2.3-9.9 8v1.4c0 5.8 3.8 8.2 9.8 8.2 6.1 0 10-2.4 10-8.2zm28.3 2.4h-9.8v7.9h-2.8v-22h13.2c5.2 0 8 1.9 8 6.8 0 3.7-2 6.3-5.6 7l6 8.2h-3.3l-5.8-8zm-9.8-2.6h10.2c3 0 5.2-1.5 5.2-4.7 0-3.3-2.1-4.1-5.2-4.1h-10.2v8.8zm40.3-1.5l-6.8 5.6v6.4h-2.9v-22h2.9v12.3l15.2-12.2h3.7l-9.9 8.1 10.3 13.8h-3.6l-8.9-12z" />
|
|
||||||
<path fill="#050A14"
|
|
||||||
d="M188.4 71.7a10.4 10.4 0 01-20.8 0 10.4 10.4 0 1120.8 0zM224.2 45c-2.2-3.9-5-7.5-8.2-10.7l-12 7c-3.7-3.2-8-5.7-12.6-7.3a49.4 49.4 0 00-9.7 13.9 59 59 0 0140.1 14l7.6-4.4a57 57 0 00-5.2-12.5zM178 125.1c4.5 0 9-.6 13.4-1.7v-14a40 40 0 0012.5-7.2 47.7 47.7 0 00-7.1-15.3 59 59 0 01-32.2 27.7v8.7c4.4 1.2 8.9 1.8 13.4 1.8zM131.8 45c-2.3 4-4 8.1-5.2 12.5l12 7a40 40 0 000 14.4c5.7 1.5 11.3 2 16.9 1.5a59 59 0 01-8-41.7l-7.5-4.3c-3.2 3.2-6 6.7-8.2 10.6z" />
|
|
||||||
<path fill="#00B4FF"
|
|
||||||
d="M224.2 98.4c2.3-3.9 4-8 5.2-12.4l-12-7a40 40 0 000-14.5c-5.7-1.5-11.3-2-16.9-1.5a59 59 0 018 41.7l7.5 4.4c3.2-3.2 6-6.8 8.2-10.7zm-92.4 0c2.2 4 5 7.5 8.2 10.7l12-7a40 40 0 0012.6 7.3c4-4.1 7.3-8.8 9.7-13.8a59 59 0 01-40-14l-7.7 4.4c1.2 4.3 3 8.5 5.2 12.4zm46.2-80c-4.5 0-9 .5-13.4 1.7V34a40 40 0 00-12.5 7.2c1.5 5.7 4 10.8 7.1 15.4a59 59 0 0132.2-27.7V20a53.3 53.3 0 00-13.4-1.8z" />
|
|
||||||
<path fill="#00B4FF"
|
|
||||||
d="M178 9.2a62.6 62.6 0 11-.1 125.2A62.6 62.6 0 01178 9.2m0-9.2a71.7 71.7 0 100 143.5A71.7 71.7 0 00178 0z" />
|
|
||||||
<path fill="#050A14"
|
|
||||||
d="M96.6 212v4.3c-9.2-.8-15.4-5.8-15.4-17.8V180h4.6v18.4c0 8.6 4 12.6 10.8 13.5zm16-31.9v18.4c0 8.9-4.3 12.8-10.9 13.5v4.4c9.2-.7 15.5-5.6 15.5-18v-18.3h-4.7zM62.2 199v-2.2c0-12.7-8.8-17.4-21-17.4-12.1 0-20.7 4.7-20.7 17.4v2.2c0 12.8 8.6 17.6 20.7 17.6 1.5 0 3-.1 4.4-.3l11.8 6.2 2-3.3-8.2-4-6.4-3.1a32 32 0 01-3.6.2c-9.8 0-16-3.9-16-13.3v-2.2c0-9.3 6.2-13.1 16-13.1 9.9 0 16.3 3.8 16.3 13.1v2.2c0 5.3-2.1 8.7-5.6 10.8l4.8 2.4c3.4-2.8 5.5-7 5.5-13.2zM168 215.6h5.1L156 179.7h-4.8l17 36zM143 205l7.4-15.7-2.4-5-15.1 31.4h5.1l3.3-7h18.3l-1.8-3.7H143zm133.7 10.7h5.2l-17.3-35.9h-4.8l17 36zm-25-10.7l7.4-15.7-2.4-5-15.1 31.4h5.1l3.3-7h18.3l-1.7-3.7h-14.8zm73.8-2.5c6-1.2 9-5.4 9-11.4 0-8-4.5-10.9-12.9-10.9h-21.4v35.5h4.6v-31.3h16.5c5 0 8.5 1.4 8.5 6.7 0 5.2-3.5 7.7-8.5 7.7h-11.4v4.1h10.7l9.3 12.8h5.5l-9.9-13.2zm-117.4 9.9c-9.7 0-14.7-2.5-18.6-6.3l-2.2 3.8c5.1 5 11 6.7 21 6.7 1.6 0 3.1-.1 4.6-.3l-1.9-4h-3zm18.4-7c0-6.4-4.7-8.6-13.8-9.4l-10.1-1c-6.7-.7-9.3-2.2-9.3-5.6 0-2.5 1.4-4 4.6-5l-1.8-3.8c-4.7 1.4-7.5 4.2-7.5 8.9 0 5.2 3.4 8.7 13 9.6l11.3 1.2c6.4.6 8.9 2 8.9 5.4 0 2.7-2.1 4.7-6 5.8l1.8 3.9c5.3-1.6 8.9-4.7 8.9-10zm-20.3-21.9c7.9 0 13.3 1.8 18.1 5.7l1.8-3.9a30 30 0 00-19.6-5.9c-2 0-4 .1-5.7.3l1.9 4 3.5-.2z" />
|
|
||||||
<path fill="#00B4FF"
|
|
||||||
d="M.5 251.9c29.6-.5 59.2-.8 88.8-1l88.7-.3 88.7.3 44.4.4 44.4.6-44.4.6-44.4.4-88.7.3-88.7-.3a7981 7981 0 01-88.8-1z" />
|
|
||||||
<path fill="none" d="M-565.2 324H-252v15.8h-313.2z" />
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 4.4 KiB |
@@ -77,8 +77,8 @@
|
|||||||
'book-image-fixed': complete,
|
'book-image-fixed': complete,
|
||||||
'cursor-pointer': !complete,
|
'cursor-pointer': !complete,
|
||||||
'shadow-4': !optcatalogo.pdf,
|
'shadow-4': !optcatalogo.pdf,
|
||||||
'border-box': optcatalogo.pdf,
|
|
||||||
}"
|
}"
|
||||||
|
:img-class="optcatalogo.pdf ? 'border-box' : ''"
|
||||||
:style="{
|
:style="{
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
width:
|
width:
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<div class="q-ma-sm no-print">
|
<div class="q-ma-sm no-print">
|
||||||
<div
|
<div
|
||||||
class="row absolute-top-left semi-transparent "
|
class="row absolute-top-left semi-transparent"
|
||||||
style="z-index: 10"
|
style="z-index: 10"
|
||||||
>
|
>
|
||||||
<q-btn-dropdown
|
<q-btn-dropdown
|
||||||
@@ -179,12 +179,10 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>-->
|
</q-item>-->
|
||||||
<q-item
|
<q-item
|
||||||
v-if="
|
v-if="!optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)"
|
||||||
!optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
|
||||||
"
|
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="refreshSingleBookFromGM({usaDBGMLocale: false})"
|
@click="refreshSingleBookFromGM({ usaDBGMLocale: false })"
|
||||||
>
|
>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-avatar
|
<q-avatar
|
||||||
@@ -203,7 +201,7 @@
|
|||||||
"
|
"
|
||||||
clickable
|
clickable
|
||||||
v-close-popup
|
v-close-popup
|
||||||
@click="refreshSingleBookFromGM({usaDBGMLocale: true})"
|
@click="refreshSingleBookFromGM({ usaDBGMLocale: true })"
|
||||||
>
|
>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-avatar
|
<q-avatar
|
||||||
@@ -674,7 +672,6 @@
|
|||||||
@updateproductmodif="updateproductmodif"
|
@updateproductmodif="updateproductmodif"
|
||||||
>
|
>
|
||||||
</CSchedaProdotto>
|
</CSchedaProdotto>
|
||||||
|
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
<q-dialog
|
<q-dialog
|
||||||
v-if="myproduct && modifTrafiletto"
|
v-if="myproduct && modifTrafiletto"
|
||||||
@@ -693,7 +690,6 @@
|
|||||||
:maxlength="680"
|
:maxlength="680"
|
||||||
>
|
>
|
||||||
</CModifTrafiletto>
|
</CModifTrafiletto>
|
||||||
|
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
<q-dialog
|
<q-dialog
|
||||||
v-if="visufromgm && myproduct"
|
v-if="visufromgm && myproduct"
|
||||||
@@ -716,7 +712,8 @@
|
|||||||
nameTable: 'T_Web_Articoli',
|
nameTable: 'T_Web_Articoli',
|
||||||
campispeciali: true,
|
campispeciali: true,
|
||||||
numrec: 1,
|
numrec: 1,
|
||||||
where: 'T.IdArticolo =' + myproduct.productInfo.sku + ' AND T.Ean13 = \'' + myproduct.productInfo.code + '\'',
|
where:
|
||||||
|
'T.IdArticolo =' + myproduct.productInfo.sku + ' AND T.Ean13 = \'' + myproduct.productInfo.code + '\'',
|
||||||
showQtaDisponibile,
|
showQtaDisponibile,
|
||||||
outhtml: true,
|
outhtml: true,
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export default defineComponent({
|
|||||||
watch(() => props.modelValue, (newVal) => {
|
watch(() => props.modelValue, (newVal) => {
|
||||||
optcatalogo.value = { ...newVal };
|
optcatalogo.value = { ...newVal };
|
||||||
// updateCatalogoPadre()
|
// updateCatalogoPadre()
|
||||||
}, { deep: true });
|
}, { deep: false });
|
||||||
|
|
||||||
function updateCatalogoPadre() {
|
function updateCatalogoPadre() {
|
||||||
emit('update:modelValue', optcatalogo.value);
|
emit('update:modelValue', optcatalogo.value);
|
||||||
|
|||||||
27
src/components/CJSONViewer/CJSONViewer.scss
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
.json-container {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: monospace;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.json-key {
|
||||||
|
color: brown;
|
||||||
|
}
|
||||||
|
.json-string {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
.json-boolean {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
.json-number {
|
||||||
|
color: darkorange;
|
||||||
|
}
|
||||||
|
.json-null {
|
||||||
|
color: magenta;
|
||||||
|
}
|
||||||
|
.json-error {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
57
src/components/CJSONViewer/CJSONViewer.ts
Executable file
@@ -0,0 +1,57 @@
|
|||||||
|
import { computed, defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch } from 'vue';
|
||||||
|
|
||||||
|
import { tools } from '@tools';
|
||||||
|
import { costanti } from '@costanti';
|
||||||
|
import { useGlobalStore } from '@store/globalStore';
|
||||||
|
import { useUserStore } from '@store/UserStore';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'CJSONViewer',
|
||||||
|
props: {
|
||||||
|
json: {
|
||||||
|
type: [Object, Array, String, null],
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup(props) {
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
// Funzione di highlight della sintassi JSON
|
||||||
|
function syntaxHighlight(json: string): string {
|
||||||
|
return json
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(
|
||||||
|
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g,
|
||||||
|
(match) => {
|
||||||
|
let cls = 'json-value';
|
||||||
|
if (/^"/.test(match)) {
|
||||||
|
if (/:$/.test(match)) cls = 'json-key';
|
||||||
|
else cls = 'json-string';
|
||||||
|
} else if (/true|false/.test(match)) cls = 'json-boolean';
|
||||||
|
else if (/null/.test(match)) cls = 'json-null';
|
||||||
|
else if (/^-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?$/.test(match)) cls = 'json-number';
|
||||||
|
return `<span class="${cls}">${match}</span>`;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formatta e applica la colorazione
|
||||||
|
const highlightedJson = () => {
|
||||||
|
try {
|
||||||
|
const data = typeof props.json === 'string' ? JSON.parse(props.json) : props.json;
|
||||||
|
const jsonString = JSON.stringify(data, null, 2);
|
||||||
|
return syntaxHighlight(jsonString);
|
||||||
|
} catch (e) {
|
||||||
|
return `<span class="json-error">${t('invalid_json')}</span>`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
highlightedJson,
|
||||||
|
t,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
9
src/components/CJSONViewer/CJSONViewer.vue
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div class="json-container" v-html="highlightedJson()"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" src="./CJSONViewer.ts">
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import './CJSONViewer.scss';
|
||||||
|
</style>
|
||||||
1
src/components/CJSONViewer/index.ts
Executable file
@@ -0,0 +1 @@
|
|||||||
|
export { default as CJSONViewer } from './CJSONViewer.vue'
|
||||||
@@ -366,7 +366,7 @@ export default defineComponent({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Area di stampa MOUNTED... ',myel.value.catalogo.areadistampa)
|
// console.log('Area di stampa MOUNTED... ',myel.value.catalogo.areadistampa)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|||||||
38
src/components/CTestLungo/CTestLungo.scss
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
.cltitlebg{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.titletext {
|
||||||
|
color: white;
|
||||||
|
font-size: 3rem;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 3rem;
|
||||||
|
text-shadow: .25rem .25rem .5rem black;
|
||||||
|
letter-spacing: .00937em;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 718px) {
|
||||||
|
// PER VERSIONE MOBILE
|
||||||
|
.titletext {
|
||||||
|
color: white;
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 2rem;
|
||||||
|
text-shadow: .25rem .25rem .5rem black;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-img__content > div{
|
||||||
|
background: rgba(0,0,0,0.17) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background: #f4f4f4;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
106
src/components/CTestLungo/CTestLungo.ts
Executable file
@@ -0,0 +1,106 @@
|
|||||||
|
import { computed, defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch } from 'vue';
|
||||||
|
|
||||||
|
import { tools } from '@tools';
|
||||||
|
import { costanti } from '@costanti';
|
||||||
|
import { useGlobalStore } from '@store/globalStore';
|
||||||
|
import { useUserStore } from '@store/UserStore';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { CJSONViewer } from '@src/components/CJSONViewer';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'CTestLungo',
|
||||||
|
props: {},
|
||||||
|
components: { CJSONViewer},
|
||||||
|
setup(props, { attrs, slots, emit }) {
|
||||||
|
const { t } = useI18n();
|
||||||
|
const globalStore = useGlobalStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
const testServer = ref({});
|
||||||
|
|
||||||
|
const serverhost = ref('');
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
const error = ref('');
|
||||||
|
|
||||||
|
const callLog = ref<string[]>([]);
|
||||||
|
|
||||||
|
const myrecfiltertoggle = ref(0);
|
||||||
|
|
||||||
|
const SERVER_TEST = ref([
|
||||||
|
{ key: 1, label: 'Test (FreePlanet)', host: 'https://test.freeplanet.app:3001' },
|
||||||
|
{ key: 2, label: 'Produzione', host: tools.getServerHost() },
|
||||||
|
{ key: 3, label: 'Locale', host: 'https://localhost:3000' },
|
||||||
|
{ key: 4, label: 'Host IP', host: globalStore.site.host_ip },
|
||||||
|
{ key: 5, label: 'Host', host: globalStore.site.host },
|
||||||
|
{ key: 6, label: 'Host Api', host: globalStore.site.host_api },
|
||||||
|
{ key: 7, label: 'Host Api IP', host: globalStore.site.host_api_ip },
|
||||||
|
]);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => myrecfiltertoggle.value,
|
||||||
|
(value: any, oldValue: any) => {
|
||||||
|
if (value) {
|
||||||
|
const trovato = SERVER_TEST.value.find((rec: any) => rec.key === value);
|
||||||
|
if (trovato) {
|
||||||
|
globalStore.serverHost = trovato.host;
|
||||||
|
ricarica();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const getoptions = computed(() => {
|
||||||
|
const arr = [];
|
||||||
|
for (const rec of SERVER_TEST.value) {
|
||||||
|
arr.push({ label: rec.label, value: rec.key });
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
});
|
||||||
|
|
||||||
|
function mounted() {
|
||||||
|
// ricarica();
|
||||||
|
|
||||||
|
// globalStore.getStatSite();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function ricarica(timeout?: number = 60000) {
|
||||||
|
loading.value = true;
|
||||||
|
error.value = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
testServer.value = {};
|
||||||
|
callLog.value.push(`${new Date().toISOString()}: Eseguo Chiamata... timeout: ${timeout}`);
|
||||||
|
testServer.value = await globalStore.loadPageTestLungo(timeout);
|
||||||
|
callLog.value.push(`${new Date().toISOString()}: Success: Called loadPageTestLungo (${timeout})`);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Errore nella richiesta:', err.message || err);
|
||||||
|
if (err.code === 'ECONNABORTED') {
|
||||||
|
error.value = 'Timeout: la richiesta ha superato il tempo massimo consentito.';
|
||||||
|
} else {
|
||||||
|
error.value = 'Errore nella comunicazione col server. Controlla la connessione.';
|
||||||
|
}
|
||||||
|
callLog.value.push(`${new Date().toISOString()}: Error: ${err instanceof Error ? err.message : JSON.stringify(err)}`);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(mounted);
|
||||||
|
|
||||||
|
return {
|
||||||
|
t,
|
||||||
|
tools,
|
||||||
|
getoptions,
|
||||||
|
costanti,
|
||||||
|
testServer,
|
||||||
|
ricarica,
|
||||||
|
myrecfiltertoggle,
|
||||||
|
loading,
|
||||||
|
error,
|
||||||
|
serverhost,
|
||||||
|
callLog,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
76
src/components/CTestLungo/CTestLungo.vue
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
<template>
|
||||||
|
<div class="bi-border-all">
|
||||||
|
|
||||||
|
<q-banner
|
||||||
|
rounded
|
||||||
|
class="bg-primary text-white"
|
||||||
|
color="primary q-title"
|
||||||
|
style="text-align: center;">
|
||||||
|
<p class="mybanner">Server: {{tools.getServerHost()}}</p>
|
||||||
|
</q-banner>
|
||||||
|
|
||||||
|
<div v-if="error" class="text-negative q-mt-md">
|
||||||
|
{{ error }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<q-btn-toggle
|
||||||
|
class="column"
|
||||||
|
v-model="myrecfiltertoggle"
|
||||||
|
push
|
||||||
|
glossy
|
||||||
|
toggle-color="primary"
|
||||||
|
:options="getoptions"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="text-center q-ma-lg">
|
||||||
|
<q-btn push size="lg" color="primary" rounded @click="ricarica">
|
||||||
|
{{ loading ? 'Elaborazione in corso...' : 'Avvia Elaborazione' }}
|
||||||
|
</q-btn>
|
||||||
|
<q-btn v-if="!loading" push size="lg" color="primary" rounded @click="ricarica(10000)">
|
||||||
|
{{ !loading ? '10 sec' : '' }}
|
||||||
|
</q-btn>
|
||||||
|
<q-btn v-if="!loading" push size="lg" color="primary" rounded @click="ricarica(60000)">
|
||||||
|
{{ !loading ? '1 min' : '' }}
|
||||||
|
</q-btn>
|
||||||
|
<q-btn v-if="!loading" push size="lg" color="primary" rounded @click="ricarica(300000)">
|
||||||
|
{{ !loading ? '5 min' : '' }}
|
||||||
|
</q-btn>
|
||||||
|
<q-btn v-if="!loading" push size="lg" color="primary" rounded @click="ricarica(600000)">
|
||||||
|
{{ !loading ? '10 min' : '' }}
|
||||||
|
</q-btn>
|
||||||
|
<q-btn v-if="!loading" push size="lg" color="primary" rounded @click="ricarica(1200000)">
|
||||||
|
{{ !loading ? '20 min' : '' }}
|
||||||
|
</q-btn>
|
||||||
|
|
||||||
|
<q-linear-progress
|
||||||
|
v-if="loading"
|
||||||
|
indeterminate
|
||||||
|
color="primary"
|
||||||
|
class="q-my-md"
|
||||||
|
size="20px"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="json-wrapper">
|
||||||
|
<CJSONViewer :json="testServer" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="q-ma-lg">
|
||||||
|
Chiamate effettuate:
|
||||||
|
<ul>
|
||||||
|
<li v-for="c in callLog.slice().reverse()" :key="c">{{c}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" src="./CTestLungo.ts">
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import './CTestLungo.scss';
|
||||||
|
</style>
|
||||||
1
src/components/CTestLungo/index.ts
Executable file
@@ -0,0 +1 @@
|
|||||||
|
export { default as CTestLungo } from './CTestLungo.vue'
|
||||||
@@ -69,6 +69,16 @@ function getDynamicPages(site: ISites): IListRoutes[] {
|
|||||||
inmenu: false,
|
inmenu: false,
|
||||||
infooter: false,
|
infooter: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
active: true,
|
||||||
|
order: 400,
|
||||||
|
path: '/test-lungo',
|
||||||
|
materialIcon: 'fas fa-test',
|
||||||
|
name: 'mypages.test_lungo',
|
||||||
|
component: () => import('@src/views/testLungo/testLungo.vue'),
|
||||||
|
inmenu: false,
|
||||||
|
infooter: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
active: true,
|
active: true,
|
||||||
order: 15,
|
order: 15,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { CNotifAtTop } from '@src/components/CNotifAtTop'
|
|||||||
|
|
||||||
import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
||||||
import { CTitlePage } from '@src/components/CTitlePage'
|
import { CTitlePage } from '@src/components/CTitlePage'
|
||||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
// import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||||
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
||||||
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
@@ -27,7 +27,7 @@ import { shared_consts } from '@src/common/shared_vuejs'
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'hosp',
|
name: 'hosp',
|
||||||
components: { CSkill, CMapsEsempio, CNotifAtTop, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter },
|
components: { CSkill, CNotifAtTop, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter },
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
colmyHosp,
|
colmyHosp,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
|||||||
import { CStatusReg } from '@src/components/CStatusReg'
|
import { CStatusReg } from '@src/components/CStatusReg'
|
||||||
import { CCopyBtn } from '@src/components/CCopyBtn'
|
import { CCopyBtn } from '@src/components/CCopyBtn'
|
||||||
import { CCheckIfIsLogged } from '@src/components/CCheckIfIsLogged'
|
import { CCheckIfIsLogged } from '@src/components/CCheckIfIsLogged'
|
||||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
// import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||||
import { CEventsCalendar } from '@src/components/CEventsCalendar'
|
import { CEventsCalendar } from '@src/components/CEventsCalendar'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
import { useUserStore } from '@store/UserStore'
|
import { useUserStore } from '@store/UserStore'
|
||||||
@@ -28,7 +28,7 @@ import MixinMetaTags from '@src/mixins/mixin-metatags'
|
|||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'mainview',
|
name: 'mainview',
|
||||||
components: {
|
components: {
|
||||||
CSkill, CMapsEsempio, CDashboard, CUserNonVerif, CMainView, CCopyBtn,
|
CSkill, CDashboard, CUserNonVerif, CMainView, CCopyBtn,
|
||||||
CNotifAtTop, LandingFooter,
|
CNotifAtTop, LandingFooter,
|
||||||
CCheckIfIsLogged, CStatusReg, CEventsCalendar, CPresentazione, CMyPageElem
|
CCheckIfIsLogged, CStatusReg, CEventsCalendar, CPresentazione, CMyPageElem
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { CFinder } from '@src/components/CFinder'
|
|||||||
import { CDashboard } from '@src/components/CDashboard'
|
import { CDashboard } from '@src/components/CDashboard'
|
||||||
import { CTitleBanner } from '@src/components/CTitleBanner'
|
import { CTitleBanner } from '@src/components/CTitleBanner'
|
||||||
import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
||||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
// import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||||
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
||||||
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
@@ -20,7 +20,7 @@ import MixinUsers from '@src/mixins/mixin-users'
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'mobility',
|
name: 'mobility',
|
||||||
components: { CSkill, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitleBanner },
|
components: { CSkill, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitleBanner },
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
tools,
|
tools,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { CFinder } from '@src/components/CFinder'
|
|||||||
import { CDashboard } from '@src/components/CDashboard'
|
import { CDashboard } from '@src/components/CDashboard'
|
||||||
import { CTitlePage } from '@src/components/CTitlePage'
|
import { CTitlePage } from '@src/components/CTitlePage'
|
||||||
import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
||||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
// import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||||
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
||||||
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
||||||
import { LandingFooter } from '@src/components/LandingFooter'
|
import { LandingFooter } from '@src/components/LandingFooter'
|
||||||
@@ -22,7 +22,7 @@ import { costanti } from '@costanti'
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ProvaPao',
|
name: 'ProvaPao',
|
||||||
components: { CSkill, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter },
|
components: { CSkill, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter },
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { CFinder } from '@src/components/CFinder'
|
|||||||
import { CDashboard } from '@src/components/CDashboard'
|
import { CDashboard } from '@src/components/CDashboard'
|
||||||
import { CTitleBanner } from '@src/components/CTitleBanner'
|
import { CTitleBanner } from '@src/components/CTitleBanner'
|
||||||
import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
import { CUserNonVerif } from '@src/components/CUserNonVerif'
|
||||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
// import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||||
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
||||||
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
@@ -20,7 +20,7 @@ import MixinUsers from '@src/mixins/mixin-users'
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'work',
|
name: 'work',
|
||||||
components: { CSkill, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitleBanner },
|
components: { CSkill, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitleBanner },
|
||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -131,6 +131,11 @@ async function Request(type, path, payload, responsedata = {}, options = {}) {
|
|||||||
...responsedata,
|
...responsedata,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ✅ AGGIUNGI IL TIMEOUT DALLE OPTIONS
|
||||||
|
if (options?.timeout) {
|
||||||
|
config.timeout = options.timeout; // in millisecondi (es. 300000 = 5 minuti)
|
||||||
|
}
|
||||||
|
|
||||||
if (options?.stream) config.responseType = 'stream';
|
if (options?.stream) config.responseType = 'stream';
|
||||||
|
|
||||||
let response;
|
let response;
|
||||||
|
|||||||
@@ -1050,7 +1050,7 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async execDbOp(paramquery: any) {
|
async execDbOp(paramquery: any) {
|
||||||
return Api.SendReq('/users/dbop', 'POST', paramquery)
|
return Api.SendReq('/users/dbop', 'POST', paramquery, false, false, 0, 5000, null, null, {timeout: 300000})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
return res.data
|
return res.data
|
||||||
|
|||||||
@@ -237,9 +237,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
sovrascriviPaginaDefaultFromTemplate:
|
sovrascriviPaginaDefaultFromTemplate:
|
||||||
(state: IGlobalState) => (idTemplate: string, origDimensioni: IDimensioni) => {
|
(state: IGlobalState) => (idTemplate: string, origDimensioni: IDimensioni) => {
|
||||||
|
|
||||||
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
|
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
|
||||||
|
|
||||||
const linkIdTemplate = origDimensioni.linkIdTemplate;
|
const linkIdTemplate = origDimensioni.linkIdTemplate;
|
||||||
@@ -261,27 +260,25 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
sovrascriviAreadistampaFromTemplate:
|
sovrascriviAreadistampaFromTemplate: (state: IGlobalState) => (idTemplate: string, optCatalogo: IOptCatalogo) => {
|
||||||
(state: IGlobalState) => (idTemplate: string, optCatalogo: IOptCatalogo) => {
|
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
|
||||||
|
|
||||||
const myfindelem = state.myelems.find((myelem: IMyElem) => myelem._id === idTemplate);
|
const linkIdTemplate = optCatalogo.print_linkIdTemplate;
|
||||||
|
|
||||||
const linkIdTemplate = optCatalogo.print_linkIdTemplate;
|
if (myfindelem) {
|
||||||
|
const myelemtocopy = tools.jsonCopy(myfindelem);
|
||||||
|
|
||||||
if (myfindelem) {
|
if (myelemtocopy) {
|
||||||
const myelemtocopy = tools.jsonCopy(myfindelem);
|
// myelemtocopy.scheda._id = origScheda.scheda?._id;
|
||||||
|
myelemtocopy.catalogo.print_isTemplate = false;
|
||||||
|
myelemtocopy.catalogo.print_linkIdTemplate = linkIdTemplate;
|
||||||
|
|
||||||
if (myelemtocopy) {
|
return myelemtocopy.catalogo;
|
||||||
// myelemtocopy.scheda._id = origScheda.scheda?._id;
|
|
||||||
myelemtocopy.catalogo.print_isTemplate = false;
|
|
||||||
myelemtocopy.catalogo.print_linkIdTemplate = linkIdTemplate;
|
|
||||||
|
|
||||||
return myelemtocopy.catalogo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
// conta: (state: IGlobalState) => { state.conta },
|
// conta: (state: IGlobalState) => { state.conta },
|
||||||
// listatodo: (state: IGlobalState) => { state.listatodo },
|
// listatodo: (state: IGlobalState) => { state.listatodo },
|
||||||
@@ -1451,6 +1448,19 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
return error;
|
return error;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
async loadPageTestLungo(timeout) {
|
||||||
|
console.log('loadPageTestLungo');
|
||||||
|
|
||||||
|
const obj = { test: 'OK! Versione Client: ' + tools.getvers(), timeout };
|
||||||
|
|
||||||
|
return Api.SendReq('/api/test-lungo', 'POST', obj, false, false, 0, 5000, null, null, { timeout })
|
||||||
|
.then((res) => {
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
async saveTable(mydata: any) {
|
async saveTable(mydata: any) {
|
||||||
// console.log('saveTable', mydata)
|
// console.log('saveTable', mydata)
|
||||||
@@ -2523,7 +2533,6 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
areadistampa: tools.resetRecIAreaDiStampa(null),
|
areadistampa: tools.resetRecIAreaDiStampa(null),
|
||||||
print_isTemplate: false,
|
print_isTemplate: false,
|
||||||
print_linkIdTemplate: '',
|
print_linkIdTemplate: '',
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
createRaccoltaCataloghiVuoto(): IOptCatalogo {
|
createRaccoltaCataloghiVuoto(): IOptCatalogo {
|
||||||
|
|||||||
0
src/views/testLungo/testLungo.scss
Executable file
15
src/views/testLungo/testLungo.ts
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
import {
|
||||||
|
defineComponent, ref, computed,
|
||||||
|
} from 'vue'
|
||||||
|
|
||||||
|
import { CTestLungo } from '../../components/CTestLungo'
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'testLungo',
|
||||||
|
components: { CTestLungo },
|
||||||
|
setup() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
13
src/views/testLungo/testLungo.vue
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
<template>
|
||||||
|
<q-page class="">
|
||||||
|
|
||||||
|
<CTestLungo></CTestLungo>
|
||||||
|
|
||||||
|
</q-page>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script lang="ts" src="./testLungo.ts">
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import './testLungo.scss';
|
||||||
|
</style>
|
||||||
|
Before Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 381 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 9.4 MiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 155 KiB |