gpt4 book ai didi

javascript - NWJS 应用程序在 Windows 上关闭后 Chrome 本地存储会被删除

转载 作者:行者123 更新时间:2023-12-03 08:17:23 31 4
gpt4 key购买 nike

我有一个应用程序,它使用 Chrome 本地存储来保存用户电脑上的一些信息。

该应用程序在 OS X 和 Linux (Ubuntu) 上运行良好,但是在 Windows 8.1 上测试时,我打开了该应用程序的本地存储文件夹。有 2 个文件名为:

chrome-extension_nbcogalgoagjhkbkpjfkfcckdmochgmi_0.localstorage
chrome-extension_nbcogalgoagjhkbkpjfkfcckdmochgmi_0.localstorage-journal

关闭应用程序后,我在文件夹中看到两个文件都被删除了!

之后我再次打开应用程序,发现现在它创建了以下文件:

chrome-extension_cobbbbdapgeflbdpmchapmffabihofip_0.localstorage
chrome-extension_cobbbbdapgeflbdpmchapmffabihofip_0.localstorage-journal

关闭应用程序后,它们再次被删除。

我正在使用 NWJS SDK 13 alpha 版本 3,因为我们也在使用 Chrome Serial。

这是一个仅在 Windows 中发生的问题,尚未在其他版本的 Windows 上进行测试,但至少在 Windows 8.1 上是这样,当我检查 OS X 和 Ubuntu 上的本地存储文件夹时,文件没有被删除.

我正在管理员模式下执行它。

我还注意到关闭应用程序后它不会删除,而是再次打开它后。

不确定我应该发布哪些文件的代码,因此我将发布我认为可能有帮助的内容。我很少用 JS 编程,也没有用 NWJS 编程。可能我做错了什么,因为我不知道什么可能有用或什么没有,我对制作 MCVE 没有信心......

Manifest.json

{
"manifest_version": 2,
"name": "Hello World",
"version": "2.1",
"minimum_chrome_version": "23",
"icons": {
"16": "assets/images/16x16.png"
},
"app": {
"background": {
"scripts": ["main.js"]
}
},
"permissions": ["serial"]
}

包.json:

{
"main": "main.html",
"name": "PAGUSS",
"description": "Paguss Payment Services",
"version": "0.1.0",
"keywords": [ "paguss", "payment" ],
"window": {
"title": "Paguss",
"transparent": true,
"icon": "assets/images/64x64.png",
"toolbar": false,
"frame": true,
"resizable": true,
"position": "mouse",
"min_width": 400,
"min_height": 500,
"max_width": 1200,
"max_height": 800,
"no-edit-menu": false
},
"webkit": {
"plugin": false
}
}

调用login.js时执行的第一个函数:

function recoverBusinessConf(){

var obj = {
"id": "1",
"saleExecutorFlow" : "[{\"callback\": \"validateTransactionData\"},{\"callback\": \"getTid\"},{\"callback\": \"fillTransactionData\"},{\"callback\": \"parseJsonToXML\"},{\"callback\": \"sendRequest\"},{\"callback\": \"processResponse\"},{\"callback\": \"endTransaction\"},{\"callback\": \"printVoucher\"},{\"callback\": \"updateLastRecordNumber\"},{\"callback\": \"sendTransactionToPagussServer\"}]",
"name": "SOFIA IS",
"rfc": "SIS141707UPT",
"address": {
"street": "CASTILLA 136",
"cologne": "ALAMOS",
"city": "BENITO JUÁREZ",
"country": "MÉXICO",
"postalCode": "03020",
"latitude": "",
"longitude": "",
"zone": "DISTRITO FEDERAL"
},
"additionalData": {
"reference": false,
"waiter": false,
"turn": false,
"room": false
},
"product": {
"id": "1",
"type": "RETAIL",
"operatives": {
"sale": {
"menu-link": "",
"title": "Venta",
"voucher": "",
"elavonMessage": "{\"Request\": {\"_id\":\"Credit Card.Sale\",\"Version\":\"4018\",\"Block\":[{\"_id\":\"HD\",\"Network_Status_Byte\":\"*\",\"Transaction_Code\":\"000\",\"Application_ID\":\"${vendorId}\",\"Terminal_ID\":\"${affiliationAndTid}\",\"Device_Tag\":\"${serialNumber}\"},{\"_id\":\"01\",\"POS_Entry_Capability\":\"04\",\"Account_Entry_Mode\":\"${accountEntryMode}\",\"Partial_Auth_Indicator\":\"0\",\"Account_Data\":\"${track02}\",\"Transaction_Amount\":\"${elavonFormattedAmount}\",\"Last_Record_Number\":\"${lastRecordNumber}\"},{\"_id\":\"03\",\"Merchant_Reference_Nbr\":\"${merchantReferenceNumber}\"},{\"_id\":\"16\",\"ICC_Cryptogram\":\"${_9F26}\",\"ICC_CID\":\"${_9F27}\",\"ICC_AED\":\"000000\",\"ICC_Unpredictable_Number\":\"${_9F37}\",\"ICC_ATC\":\"${_9F36}\",\"ICC_TVR\":\"${_95}\",\"ICC_TT\":\"${_9C}\",\"ICC_AIP\":\"${_82}\",\"ICC_TCP\":\"${_9F33}\",\"ICC_CVMR\":\"${_9F34}\",\"ICC_TTD\":\"${_9A}\",\"ICC_Transaction_Currency\":\"${_5F2A}\",\"ICC_Authorized_Amount\":\"${_9F02}\",\"ICC_Other_Amount\":\"${_9F03}\",\"ICC_Terminal_Type\":\"${_9F35}\",\"ICC_CSN\":\"${_5F34}\",\"ICC_IAD\":\"${_9F10}\"}]}}",
"voucher": ["A@logo1 Santader @br @cnn VENTA @br @cnn (_affiliation_number_) _business_name_ @cnn _address_street_ @cnn _address_cologne_, _address_city_ @cnn _address_zone_ @br @lnn No.Tarjeta: _ccnumber_ @br @lnn _ccvendor_ @br @lnn APROBADA @lnn IMPORTE @cnn $ _amount_ _currency_ @br @lnn Oper.: _id_ @lnn Ref.: _reference_ @lnn ARQC: _arqc_ @lnn AID: _aid_ @lnn Aut.: _auth_ @br @lnn Fecha: _date_ _time_ @br @cnn ME OBLIGO EN LOS TERMINOS DADOS AL REVERSO DE ESTE DOCUMENTO @br @br @br @br @cnn ______________________________ @cnn _ccname_ @bc _id_ @br @br @br @br @br @br @br",
"A@logo1 Santader @br @cnn VENTA @br @cnn (_affiliation_number_) _business_name_ @cnn _address_street_ @cnn _address_cologne_, _address_city_ @cnn _address_zone_ @br @lnn No.Tarjeta: _ccnumber_ @br @lnn _ccvendor_ @br @cnn C-L-I-E-N-T-E @br @lnn APROBADA @lnn IMPORTE @cnn $ _amount_ _currency_ @br @lnn Oper.: _id_ @lnn Ref.: _reference_ @lnn ARQC: _arqc_ @lnn AID: _aid_ @lnn Aut.: _auth_ @br @lnn Fecha: _date_ _time_ @br @cnn ME OBLIGO EN LOS TERMINOS DADOS AL REVERSO DE ESTE DOCUMENTO @br @br @br @br @cnn ______________________________ @cnn _ccname_ @bc _id_ @br @br @br @br @br @br @br"]
}
}
},
"installer": {
},
"keyAccountManager": {
},
"affiliation": [{
"affiliation": "7749517",
"lastRecordNumber": 0,
"device": {
"serie": "",
"model": "",
"version": "",
"tids": ["001"]
},
"paymentModes": [{
"type": "C",
"text": "Contado",
"max": 1000.0,
"min": 10.0,
"active": true,
"iniDate": "01/11/2015 9:00",
"endDate": "01/12/2015 9:00"
}],
"currency": "MXN"
}],
"users": [{
"id": "1",
"name": "Ricardo",
"active": true,
"lastName": "Vargas",
"mothersName": "Flores",
"mail": "fjbleal@gmail.com",
"masterPin": "3579"
}]
};

chrome.storage.local.set({'business': obj},function(items){
window.location.href = '/view/index.html'
});
}

最佳答案

今天在 Google 群组发布了 NWJS 的 alpha 6 版本,您可以查看 here 。这个错误实际上已通过此更新解决:

Changes (features ported from nw12)

  • nwjc: compile JS to machine code for source code protection
  • nw.Tray fix
  • 'single-instance' support ('true' only)
  • 'user-agent' in manifest
  • 'dom_storage_quota' and 'additional_trust_anchors' in manifest
  • Fix 'child_process.fork'
  • Fix: unable to launch in some Linux distributions
  • nw.App methods: argv, clearCache, setProxyConfig, addOriginAccessWhitelistEntry, removeOriginAccessWhitelistEntry, part of 'open' event
  • support migrating localstorage data file on app start
  • nw-gyp updated to 0.13.0: Fix native module build support

所以,这是我正在使用的 alpha 版本的一个错误,今天已解决。

关于javascript - NWJS 应用程序在 Windows 上关闭后 Chrome 本地存储会被删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33880506/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com