Navigation

    Quasar Framework

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. tc
    T
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 8
    • Best 0
    • Groups 0

    tc

    @tc

    0
    Reputation
    2
    Profile views
    8
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    tc Follow

    Latest posts made by tc

    • RE: Cordova Plugin not working in Vuex files

      @dobbel Yes, I even added it to the window scope.
      Problem more likely the priority of loading the plugin.
      When the quasar start, it tend to loaded the vuex store before cordova plugin did, hence it will get undefined in state.js .

      posted in Help
      T
      tc
    • RE: Cordova Plugin not working in Vuex files

      @metalsadman
      I tried with boot file and also in App.vue to instantiate it. But still not working, the cordova plugin instance is not fired. I put this console.log('cordova plugin', cordova.plugins) into state.js, give me undefined.

      Seem like Vuex loaded before cordova plugin??

      posted in Help
      T
      tc
    • RE: Cordova Plugin not working in Vuex files

      @dobbel said in Cordova Plugin not working in Vuex files:

      quasar info

      Operating System - Linux(5.4.0-60-generic) - linux/x64
      NodeJs - 12.18.3
      
      Global packages
        NPM - 6.14.10
        yarn - 1.21.1
        @quasar/cli - 1.1.3
        @quasar/icongenie - Not installed
        cordova - 9.0.0
      
      Important local packages
        quasar - 1.14.7 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
        @quasar/app - 2.1.13 -- Quasar Framework local CLI
        @quasar/extras - 1.9.12 -- Quasar Framework fonts, icons and animations
        eslint-plugin-quasar - Not installed
        vue - 2.6.12 -- Reactive, component-oriented view layer for modern web interfaces.
        vue-router - 3.2.0 -- Official router for Vue.js 2
        vuex - 3.6.0 -- state management for Vue.js
        electron - Not installed
        electron-packager - Not installed
        electron-builder - Not installed
        @babel/core - 7.12.10 -- Babel compiler core.
        webpack - 4.44.2 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
        webpack-dev-server - 3.11.0 -- Serves a webpack app. Updates the browser on changes.
        workbox-webpack-plugin - Not installed
        register-service-worker - 1.7.1 -- Script for registering service worker, with hooks
        typescript - 3.9.5 -- TypeScript is a language for application scale JavaScript development
        @capacitor/core - 2.4.5 -- Capacitor: cross-platform mobile apps with the web
        @capacitor/cli - 2.4.5 -- Capacitor: Cross-platform apps with JavaScript and the web
        @capacitor/android - 2.4.5 -- Capacitor: cross-platform mobile apps with the web
        @capacitor/ios - Not installed
      
      Quasar App Extensions
        *None installed*
      
      Networking
        Host - mypc
        wan1 - 192.168.0.107
      
      posted in Help
      T
      tc
    • RE: Cordova Plugin not working in Vuex files

      @dobbel The complete error is :

      localstore.js?f8cc:1 Uncaught TypeError: Cannot read property 'SecureStorage' of undefined
          at eval (localstore.js?f8cc:1)
          at Module../src/native/localstore.js (app.js:1208)
          at __webpack_require__ (app.js:854)
          at fn (app.js:151)
          at eval (state.js?b496:1)
          at Module../src/store/user/state.js (app.js:1304)
          at __webpack_require__ (app.js:854)
          at fn (app.js:151)
          at eval (index.js?7e21:1)
          at Module../src/store/user/index.js
      

      So I put these console log in the top of localstore.js

      console.log('cordova', cordova)
      console.log('cordova plugin', cordova.plugins)
      console.log('window cordova', window.cordova)
      console.log('window cordova plugin', window.cordova.plugins)
      

      And the results:

      cordova {version: "8.1.0", platformVersion: "8.1.0", platformId: "android", define: ƒ, require: ƒ, …}
      localstore.js?f8cc:2 cordova plugin undefined
      localstore.js?f8cc:3 window cordova {version: "8.1.0", platformVersion: "8.1.0", platformId: "android", define: ƒ, require: ƒ, …}
      localstore.js?f8cc:4 window cordova plugin undefined
      

      Working console log:

      cordova {version: "8.1.0", platformVersion: "8.1.0", platformId: "android", define: ƒ, require: ƒ, …}
      localstore.js?f8cc:2 cordova plugin {SecureStorage: ƒ}
      localstore.js?f8cc:3 window cordova {version: "8.1.0", platformVersion: "8.1.0", platformId: "android", define: ƒ, require: ƒ, …}
      localstore.js?f8cc:4 window cordova plugin {SecureStorage: ƒ}
      

      Seem it is not firing the cordova plugin.
      Further checking on the browser console, I did see this:

      deviceready has not fired after 5 seconds.
      cordova.js:1226 Channel not fired: onPluginsReady
      cordova.js:1226 Channel not fired: onCordovaReady
      

      Don’t know what caused this.

      posted in Help
      T
      tc
    • RE: Cordova Plugin not working in Vuex files

      @dobbel
      Created the module in scr/native/localstore.js for cordova-plugin-secure-storage-echo related actions:

      var ss = new cordova.plugins.SecureStorage(
          function() {
            console.log("Success");
          },
          function(error) {
            console.log("Error " + error);
          },
          "mystore"
      );
      
      async function saveData(key, val){
          return new Promise(function(resolve, reject) {
              ss.set(
                      function(key) {
                          resolve(true)
                      },
                      function(error) {
                          reject('set error', error)
                      },
                      key,
                      val
              )
          })
      }
      async function getData(key){
          return new Promise(function(resolve, reject) {
              ss.get(
                  function(value) {              
                      resolve(value)
                  },
                  function(error) {
                      reject(error)
                  },
                  key
              )
          })
      }
      export { saveData,getData, removeData}
      

      So I gonna use it in my store/user module. In my store/user/state.js :

      import { getData } from '../../native/sstore-echo'
      let utoken = getData('usertoken').then(data =>{
              return data
          })
      export default function () {
        return {
           token : utoken
        }
      }
      

      Then I will get this error Uncaught TypeError: Cannot read property 'SecureStorage' of undefined

      However, when I use the Secure Storage in the components, it works without any error.

      Hope this clarify out.

      posted in Help
      T
      tc
    • Cordova Plugin not working in Vuex files

      I am using cordova-plugin-secure-storage-echo for my mobile app.
      I created a wrapper for the cordova plugin in ‘native/localstore.js’
      In localstore.js is just a bunch of the cordova storage functions, for eg:

      var ss = new cordova.plugins.SecureStorage(
          function() {
            console.log("Success");
          },
          function(error) {
            console.log("Error " + error);
          },
          "mystore"
      );
      
      async function saveData(key, val){
          return new Promise(function(resolve, reject) {
              ss.set(
                      function(key) {
                          resolve(true)
                      },
                      function(error) {
                          reject('set error', error)
                      },
                      key,
                      val
              )
          })
      }
      ......
      .....
      

      I can import this file and use it at component with no problem, but since this a storage plugin, I would like to use it with vuex.
      But when I import the file in vuex, it give me this error:
      Uncaught TypeError: Cannot read property 'SecureStorage' of undefined
      Seem the cordova plugin is not loaded before the Vuex did.
      How can I solve this?
      Thanks

      posted in Help
      T
      tc
    • RE: token storage for web and native mobile

      @dobbel thanks for the article.
      According to the article, seem there are lot things to do to prevent xss attack.
      Still not convincing enough.
      for eg from the article recommendation:

      Go through every line of code to ensure you do not have XSS vulnerabilities.
      

      Even I can do this, but still might have vulnerabilities in Quasar, or even Vue itself. and also might overlook the vulnerabilities as well.
      All this seem not piratical to do in real life.

      posted in Help
      T
      tc
    • token storage for web and native mobile

      I am building a desktop/mobile website along with an native app. There is one thing I can’t figure out how to do it properly. That is the auth token storage management.

      From the documentation/tutorial, most of them are using the Localstorge to store the token. But it is vunerable to xss attacks.

      Also, for native mobile app can we use the device storage instead?Like AsyncStorage in react native. If so, how do we do that in same codebase?

      Thanks.

      posted in Help
      T
      tc