Adding translation by using i18n
This commit is contained in:
		
							
								
								
									
										210
									
								
								app/frontend/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										210
									
								
								app/frontend/package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1806,6 +1806,16 @@
 | 
			
		||||
          "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
 | 
			
		||||
          "dev": true
 | 
			
		||||
        },
 | 
			
		||||
        "ansi-styles": {
 | 
			
		||||
          "version": "4.3.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
 | 
			
		||||
          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "color-convert": "^2.0.1"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "cacache": {
 | 
			
		||||
          "version": "13.0.1",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz",
 | 
			
		||||
@@ -1832,6 +1842,34 @@
 | 
			
		||||
            "unique-filename": "^1.1.1"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "chalk": {
 | 
			
		||||
          "version": "4.1.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
 | 
			
		||||
          "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "ansi-styles": "^4.1.0",
 | 
			
		||||
            "supports-color": "^7.1.0"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "color-convert": {
 | 
			
		||||
          "version": "2.0.1",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
 | 
			
		||||
          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "color-name": "~1.1.4"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "color-name": {
 | 
			
		||||
          "version": "1.1.4",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
 | 
			
		||||
          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true
 | 
			
		||||
        },
 | 
			
		||||
        "find-cache-dir": {
 | 
			
		||||
          "version": "3.3.1",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz",
 | 
			
		||||
@@ -1853,6 +1891,25 @@
 | 
			
		||||
            "path-exists": "^4.0.0"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "has-flag": {
 | 
			
		||||
          "version": "4.0.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
 | 
			
		||||
          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true
 | 
			
		||||
        },
 | 
			
		||||
        "loader-utils": {
 | 
			
		||||
          "version": "2.0.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
 | 
			
		||||
          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "big.js": "^5.2.2",
 | 
			
		||||
            "emojis-list": "^3.0.0",
 | 
			
		||||
            "json5": "^2.1.2"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "locate-path": {
 | 
			
		||||
          "version": "5.0.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
 | 
			
		||||
@@ -1917,6 +1974,16 @@
 | 
			
		||||
            "minipass": "^3.1.1"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "supports-color": {
 | 
			
		||||
          "version": "7.2.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
 | 
			
		||||
          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "has-flag": "^4.0.0"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "terser-webpack-plugin": {
 | 
			
		||||
          "version": "2.3.8",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz",
 | 
			
		||||
@@ -1933,6 +2000,18 @@
 | 
			
		||||
            "terser": "^4.6.12",
 | 
			
		||||
            "webpack-sources": "^1.4.3"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "vue-loader-v16": {
 | 
			
		||||
          "version": "npm:vue-loader@16.1.2",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz",
 | 
			
		||||
          "integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "chalk": "^4.1.0",
 | 
			
		||||
            "hash-sum": "^2.0.0",
 | 
			
		||||
            "loader-utils": "^2.0.0"
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -4559,6 +4638,24 @@
 | 
			
		||||
        "domelementtype": "1"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "dot-object": {
 | 
			
		||||
      "version": "2.1.4",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/dot-object/-/dot-object-2.1.4.tgz",
 | 
			
		||||
      "integrity": "sha512-7FXnyyCLFawNYJ+NhkqyP9Wd2yzuo+7n9pGiYpkmXCTYa8Ci2U0eUNDVg5OuO5Pm6aFXI2SWN8/N/w7SJWu1WA==",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "commander": "^4.0.0",
 | 
			
		||||
        "glob": "^7.1.5"
 | 
			
		||||
      },
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "commander": {
 | 
			
		||||
          "version": "4.1.1",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
 | 
			
		||||
          "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
 | 
			
		||||
          "dev": true
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "dot-prop": {
 | 
			
		||||
      "version": "5.3.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
 | 
			
		||||
@@ -6798,6 +6895,12 @@
 | 
			
		||||
      "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "is-valid-glob": {
 | 
			
		||||
      "version": "1.0.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz",
 | 
			
		||||
      "integrity": "sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao=",
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "is-windows": {
 | 
			
		||||
      "version": "1.0.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
 | 
			
		||||
@@ -11236,6 +11339,32 @@
 | 
			
		||||
      "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==",
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "vue-i18n": {
 | 
			
		||||
      "version": "8.22.4",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.22.4.tgz",
 | 
			
		||||
      "integrity": "sha512-XLI5s0AdqMP2Lf4I4CmdmOq8kjb5DDFGR77wAuxCfpEuYSfhTRyyx6MetgZMiL6Lxa0DasjBOiOcciU3NkL3/Q=="
 | 
			
		||||
    },
 | 
			
		||||
    "vue-i18n-extract": {
 | 
			
		||||
      "version": "1.1.10",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/vue-i18n-extract/-/vue-i18n-extract-1.1.10.tgz",
 | 
			
		||||
      "integrity": "sha512-DYqcjrAm4L95Ftz8AVIzUyrHCBQV326rbOru6B3W2vXHIzUUuJwwFgyVPE+d7YTeHD189eoOkRu0aL6EzeMWZQ==",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "commander": "^6.1.0",
 | 
			
		||||
        "dot-object": "^2.1.4",
 | 
			
		||||
        "glob": "^7.1.6",
 | 
			
		||||
        "is-valid-glob": "^1.0.0",
 | 
			
		||||
        "js-yaml": "^3.14.0"
 | 
			
		||||
      },
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "commander": {
 | 
			
		||||
          "version": "6.2.1",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
 | 
			
		||||
          "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
 | 
			
		||||
          "dev": true
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "vue-loader": {
 | 
			
		||||
      "version": "15.9.3",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.3.tgz",
 | 
			
		||||
@@ -11257,87 +11386,6 @@
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "vue-loader-v16": {
 | 
			
		||||
      "version": "npm:vue-loader@16.1.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz",
 | 
			
		||||
      "integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "optional": true,
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "chalk": "^4.1.0",
 | 
			
		||||
        "hash-sum": "^2.0.0",
 | 
			
		||||
        "loader-utils": "^2.0.0"
 | 
			
		||||
      },
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "ansi-styles": {
 | 
			
		||||
          "version": "4.3.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
 | 
			
		||||
          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "color-convert": "^2.0.1"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "chalk": {
 | 
			
		||||
          "version": "4.1.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
 | 
			
		||||
          "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "ansi-styles": "^4.1.0",
 | 
			
		||||
            "supports-color": "^7.1.0"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "color-convert": {
 | 
			
		||||
          "version": "2.0.1",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
 | 
			
		||||
          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "color-name": "~1.1.4"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "color-name": {
 | 
			
		||||
          "version": "1.1.4",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
 | 
			
		||||
          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true
 | 
			
		||||
        },
 | 
			
		||||
        "has-flag": {
 | 
			
		||||
          "version": "4.0.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
 | 
			
		||||
          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true
 | 
			
		||||
        },
 | 
			
		||||
        "loader-utils": {
 | 
			
		||||
          "version": "2.0.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
 | 
			
		||||
          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "big.js": "^5.2.2",
 | 
			
		||||
            "emojis-list": "^3.0.0",
 | 
			
		||||
            "json5": "^2.1.2"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "supports-color": {
 | 
			
		||||
          "version": "7.2.0",
 | 
			
		||||
          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
 | 
			
		||||
          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
 | 
			
		||||
          "dev": true,
 | 
			
		||||
          "optional": true,
 | 
			
		||||
          "requires": {
 | 
			
		||||
            "has-flag": "^4.0.0"
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "vue-router": {
 | 
			
		||||
      "version": "3.4.3",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.4.3.tgz",
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,8 @@
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "serve": "vue-cli-service serve --copy --port=4202",
 | 
			
		||||
    "build": "vue-cli-service build",
 | 
			
		||||
    "lint": "vue-cli-service lint"
 | 
			
		||||
    "lint": "vue-cli-service lint",
 | 
			
		||||
    "vue-i18n-extract": "vue-i18n-extract report -a -v './src/**/*.?(js|vue)' -l './src/locales/*.?(json|yaml|yml)'"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@fnando/sparkline": "^0.3.10",
 | 
			
		||||
@@ -15,6 +16,7 @@
 | 
			
		||||
    "sass-loader": "^10.0.4",
 | 
			
		||||
    "simple-keyboard": "^2.30.25",
 | 
			
		||||
    "vue": "^2.6.12",
 | 
			
		||||
    "vue-i18n": "^8.22.4",
 | 
			
		||||
    "vue-router": "^3.4.3"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
@@ -24,6 +26,7 @@
 | 
			
		||||
    "babel-eslint": "^10.1.0",
 | 
			
		||||
    "eslint": "^7.9.0",
 | 
			
		||||
    "eslint-plugin-vue": "^6.2.2",
 | 
			
		||||
    "vue-i18n-extract": "1.1.10",
 | 
			
		||||
    "vue-template-compiler": "^2.6.12"
 | 
			
		||||
  },
 | 
			
		||||
  "eslintConfig": {
 | 
			
		||||
 
 | 
			
		||||
@@ -29,24 +29,37 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
  import axios from 'axios'
 | 
			
		||||
  document.title = 'TinyCheck Frontend'
 | 
			
		||||
  import Controls from "@/components/Controls.vue"
 | 
			
		||||
  
 | 
			
		||||
  document.title = 'TinyCheck Frontend'
 | 
			
		||||
 | 
			
		||||
  export default {
 | 
			
		||||
    name: 'app',
 | 
			
		||||
    components: {
 | 
			
		||||
        Controls
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        get_lang: function() {
 | 
			
		||||
            axios.get(`/api/misc/get-lang`, { timeout: 60000 })
 | 
			
		||||
                .then(response => { window.translation = response.data; })
 | 
			
		||||
                .catch(error => { console.log(error) });
 | 
			
		||||
        set_lang: function() {
 | 
			
		||||
            if (window.config.user_lang) {
 | 
			
		||||
                var lang = window.config.user_lang
 | 
			
		||||
                if (Object.keys(this.$i18n.messages).includes(lang)) {
 | 
			
		||||
                    this.$i18n.locale = lang
 | 
			
		||||
                    document.querySelector('html').setAttribute('lang', lang)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        get_config: function() {
 | 
			
		||||
            axios.get('/api/misc/config', { timeout: 60000 })
 | 
			
		||||
            .then(response => { 
 | 
			
		||||
              this.set_lang();
 | 
			
		||||
              window.config = response.data 
 | 
			
		||||
            })
 | 
			
		||||
            .catch(error => { console.log(error) });
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    created: function() {
 | 
			
		||||
        window.translation = {}
 | 
			
		||||
        this.get_lang()
 | 
			
		||||
        window.config = {}
 | 
			
		||||
        this.get_config();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										81
									
								
								app/frontend/src/locales/en.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								app/frontend/src/locales/en.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
{
 | 
			
		||||
  "home": {
 | 
			
		||||
    "welcome_msg": "Welcome to TinyCheck.",
 | 
			
		||||
    "help_msg": "We are going to help you to check your device.",
 | 
			
		||||
    "start_btn": "Let's start!"
 | 
			
		||||
  },
 | 
			
		||||
  "analysis": {
 | 
			
		||||
    "question": "Do you want to analyze the captured communications?",
 | 
			
		||||
    "no_btn": "No, just save them",
 | 
			
		||||
    "yes_btn": "Yes, let's do it",
 | 
			
		||||
    "please_wait_msg": "Please wait during the analysis...",
 | 
			
		||||
    "some_time_msg": "Yes, it can take some time..."
 | 
			
		||||
  },
 | 
			
		||||
  "capture": {
 | 
			
		||||
    "intercept_coms_msg": "Intercepting the communications of ",
 | 
			
		||||
    "stop_btn": "Stop the capture"
 | 
			
		||||
  },
 | 
			
		||||
  "generate-ap": {
 | 
			
		||||
    "network_name": "Network name",
 | 
			
		||||
    "network_password": "Network password",
 | 
			
		||||
    "tap_msg": "Tap the white frame to generate a new network.",
 | 
			
		||||
    "generate_ap_msg": "We generate an ephemeral network for you.",
 | 
			
		||||
    "error_msg1": "Unfortunately, we got some issues <br />during the AP creation.",
 | 
			
		||||
    "error_msg2": "Please verify that you've two WiFi interfaces on your device<br /> and try again by restarting it.",
 | 
			
		||||
    "restart_btn": "Restart the device"
 | 
			
		||||
  },
 | 
			
		||||
  "report": {
 | 
			
		||||
    "show_full_report": "Show the full report",
 | 
			
		||||
    "start_new_capture": "Start a new capture",
 | 
			
		||||
    "save_capture": "Save the capture",
 | 
			
		||||
    "numbers": [
 | 
			
		||||
      "zero",
 | 
			
		||||
      "one",
 | 
			
		||||
      "two",
 | 
			
		||||
      "three",
 | 
			
		||||
      "four",
 | 
			
		||||
      "five",
 | 
			
		||||
      "six",
 | 
			
		||||
      "seven",
 | 
			
		||||
      "eight",
 | 
			
		||||
      "nine",
 | 
			
		||||
      "ten",
 | 
			
		||||
      "eleven"
 | 
			
		||||
    ],
 | 
			
		||||
    "stalkerware_msg": "Your device is compromised by<br />a Stalkerware, please check the report.",
 | 
			
		||||
    "location_msg": "An application is sharing your<br /> current geolocation with a third party.",
 | 
			
		||||
    "fine_msg": "Everything looks fine, zero alerts.",
 | 
			
		||||
    "high_msg": "You have {nb} high alert,<br />your device seems to be compromised.",
 | 
			
		||||
    "moderate_msg": "You have {nb} moderate alerts,<br />your device might be compromised.",
 | 
			
		||||
    "low_msg": "You have only {nb} low alerts,<br /> don't hesitate to check them.",
 | 
			
		||||
    "save_report": "Save the report",
 | 
			
		||||
    "report_of": "Report of",
 | 
			
		||||
    "ip_address": "IP address",
 | 
			
		||||
    "mac_address": "MAC address",
 | 
			
		||||
    "high": "high",
 | 
			
		||||
    "moderate": "moderate",
 | 
			
		||||
    "low": "low"
 | 
			
		||||
  },
 | 
			
		||||
  "wifi-select": {
 | 
			
		||||
    "already_connected_question": "You seem to be already connected to a network.<br />Do you want to use the current connection?",
 | 
			
		||||
    "no_btn": "No, use another",
 | 
			
		||||
    "yes_btn": "Yes, use it.",
 | 
			
		||||
    "wifi_name": "Wi-Fi name",
 | 
			
		||||
    "refresh_btn": "Refresh networks list",
 | 
			
		||||
    "not_connected": "You seem to not be connected to Internet.",
 | 
			
		||||
    "please_config": "Please configure the Wi-Fi connection.",
 | 
			
		||||
    "lets_do_btn": "Ok, let's do that.",
 | 
			
		||||
    "wifi_connected": "Wi-Fi connected",
 | 
			
		||||
    "wifi_not_connected": "Wi-Fi not connected. Please retry.",
 | 
			
		||||
    "tap_keyboard": "Tap on the virtual keyboard to start",
 | 
			
		||||
    "wifi_password": "Wi-Fi password",
 | 
			
		||||
    "connect_to_it": "Connect to it"
 | 
			
		||||
  },
 | 
			
		||||
  "save-capture": {
 | 
			
		||||
    "please_connect": "Please connect a USB key to save your capture.",
 | 
			
		||||
    "we_are_saving": "We are saving your capture.",
 | 
			
		||||
    "tap_msg": "You can tap the USB key to start a new capture.",
 | 
			
		||||
    "capture_download": "The capture download is going to start...",
 | 
			
		||||
    "start_capture_btn": "Start another capture"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										81
									
								
								app/frontend/src/locales/fr.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								app/frontend/src/locales/fr.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
{
 | 
			
		||||
  "home": {
 | 
			
		||||
    "welcome_msg": "Bienvenue sur TinyCheck.",
 | 
			
		||||
    "help_msg": "Nous allons vous accompagner pour analyser votre appareil.",
 | 
			
		||||
    "start_btn": "Allons-y !"
 | 
			
		||||
  },
 | 
			
		||||
  "analysis": {
 | 
			
		||||
    "question": "Voulez-vous analyser les communications capturées ?",
 | 
			
		||||
    "no_btn": "Non, enregistrez-les.",
 | 
			
		||||
    "yes_btn": "Oui, allons-y !",
 | 
			
		||||
    "please_wait_msg": "Merci d'attendre pendant l'analyse...",
 | 
			
		||||
    "some_time_msg": "Oui, cela peut prendre du temps..."
 | 
			
		||||
  },
 | 
			
		||||
  "capture": {
 | 
			
		||||
    "intercept_coms_msg": "Interception des communications de ",
 | 
			
		||||
    "stop_btn": "Arrêter la capture"
 | 
			
		||||
  },
 | 
			
		||||
  "generate-ap": {
 | 
			
		||||
    "network_name": "Nom du réseau Wi-Fi",
 | 
			
		||||
    "network_password": "Mot de passe",
 | 
			
		||||
    "tap_msg": "Appuyez sur le cadre blanc pour générer un nouveau réseau.",
 | 
			
		||||
    "generate_ap_msg": "Nous générons un réseau Wi-Fi éphémère.",
 | 
			
		||||
    "error_msg1": "Malheureusement, nous rencontrons des problèmes <br />lors de la création du point d'accès.",
 | 
			
		||||
    "error_msg2": "Veuillez vérifier que vous disposez de <br /> deux interfaces WiFi sur votre appareil.",
 | 
			
		||||
    "restart_btn": "Restart the device"
 | 
			
		||||
  },
 | 
			
		||||
  "report": {
 | 
			
		||||
    "show_full_report": "Lire le rapport complet",
 | 
			
		||||
    "start_new_capture": "Nouvelle capture",
 | 
			
		||||
    "save_capture": "Sauvegarder",
 | 
			
		||||
    "numbers": [
 | 
			
		||||
      "zéro",
 | 
			
		||||
      "une",
 | 
			
		||||
      "deux",
 | 
			
		||||
      "trois",
 | 
			
		||||
      "quatre",
 | 
			
		||||
      "cinq",
 | 
			
		||||
      "six",
 | 
			
		||||
      "sept",
 | 
			
		||||
      "huit",
 | 
			
		||||
      "neuf",
 | 
			
		||||
      "dix",
 | 
			
		||||
      "onze"
 | 
			
		||||
    ],
 | 
			
		||||
    "stalkerware_msg": "Votre smartphone est compromis<br /> par un Stalkerware, lisez le rapport.",
 | 
			
		||||
    "location_msg": "Une application dévoile votre<br /> géo-localisation actelle.",
 | 
			
		||||
    "fine_msg": "Tout semble OK, vous avez aucue alerte.",
 | 
			
		||||
    "high_msg": "Vous avez {nb} alerte.s élevée.s,<br />votre appareil semble être compromis.",
 | 
			
		||||
    "moderate_msg": "Vous avez {nb} alerte.s moyenne.s,<br />votre appareil est peut-être compromis.",
 | 
			
		||||
    "low_msg": "Vous avez uniquement {nb} alerte.s basse.s<br /> n'hésitez pas à les parcourir.",
 | 
			
		||||
    "save_report": "Sauvegarder le rapport",
 | 
			
		||||
    "report_of": "Rapport de",
 | 
			
		||||
    "ip_address": "Adresse IP :",
 | 
			
		||||
    "mac_address": "Adresse MAC :",
 | 
			
		||||
    "high": "elevee",
 | 
			
		||||
    "moderate": "moyenne",
 | 
			
		||||
    "low": "base"
 | 
			
		||||
  },
 | 
			
		||||
  "wifi-select": {
 | 
			
		||||
    "already_connected_question": "Vous semblez être connecté à un réseau.<br />Voulez-vous utiliser cette connexion ?",
 | 
			
		||||
    "no_btn": "Non, une autre",
 | 
			
		||||
    "yes_btn": "Oui, utilisez celle-là",
 | 
			
		||||
    "wifi_name": "Nom du réseau",
 | 
			
		||||
    "refresh_btn": "Rafraichir la liste des réseaux",
 | 
			
		||||
    "not_connected": "Vous semblez ne pas être connecté à Internet.",
 | 
			
		||||
    "please_config": "Configurez la connexion Wi-Fi.",
 | 
			
		||||
    "lets_do_btn": "Oui, allons-y.",
 | 
			
		||||
    "wifi_connected": "Wi-Fi connecté",
 | 
			
		||||
    "wifi_not_connected": "Wi-Fi non connecté. Ressayez.",
 | 
			
		||||
    "tap_keyboard": "Appuez sur cet espace pour écrire",
 | 
			
		||||
    "wifi_password": "Mot de passe",
 | 
			
		||||
    "connect_to_it": "Se connecter"
 | 
			
		||||
  },
 | 
			
		||||
  "save-capture": {
 | 
			
		||||
    "please_connect": "Connectez une clé USB pour enregistrer votre capture.",
 | 
			
		||||
    "we_are_saving": "Nous enregistrons votre capture.",
 | 
			
		||||
    "tap_msg": "Vous pouvez appuyer sur l'animation pour lancer une nouvelle capture.",
 | 
			
		||||
    "capture_download": "Le téléchargement de la capture va se lancer...",
 | 
			
		||||
    "start_capture_btn": "Lancer une nouvelle capture"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,13 @@
 | 
			
		||||
import Vue from 'vue'
 | 
			
		||||
import App from './App.vue'
 | 
			
		||||
import router from './router'
 | 
			
		||||
import { i18n } from '@/plugins/i18n'
 | 
			
		||||
 | 
			
		||||
Vue.config.productionTip = true
 | 
			
		||||
Vue.config.devtools = true
 | 
			
		||||
 | 
			
		||||
new Vue({
 | 
			
		||||
  router,
 | 
			
		||||
  i18n,
 | 
			
		||||
  render: h => h(App)
 | 
			
		||||
}).$mount('#app')
 | 
			
		||||
							
								
								
									
										13
									
								
								app/frontend/src/plugins/i18n.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								app/frontend/src/plugins/i18n.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
import Vue from 'vue'
 | 
			
		||||
import VueI18n from 'vue-i18n'
 | 
			
		||||
 | 
			
		||||
Vue.use(VueI18n)
 | 
			
		||||
 | 
			
		||||
export const i18n = new VueI18n({
 | 
			
		||||
  locale: 'en',
 | 
			
		||||
  fallbackLocale: 'en',
 | 
			
		||||
  messages: {
 | 
			
		||||
    'en': require('@/locales/en.json'),
 | 
			
		||||
    'fr': require('@/locales/fr.json')
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
@@ -1,15 +1,15 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <div class="center">
 | 
			
		||||
        <div v-if="question">
 | 
			
		||||
            <p>{{ translation.question }}</p>
 | 
			
		||||
            <p>{{ $t("analysis.question") }}</p>
 | 
			
		||||
            <div class="empty-action">
 | 
			
		||||
                <button class="btn" v-on:click="save_capture()">{{ translation.no_btn }}</button> <button class="btn btn-primary" v-on:click="start_analysis()">{{ translation.yes_btn }}</button>
 | 
			
		||||
                <button class="btn" v-on:click="save_capture()">{{ $t("analysis.no_btn") }}</button> <button class="btn btn-primary" v-on:click="start_analysis()">{{ $t("analysis.yes_btn") }}</button>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="running">
 | 
			
		||||
            <img src="@/assets/loading.svg"/>
 | 
			
		||||
            <p class="legend" v-if="!long_waiting">{{ translation.please_wait_msg }}</p>
 | 
			
		||||
            <p class="legend fade-in" v-if="long_waiting">{{ translation.some_time_msg }}</p>
 | 
			
		||||
            <p class="legend" v-if="!long_waiting">{{ $t("analysis.please_wait_msg") }}</p>
 | 
			
		||||
            <p class="legend fade-in" v-if="long_waiting">{{ $t("analysis.some_time_msg") }}</p>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</template>
 | 
			
		||||
@@ -39,7 +39,7 @@ export default {
 | 
			
		||||
            setTimeout(function () { this.long_waiting = true }.bind(this), 15000);
 | 
			
		||||
            axios.get(`/api/analysis/start/${this.capture_token}`, { timeout: 60000 })
 | 
			
		||||
                .then(response => {
 | 
			
		||||
                    if(response.data.message == "Analysis started")
 | 
			
		||||
                    if(response.data.message == 'Analysis started')
 | 
			
		||||
                        this.check_alerts = setInterval(() => { this.get_alerts(); }, 500);
 | 
			
		||||
                })
 | 
			
		||||
                .catch(error => {
 | 
			
		||||
@@ -49,13 +49,14 @@ export default {
 | 
			
		||||
        get_alerts: function() {
 | 
			
		||||
            axios.get(`/api/analysis/report/${this.capture_token}`, { timeout: 60000 })
 | 
			
		||||
                .then(response => {
 | 
			
		||||
                    if(response.data.message != "No report yet"){
 | 
			
		||||
                    if(response.data.message != 'No report yet'){
 | 
			
		||||
                        clearInterval(this.check_alerts);
 | 
			
		||||
                        this.long_waiting = false;
 | 
			
		||||
                        this.running = false;
 | 
			
		||||
                        router.replace({ name: 'report', params: { alerts : response.data.alerts, 
 | 
			
		||||
                                                                   device : response.data.device,  
 | 
			
		||||
                                                                   capture_token : this.capture_token } });
 | 
			
		||||
                        router.replace({ name: 'report', 
 | 
			
		||||
                                         params: { alerts : response.data.alerts, 
 | 
			
		||||
                                                   device : response.data.device,  
 | 
			
		||||
                                                   capture_token : this.capture_token } });
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
                .catch(error => {
 | 
			
		||||
@@ -64,11 +65,9 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
        save_capture: function() {
 | 
			
		||||
            var capture_token = this.capture_token
 | 
			
		||||
            router.replace({ name: 'save-capture', params: { capture_token: capture_token } });
 | 
			
		||||
            router.replace({ name: 'save-capture', 
 | 
			
		||||
                             params: { capture_token: capture_token } });
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    created: function() {
 | 
			
		||||
        this.translation  = window.translation[this.$route.name]
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,10 +3,10 @@
 | 
			
		||||
        <svg id="sparkline" stroke-width="3" :width="sparkwidth" :height="sparkheight" v-if="sparklines"></svg>
 | 
			
		||||
        <div class="center">
 | 
			
		||||
            <div class="footer">
 | 
			
		||||
                <h3 class="timer">{{ timer_hours }}:{{ timer_minutes }}:{{ timer_seconds }}</h3>
 | 
			
		||||
                <p>{{ translation.intercept_coms_msg }} {{ device_name }}.</p>
 | 
			
		||||
                <h3 class="timer">{{timer_hours}}:{{timer_minutes}}:{{timer_seconds}}</h3>
 | 
			
		||||
                <p>{{$t("capture.intercept_coms_msg")}} {{device_name}}.</p>
 | 
			
		||||
                <div class="empty-action">
 | 
			
		||||
                    <button class="btn" :class="[ loading ? 'loading' : 'btn-primary', ]" v-on:click="stop_capture()">{{ translation.stop_btn }}</button>
 | 
			
		||||
                    <button class="btn" :class="[ loading ? 'loading' : 'btn-primary', ]" v-on:click="stop_capture()">{{$t("capture.stop_btn")}}</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
@@ -43,16 +43,16 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
        stop_capture: function() {
 | 
			
		||||
            this.loading = true
 | 
			
		||||
            axios.get(`/api/network/ap/stop`, { timeout: 30000 })
 | 
			
		||||
            axios.get(`/api/capture/stop`, { timeout: 30000 })
 | 
			
		||||
            axios.get('/api/network/ap/stop', { timeout: 30000 })
 | 
			
		||||
            axios.get('/api/capture/stop', { timeout: 30000 })
 | 
			
		||||
                .then(response => (this.handle_finish(response.data)))
 | 
			
		||||
        },
 | 
			
		||||
        get_stats: function() {
 | 
			
		||||
            axios.get(`/api/capture/stats`, { timeout: 30000 })
 | 
			
		||||
            axios.get('/api/capture/stats', { timeout: 30000 })
 | 
			
		||||
                .then(response => (this.handle_stats(response.data)))
 | 
			
		||||
        },
 | 
			
		||||
        handle_stats: function(data) {
 | 
			
		||||
            if (data.packets.length) sparkline(document.querySelector("#sparkline"), data.packets);
 | 
			
		||||
            if (data.packets.length) sparkline(document.querySelector('#sparkline'), data.packets);
 | 
			
		||||
        },
 | 
			
		||||
        handle_finish: function(data) {
 | 
			
		||||
            clearInterval(this.chrono_interval);
 | 
			
		||||
@@ -66,32 +66,30 @@ export default {
 | 
			
		||||
        chrono: function() {
 | 
			
		||||
            var time = Date.now() - this.capture_start
 | 
			
		||||
            this.timer_hours = Math.floor(time / (60 * 60 * 1000));
 | 
			
		||||
            this.timer_hours = (this.timer_hours < 10) ? "0" + this.timer_hours : this.timer_hours
 | 
			
		||||
            this.timer_hours = (this.timer_hours < 10) ? '0' + this.timer_hours : this.timer_hours
 | 
			
		||||
            time = time % (60 * 60 * 1000);
 | 
			
		||||
            this.timer_minutes = Math.floor(time / (60 * 1000));
 | 
			
		||||
            this.timer_minutes = (this.timer_minutes < 10) ? "0" + this.timer_minutes : this.timer_minutes
 | 
			
		||||
            this.timer_minutes = (this.timer_minutes < 10) ? '0' + this.timer_minutes : this.timer_minutes
 | 
			
		||||
            time = time % (60 * 1000);
 | 
			
		||||
            this.timer_seconds = Math.floor(time / 1000);
 | 
			
		||||
            this.timer_seconds = (this.timer_seconds < 10) ? "0" + this.timer_seconds : this.timer_seconds
 | 
			
		||||
            this.timer_seconds = (this.timer_seconds < 10) ? '0' + this.timer_seconds : this.timer_seconds
 | 
			
		||||
        },
 | 
			
		||||
        setup_sparklines: function() {
 | 
			
		||||
            axios.get(`/api/misc/config`, { timeout: 60000 })
 | 
			
		||||
            axios.get('/api/misc/config', { timeout: 60000 })
 | 
			
		||||
                .then(response => {
 | 
			
		||||
                    if(response.data.sparklines){
 | 
			
		||||
                        this.sparklines = true
 | 
			
		||||
                        this.sparkwidth = window.screen.width + "px";
 | 
			
		||||
                        this.sparkheight = Math.trunc(window.screen.height / 5) + "px";
 | 
			
		||||
                        this.sparkwidth = window.screen.width + 'px';
 | 
			
		||||
                        this.sparkheight = Math.trunc(window.screen.height / 5) + 'px';
 | 
			
		||||
                        this.stats_interval = setInterval(() => { this.get_stats(); }, 500);
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
                .catch(error => {
 | 
			
		||||
                    console.log(error)
 | 
			
		||||
            });
 | 
			
		||||
                });
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
    created: function() {
 | 
			
		||||
        this.translation  = window.translation[this.$route.name]
 | 
			
		||||
 | 
			
		||||
        // Get the config for the sparklines.
 | 
			
		||||
        this.setup_sparklines()
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -9,29 +9,30 @@
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="divider-vert white-bg" data-content="OR"></div>
 | 
			
		||||
                        <div class="column col-5"><br />
 | 
			
		||||
                            <span class="light-grey">{{ translation.network_name }}</span><br />
 | 
			
		||||
                            <span class="light-grey">{{ $t("generate-ap.network_name") }} </span><br />
 | 
			
		||||
                            <h4>{{ ssid_name }}</h4>
 | 
			
		||||
                            <span class="light-grey">{{ translation.network_password }}</span><br />
 | 
			
		||||
                            <span class="light-grey">{{ $t("generate-ap.network_password") }} </span><br />
 | 
			
		||||
                            <h4>{{ ssid_password }}</h4>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <br /><br /><br /><br /> <br /><br /><br /><br /><br /><br />
 | 
			
		||||
                <!-- Requite a CSS MEME for that shit :) -->
 | 
			
		||||
                <span class="legend">{{ translation.tap_msg }}</span>
 | 
			
		||||
                <span class="legend">{{ $t("generate-ap.tap_msg") }}</span>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-else>
 | 
			
		||||
                <img src="@/assets/loading.svg"/>
 | 
			
		||||
                <p class="legend">{{ translation.generate_ap_msg }}</p>
 | 
			
		||||
                <p class="legend">{{ $t("generate-ap.generate_ap_msg") }}</p>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else>
 | 
			
		||||
            <p>
 | 
			
		||||
                <strong v-html="translation.error_msg1"></strong>
 | 
			
		||||
                <strong v-html="$t('generate-ap.error_msg1')"></strong>
 | 
			
		||||
                <br /><br />
 | 
			
		||||
                <span v-html="translation.error_msg2"></span><br /><br /> 
 | 
			
		||||
                <span v-html="$t('generate-ap.error_msg2')"></span>
 | 
			
		||||
                <br /><br /> 
 | 
			
		||||
            </p>
 | 
			
		||||
            <button v-if="reboot_option" class="btn" v-on:click="reboot()">{{ translation.restart_btn }}</button>
 | 
			
		||||
            <button v-if="window.config.reboot_option" class="btn" v-on:click="reboot()">{{ $t("generate-ap.restart_btn") }}</button>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    
 | 
			
		||||
@@ -62,7 +63,7 @@ export default {
 | 
			
		||||
        generate_ap: function() {
 | 
			
		||||
            clearInterval(this.interval);
 | 
			
		||||
            this.ssid_name = false
 | 
			
		||||
            axios.get(`/api/network/ap/start`, { timeout: 30000 })
 | 
			
		||||
            axios.get('/api/network/ap/start', { timeout: 30000 })
 | 
			
		||||
                .then(response => (this.show_ap(response.data)))
 | 
			
		||||
        },
 | 
			
		||||
        show_ap: function(data) {
 | 
			
		||||
@@ -81,11 +82,11 @@ export default {
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        start_capture: function() {
 | 
			
		||||
            axios.get(`/api/capture/start`, { timeout: 30000 })
 | 
			
		||||
            axios.get('/api/capture/start', { timeout: 30000 })
 | 
			
		||||
                .then(response => (this.get_capture_token(response.data)))
 | 
			
		||||
        },
 | 
			
		||||
        reboot: function() {
 | 
			
		||||
            axios.get(`/api/misc/reboot`, { timeout: 30000 })
 | 
			
		||||
            axios.get('/api/misc/reboot', { timeout: 30000 })
 | 
			
		||||
                .then(response => { console.log(response)})
 | 
			
		||||
        },
 | 
			
		||||
        get_capture_token: function(data) {
 | 
			
		||||
@@ -116,20 +117,9 @@ export default {
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        get_config: function() {
 | 
			
		||||
            axios.get(`/api/misc/config`, { timeout: 60000 })
 | 
			
		||||
                .then(response => {
 | 
			
		||||
                    this.reboot_option = response.data.reboot_option
 | 
			
		||||
                })
 | 
			
		||||
                .catch(error => {
 | 
			
		||||
                    console.log(error)
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    created: function() {
 | 
			
		||||
        this.translation  = window.translation[this.$route.name]
 | 
			
		||||
        this.get_config();
 | 
			
		||||
        this.generate_ap();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
<template>
 | 
			
		||||
    <div class="center">
 | 
			
		||||
        <h3 class="lobster">{{ translation.welcome_msg }}</h3>
 | 
			
		||||
        <p>{{ translation.help_msg }}</p>
 | 
			
		||||
        <button class="btn btn-primary" v-on:click="next()">{{ translation.start_btn }}</button>
 | 
			
		||||
        <h3 class="lobster">{{ $t("home.welcome_msg") }}</h3>
 | 
			
		||||
        <p>{{ $t("home.help_msg") }}</p>
 | 
			
		||||
        <button class="btn btn-primary" v-on:click="next()">{{ $t("home.start_btn") }}</button>
 | 
			
		||||
    </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
@@ -11,7 +11,7 @@ import router from '../router'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'home',
 | 
			
		||||
    props: { saved_ssid: String, iface_out: String, list_ssids: Array, internet: Boolean },
 | 
			
		||||
    props: { saved_ssid: String, list_ssids: Array, internet: Boolean },
 | 
			
		||||
     data() {
 | 
			
		||||
        return {
 | 
			
		||||
            translation: {},
 | 
			
		||||
@@ -22,18 +22,15 @@ export default {
 | 
			
		||||
            var saved_ssid = this.saved_ssid
 | 
			
		||||
            var list_ssids = this.list_ssids
 | 
			
		||||
            var internet = this.internet
 | 
			
		||||
            if (this.iface_out.charAt(0) == "e"){
 | 
			
		||||
            if (window.config.iface_out.charAt(0) == "e"){
 | 
			
		||||
                router.push({ name: 'generate-ap' });
 | 
			
		||||
            } else {
 | 
			
		||||
                router.push({ name: 'wifi-select', 
 | 
			
		||||
                              params: { saved_ssid: saved_ssid, 
 | 
			
		||||
                                        list_ssids: list_ssids, 
 | 
			
		||||
                                        internet:internet } });
 | 
			
		||||
                                        internet: internet } });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    created: function() {
 | 
			
		||||
        this.translation  = window.translation[this.$route.name]
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,69 +3,69 @@
 | 
			
		||||
        <div v-if="results">
 | 
			
		||||
            <div v-if="grep_keyword('STALKERWARE', 'high')" class="high-wrapper">
 | 
			
		||||
                <div class="center">
 | 
			
		||||
                    <h1 class="warning-title" v-html="translation.stalkerware_msg"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ translation.start_new_capture }}</button>
 | 
			
		||||
                    <button class="btn btn-report-high" @click="show_report=true;results=false;">{{ translation.show_full_report }}</button>
 | 
			
		||||
                    <h1 class="warning-title" v-html="$t('report.stalkerware_msg')"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ $t("report.start_new_capture") }}</button>
 | 
			
		||||
                    <button class="btn btn-report-high" @click="show_report=true;results=false;">{{ $t("report.show_full_report") }}</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-else-if="alerts.high.length >= 1" class="high-wrapper">
 | 
			
		||||
                <div class="center">
 | 
			
		||||
                    <h1 class="warning-title" v-html="translation.high_msg"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ translation.start_new_capture }}</button>
 | 
			
		||||
                    <button class="btn btn-report-high" @click="show_report=true;results=false;">{{ translation.show_full_report }}</button>
 | 
			
		||||
                    <h1 class="warning-title" v-html="$t('report.high_msg', { nb: $i18n.messages[$i18n.locale].report.numbers[alerts.high.length] })"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ $t("report.start_new_capture") }}</button>
 | 
			
		||||
                    <button class="btn btn-report-high" @click="show_report=true;results=false;">{{ $t("report.show_full_report") }}</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-else-if="grep_keyword('TRACKER', 'moderate')" class="med-wrapper">
 | 
			
		||||
                <div class="center">
 | 
			
		||||
                    <h1 class="warning-title" v-html="translation.location_msg"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ translation.start_new_capture }}</button>
 | 
			
		||||
                    <button class="btn btn-report-moderate" @click="show_report=true;results=false;">{{ translation.show_full_report }}</button>
 | 
			
		||||
                    <h1 class="warning-title" v-html="$t('report.location_msg')"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ $t("report.start_new_capture") }}</button>
 | 
			
		||||
                    <button class="btn btn-report-moderate" @click="show_report=true;results=false;">{{ $t("report.show_full_report") }}</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-else-if="alerts.moderate.length >= 1" class="med-wrapper">
 | 
			
		||||
                <div class="center">
 | 
			
		||||
                    <h1 class="warning-title" v-html="translation.moderate_msg"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ translation.start_new_capture }}</button>
 | 
			
		||||
                    <button class="btn btn-report-moderate" @click="show_report=true;results=false;">{{ translation.show_full_report }}</button>
 | 
			
		||||
                    <h1 class="warning-title" v-html="$t('report.moderate_msg', { nb: $i18n.messages[$i18n.locale].report.numbers[alerts.moderate.length] })"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ $t("report.start_new_capture") }}</button>
 | 
			
		||||
                    <button class="btn btn-report-moderate" @click="show_report=true;results=false;">{{ $t("report.show_full_report") }}</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-else-if="alerts.low.length >= 1" class="low-wrapper">
 | 
			
		||||
                <div class="center">
 | 
			
		||||
                    <h1 class="warning-title" v-html="translation.low_msg"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ translation.start_new_capture }}</button>
 | 
			
		||||
                    <button class="btn btn-report-low" @click="show_report=true;results=false;">{{ translation.show_full_report }}</button>
 | 
			
		||||
                    <h1 class="warning-title" v-html="$t('report.low_msg', { nb: $i18n.messages[$i18n.locale].report.numbers[alerts.moderate.low] })"></h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="new_capture()">{{ $t("report.start_new_capture") }}</button>
 | 
			
		||||
                    <button class="btn btn-report-low" @click="show_report=true;results=false;">{{ $t("report.show_full_report") }}</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-else  class="none-wrapper">
 | 
			
		||||
                <div class="center">
 | 
			
		||||
                    <h1 class="warning-title" v-html="translation.fine_msg">
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="save_capture()">{{ translation.save_capture }}</button>
 | 
			
		||||
                    <button class="btn btn-report-low" v-on:click="new_capture()">{{ translation.start_new_capture }}</button>
 | 
			
		||||
                    <h1 class="warning-title">{{ $t("report.fine_msg") }}</h1>
 | 
			
		||||
                    <button class="btn btn-report-low-light" v-on:click="save_capture()">{{ $t("report.save_capture") }}</button>
 | 
			
		||||
                    <button class="btn btn-report-low" v-on:click="new_capture()">{{ $t("report.start_new_capture") }}</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else-if="show_report" class="report-wrapper">
 | 
			
		||||
            <div class="device-ctx">
 | 
			
		||||
                <h3 style="margin: 0;">{{ translation.report_of }} {{ device.name }}</h3>
 | 
			
		||||
                {{ translation.ip_address }} {{device.ip_address}}<br />{{ translation.mac_address }} {{device.mac_address}}
 | 
			
		||||
                <h3 style="margin: 0;">{{ $t("report.report_of") }} {{device.name}}</h3>
 | 
			
		||||
                {{ $t("report.ip_address") }} {{device.ip_address}}<br />{{ $t("report.mac_address") }} {{device.mac_address}}
 | 
			
		||||
            </div>
 | 
			
		||||
            <ul class="alerts">
 | 
			
		||||
                <li class="alert" v-for="alert in alerts.high" :key="alert.message">
 | 
			
		||||
                    <span class="high-label">{{ translation.high }}</span><span class="alert-id">{{ alert.id }}</span> 
 | 
			
		||||
                    <span class="high-label">{{ $t("report.high") }}</span><span class="alert-id">{{ alert.id }}</span> 
 | 
			
		||||
                    <div class="alert-body">
 | 
			
		||||
                        <span class="title">{{ alert.title }}</span>
 | 
			
		||||
                        <p class="description">{{ alert.description }}</p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li class="alert" v-for="alert in alerts.moderate" :key="alert.message">
 | 
			
		||||
                    <span class="moderate-label">{{ translation.moderate }}</span><span class="alert-id">{{ alert.id }}</span> 
 | 
			
		||||
                    <span class="moderate-label">{{ $t("report.moderate") }}</span><span class="alert-id">{{ alert.id }}</span> 
 | 
			
		||||
                    <div class="alert-body">
 | 
			
		||||
                        <span class="title">{{ alert.title }}</span>
 | 
			
		||||
                        <p class="description">{{ alert.description }}</p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li class="alert" v-for="alert in alerts.low" :key="alert.message">
 | 
			
		||||
                    <span class="low-label">{{ translation.low }}</span><span class="alert-id">{{ alert.id }}</span> 
 | 
			
		||||
                    <span class="low-label">{{ $t("report.low") }}</span><span class="alert-id">{{ alert.id }}</span> 
 | 
			
		||||
                    <div class="alert-body">
 | 
			
		||||
                        <span class="title">{{ alert.title }}</span>
 | 
			
		||||
                        <p class="description">{{ alert.description }}</p>
 | 
			
		||||
@@ -74,11 +74,11 @@
 | 
			
		||||
            </ul>
 | 
			
		||||
            <div class="columns" id="controls-analysis">
 | 
			
		||||
                    <div class="column col-5">
 | 
			
		||||
                        <button class="btn width-100" @click="$router.push('generate-ap')">{{ translation.start_new_capture }}</button>
 | 
			
		||||
                        <button class="btn width-100" @click="$router.push('generate-ap')">{{ $t("report.start_new_capture") }}</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="divider-vert column col-2" data-content="OR"></div>
 | 
			
		||||
                    <div class="column col-5">
 | 
			
		||||
                        <button class="btn btn btn-primary width-100" v-on:click="save_capture()">{{ translation.save_report }}</button>
 | 
			
		||||
                        <button class="btn btn btn-primary width-100" v-on:click="save_capture()">{{ $t("report.save_report") }}</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
@@ -116,15 +116,6 @@ export default {
 | 
			
		||||
        new_capture: function() {
 | 
			
		||||
            router.push({ name: 'generate-ap' })
 | 
			
		||||
        },
 | 
			
		||||
        nb_translate: function(x) {
 | 
			
		||||
            var nbs = this.translation["numbers"]
 | 
			
		||||
            try {
 | 
			
		||||
                return nbs[x];
 | 
			
		||||
            } catch (error)
 | 
			
		||||
            {
 | 
			
		||||
                return x;
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        grep_keyword: function(kw, level){
 | 
			
		||||
            try {
 | 
			
		||||
                if(this.alerts[level].length){
 | 
			
		||||
@@ -143,12 +134,6 @@ export default {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    created: function() {
 | 
			
		||||
        this.translation = window.translation[this.$route.name]
 | 
			
		||||
        this.translation["high_msg"] = this.translation["high_msg"].replace("{nb}", this.nb_translate(this.alerts.high.length))
 | 
			
		||||
        this.translation["moderate_msg"] = this.translation["moderate_msg"].replace("{nb}", this.nb_translate(this.alerts.moderate.length))
 | 
			
		||||
        this.translation["low_msg"] = this.translation["low_msg"].replace("{nb}", this.nb_translate(this.alerts.low.length))
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -6,14 +6,14 @@
 | 
			
		||||
            <div class="icon-usb"></div>
 | 
			
		||||
            <div class="icon-usb-plug"></div> 
 | 
			
		||||
        </div>
 | 
			
		||||
        <p class="legend" v-if="!saved && !usb"><br />{{ translation.please_connect }}</p>
 | 
			
		||||
        <p class="legend" v-if="!saved && usb"><br />{{ translation.we_are_saving }}</p>
 | 
			
		||||
        <p class="legend" v-if="saved"><br />{{ translation.tap_msg }}</p>
 | 
			
		||||
        <p class="legend" v-if="!saved && !usb"><br />{{ $t("save-capture.please_connect") }}</p>
 | 
			
		||||
        <p class="legend" v-if="!saved && usb"><br />{{ $t("save-capture.we_are_saving") }}</p>
 | 
			
		||||
        <p class="legend" v-if="saved"><br />{{ $t("save-capture.tap_msg") }}</p>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="center" v-else-if="!save_usb && init">
 | 
			
		||||
        <div>
 | 
			
		||||
            <p class="legend">{{ translation.catpure_download }}<br /><br /><br /></p>
 | 
			
		||||
            <button class="btn btn-primary" v-on:click="new_capture()">{{ translation.start_capture_btn }}</button>
 | 
			
		||||
            <p class="legend">{{ $t("save-capture.capture_download") }}<br /><br /><br /></p>
 | 
			
		||||
            <button class="btn btn-primary" v-on:click="new_capture()">{{ $t("save-capture.start_capture_btn") }}</button>
 | 
			
		||||
            <iframe :src="download_url" class="frame-download"></iframe>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
@@ -175,28 +175,18 @@ export default {
 | 
			
		||||
        new_capture: function() {
 | 
			
		||||
            clearTimeout(this.timeout);
 | 
			
		||||
            router.push({ name: 'generate-ap' })
 | 
			
		||||
        },
 | 
			
		||||
        load_config: function() {
 | 
			
		||||
            axios.get(`/api/misc/config`, { timeout: 60000 })
 | 
			
		||||
                .then(response => {
 | 
			
		||||
                    if(response.data.download_links){
 | 
			
		||||
                        this.init = true
 | 
			
		||||
                        this.save_usb = false
 | 
			
		||||
                        this.download_url = `/api/save/save-capture/${this.capture_token}/url`
 | 
			
		||||
                    } else {
 | 
			
		||||
                        this.init = true
 | 
			
		||||
                        this.save_usb = true
 | 
			
		||||
                        this.interval = setInterval(() => { this.check_usb() }, 500);
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
                .catch(error => {
 | 
			
		||||
                    console.log(error)
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    created: function() {
 | 
			
		||||
        this.translation = window.translation[this.$route.name]
 | 
			
		||||
        this.load_config()
 | 
			
		||||
        if(window.config.download_links){
 | 
			
		||||
            this.init = true
 | 
			
		||||
            this.save_usb = false
 | 
			
		||||
            this.download_url = `/api/save/save-capture/${this.capture_token}/url`
 | 
			
		||||
        } else {
 | 
			
		||||
            this.init = true
 | 
			
		||||
            this.save_usb = true
 | 
			
		||||
            this.interval = setInterval(() => { this.check_usb() }, 500);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
@@ -15,58 +15,34 @@
 | 
			
		||||
        data() {
 | 
			
		||||
            return {
 | 
			
		||||
                list_ssids: [],
 | 
			
		||||
                internet: false,
 | 
			
		||||
                iface_out:""
 | 
			
		||||
                internet: false
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        methods: {
 | 
			
		||||
            // Check if the device is connected to internet.
 | 
			
		||||
            internet_check: function() {
 | 
			
		||||
                axios.get(`/api/network/status`, { timeout: 10000 })
 | 
			
		||||
                axios.get('/api/network/status', { timeout: 10000 })
 | 
			
		||||
                    .then(response => {
 | 
			
		||||
                        if (response.data.internet){
 | 
			
		||||
                            this.internet = true
 | 
			
		||||
                        } 
 | 
			
		||||
                        this.load_config()
 | 
			
		||||
                        if (response.data.internet) this.internet = true
 | 
			
		||||
                        if (window.config.iface_out.charAt(0) == 'e') {
 | 
			
		||||
                            setTimeout(function () { this.goto_home(); }.bind(this), 1000);
 | 
			
		||||
                        } else {
 | 
			
		||||
                            this.get_wifi_networks();
 | 
			
		||||
                        }
 | 
			
		||||
                    })
 | 
			
		||||
                    .catch(err => (console.log(err)))
 | 
			
		||||
            },
 | 
			
		||||
            // Get the WiFi networks around the box.
 | 
			
		||||
            get_wifi_networks: function() {
 | 
			
		||||
                axios.get(`/api/network/wifi/list`, { timeout: 10000 })
 | 
			
		||||
                axios.get('/api/network/wifi/list', { timeout: 10000 })
 | 
			
		||||
                    .then(response => { 
 | 
			
		||||
                        this.list_ssids = response.data.networks
 | 
			
		||||
                        this.goto_home();
 | 
			
		||||
                     })
 | 
			
		||||
                    .catch(err => (console.log(err)))
 | 
			
		||||
            },
 | 
			
		||||
            // Forward the view to home, with some props 
 | 
			
		||||
            // such as (SSIDs, internet & interface)
 | 
			
		||||
            goto_home: function() {
 | 
			
		||||
                var list_ssids = this.list_ssids
 | 
			
		||||
                var internet   = this.internet
 | 
			
		||||
                var iface_out  = this.iface_out
 | 
			
		||||
                router.replace({ name: 'home', params: { list_ssids: list_ssids, internet: internet, iface_out : iface_out } });
 | 
			
		||||
            },
 | 
			
		||||
            // Get the network_out from the config
 | 
			
		||||
            // to determine the next steps.
 | 
			
		||||
            load_config: function() {
 | 
			
		||||
                axios.get(`/api/misc/config`, { timeout: 60000 })
 | 
			
		||||
                    .then(response => {
 | 
			
		||||
                        if(response.data.iface_out){
 | 
			
		||||
                            this.iface_out = response.data.iface_out
 | 
			
		||||
                            // If ethernet, just goto the homepage.
 | 
			
		||||
                            // Else, get wifi networks and then go to home.
 | 
			
		||||
                            if(this.iface_out.charAt(0) == "e"){
 | 
			
		||||
                                setTimeout(function () { this.goto_home(); }.bind(this), 1000);
 | 
			
		||||
                            } else {
 | 
			
		||||
                                this.get_wifi_networks();
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    })
 | 
			
		||||
                    .catch(error => {
 | 
			
		||||
                        console.log(error)
 | 
			
		||||
                });
 | 
			
		||||
                router.replace({ name: 'home', params: { list_ssids: list_ssids, internet: internet } });
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        created: function() {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,41 +2,42 @@
 | 
			
		||||
    <div :class="[ keyboard == false ? 'center' : '' ]">
 | 
			
		||||
        <div v-if="keyboard == false">
 | 
			
		||||
            <div v-if="have_internet">
 | 
			
		||||
                <p v-html="translation.already_connected_question"></p>
 | 
			
		||||
                <p v-html="$t('wifi-select.already_connected_question')"></p>
 | 
			
		||||
                <div class="empty-action">
 | 
			
		||||
                    <button class="btn" @click="have_internet = false">{{ translation.no_btn }}</button> <button class="btn" :class="[ connecting ? 'loading' : '', success ? 'btn-success' : 'btn-primary', ]" @click="$router.push({ name: 'generate-ap' })">{{ translation.yes_btn }}</button>
 | 
			
		||||
                    <button class="btn" @click="have_internet = false">{{ $t("wifi-select.no_btn") }}</button>  
 | 
			
		||||
                    <button class="btn" :class="[ connecting ? 'loading' : '', success ? 'btn-success' : 'btn-primary', ]" @click="$router.push({ name: 'generate-ap' })">{{ $t("wifi-select.yes_btn") }}</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div v-else>
 | 
			
		||||
                <div v-if="enter_creds" class="wifi-login">
 | 
			
		||||
                    <div class="form-group">
 | 
			
		||||
                        <select class="form-select" id="ssid-select" v-model="ssid">
 | 
			
		||||
                            <option value="" selected>{{ translation.wifi_name }}</option>
 | 
			
		||||
                            <option value="" selected>{{ $t("wifi-select.wifi_name") }}</option>
 | 
			
		||||
                            <option v-for="ssid in ssids" v-bind:key="ssid.ssid">
 | 
			
		||||
                                {{ ssid.ssid }}
 | 
			
		||||
                            </option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="form-group">
 | 
			
		||||
                        <input class="form-input" type="password" id="password" v-model="password" :placeholder="translation.wifi_password" v-on:click="keyboard = (virtual_keyboard)? true : false">
 | 
			
		||||
                        <input class="form-input" type="password" id="password" v-model="password" :placeholder="$t('wifi-select.wifi_password')" v-on:click="keyboard = (window.config.virtual_keyboard)? true : false">
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="form-group">
 | 
			
		||||
                        <button class="btn width-100" :class="[ connecting ? 'loading' : '', success ? 'btn-success' : 'btn-primary', ]" v-on:click="wifi_setup()">{{ btnval }}</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="form-group">
 | 
			
		||||
                        <button class="btn width-100" :class="[ refreshing ? 'loading' : '' ]" v-on:click="refresh_wifi_list()">{{ translation.refresh_btn }}</button>
 | 
			
		||||
                        <button class="btn width-100" :class="[ refreshing ? 'loading' : '' ]" v-on:click="refresh_wifi_list()">{{ $t("wifi-select.refresh_btn") }}</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div v-else>
 | 
			
		||||
                    <p><strong>{{ translation.not_connected }}</strong><br />{{ translation.please_config }}</p>
 | 
			
		||||
                    <p><strong>{{ $t("wifi-select.not_connected") }}</strong><br />{{ $t("wifi-select.please_config") }}</p>
 | 
			
		||||
                    <div class="empty-action">
 | 
			
		||||
                        <button class="btn btn-primary" @click="enter_creds = true">{{ translation.lets_do_btn }}</button>
 | 
			
		||||
                        <button class="btn btn-primary" @click="enter_creds = true">{{ $t("wifi-select.lets_do_btn") }}</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div v-else>
 | 
			
		||||
            <input :value="input" class="keyboardinput" @input="onInputChange" :placeholder="translation.tap_keyboard">
 | 
			
		||||
            <input :value="input" class="keyboardinput" @input="onInputChange" :placeholder="$t('wifi-select.tap_keyboard')">
 | 
			
		||||
            <SimpleKeyboard @onChange="onChange" @onKeyPress="onKeyPress" :input="input" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
@@ -63,7 +64,7 @@ export default {
 | 
			
		||||
            connecting: false,
 | 
			
		||||
            error: false,
 | 
			
		||||
            success: false,
 | 
			
		||||
            btnval: "",
 | 
			
		||||
            btnval: this.$t("wifi-select.connect_to_it"),
 | 
			
		||||
            ssid: "",
 | 
			
		||||
            selected_ssid: false,
 | 
			
		||||
            password: "",
 | 
			
		||||
@@ -72,7 +73,6 @@ export default {
 | 
			
		||||
            ssids: [],
 | 
			
		||||
            have_internet: false,
 | 
			
		||||
            enter_creds: false,
 | 
			
		||||
            virtual_keyboard: false,
 | 
			
		||||
            refreshing: false,
 | 
			
		||||
            translation: {}
 | 
			
		||||
        }
 | 
			
		||||
@@ -84,15 +84,15 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        wifi_connect: function() {
 | 
			
		||||
            axios.get(`/api/network/wifi/connect`, { timeout: 60000 })
 | 
			
		||||
            axios.get('/api/network/wifi/connect', { timeout: 60000 })
 | 
			
		||||
                .then(response => {
 | 
			
		||||
                    if (response.data.status) {
 | 
			
		||||
                        this.success = true
 | 
			
		||||
                        this.connecting = false
 | 
			
		||||
                        this.btnval = this.translation.wifi_connected
 | 
			
		||||
                        this.btnval = this.$t('wifi-select.wifi_connected')
 | 
			
		||||
                        setTimeout(() => router.push('generate-ap'), 1000);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        this.btnval = this.translation["wifi_not_connected"]
 | 
			
		||||
                        this.btnval = this.$t('wifi-select.wifi_not_connected')
 | 
			
		||||
                        this.connecting = false
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
@@ -102,7 +102,7 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
        wifi_setup: function() {
 | 
			
		||||
            if (this.ssid.length && this.password.length >= 8 ){
 | 
			
		||||
                axios.post(`/api/network/wifi/setup`, { ssid: this.ssid, password: this.password }, { timeout: 60000 })
 | 
			
		||||
                axios.post('/api/network/wifi/setup', { ssid: this.ssid, password: this.password }, { timeout: 60000 })
 | 
			
		||||
                    .then(response => {
 | 
			
		||||
                        if(response.data.status) {
 | 
			
		||||
                            this.connecting = true
 | 
			
		||||
@@ -116,15 +116,6 @@ export default {
 | 
			
		||||
                    });
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        get_config: function() {
 | 
			
		||||
            axios.get(`/api/misc/config`, { timeout: 60000 })
 | 
			
		||||
                .then(response => {
 | 
			
		||||
                    this.virtual_keyboard = response.data.virtual_keyboard
 | 
			
		||||
                })
 | 
			
		||||
                .catch(error => {
 | 
			
		||||
                    console.log(error)
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
        onChange(input) {
 | 
			
		||||
            this.input = input
 | 
			
		||||
            this.password = this.input;
 | 
			
		||||
@@ -141,25 +132,22 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
        refresh_wifi_list: function(){
 | 
			
		||||
            this.refreshing = true
 | 
			
		||||
            axios.get(`/api/network/wifi/list`, { timeout: 10000 })
 | 
			
		||||
                 .then(response => { 
 | 
			
		||||
                     this.refreshing = false
 | 
			
		||||
                     this.append_ssids(response.data.networks)
 | 
			
		||||
                 }).catch(error => {
 | 
			
		||||
                     this.refreshing = false
 | 
			
		||||
                     console.log(error)
 | 
			
		||||
            axios.get('/api/network/wifi/list', { timeout: 10000 })
 | 
			
		||||
            .then(response => { 
 | 
			
		||||
                this.refreshing = false
 | 
			
		||||
                this.append_ssids(response.data.networks)
 | 
			
		||||
            }).catch(error => {
 | 
			
		||||
                this.refreshing = false
 | 
			
		||||
                console.log(error)
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    created: function() {
 | 
			
		||||
        this.translation = window.translation[this.$route.name]
 | 
			
		||||
        this.btnval = this.translation.connect_to_it
 | 
			
		||||
        this.get_config()
 | 
			
		||||
 | 
			
		||||
        this.have_internet = (this.internet) ? true : false
 | 
			
		||||
        this.keyboard = false
 | 
			
		||||
 | 
			
		||||
        if (typeof this.list_ssids == "object" && this.list_ssids.length != 0){
 | 
			
		||||
        if (typeof this.list_ssids == 'object' && this.list_ssids.length != 0){
 | 
			
		||||
            this.ssids = this.list_ssids
 | 
			
		||||
        } else {
 | 
			
		||||
            this.refresh_wifi_list()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user