diff --git a/Jenkinsfile b/Jenkinsfile index 26fab97c6a56611eb126f09e161c3acbd8f0e3e3..d0b34166387963378a893c2a42650fe9195cf73f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,232 +1,234 @@ -#!/usr/bin/env groovy - -@Library('nynja-common') _ - -pipeline { - environment { - SLACK_CHANNEL = "#nynja-app-web" - NAMESPACE = "nynja-app" - APP_NAME = "nynja-app-web" - IMAGE_NAME = "eu.gcr.io/nynja-ci-201610/${NAMESPACE}/${APP_NAME}" - IMAGE_BUILD_TAG = "$BRANCH_NAME-$BUILD_NUMBER" - HELM_CHART_NAME = "nynja-app-web" - DEV_BRANCH = "dev" - SLACK_CHANNEL_DESKTOP = "#nynja-app-desktop" - NAMESPACE_DESKTOP = "nynja-desktop" - APP_NAME_DESKTOP = "nynja-app-desktop" - IMAGE_NAME_DESKTOP = "eu.gcr.io/nynja-ci-201610/${NAMESPACE_DESKTOP}/${APP_NAME_DESKTOP}" - IMAGE_BUILD_TAG_DESKTOP = "$BRANCH_NAME-$BUILD_NUMBER" - HELM_CHART_NAME_DESKTOP = "nynja-app-desktop" - DESKTOP_BRANCH = "desktop-master" - } - agent { - kubernetes(builders.multi([ - "nodejs":"node:10.4.0", - "helm":"lachlanevenson/k8s-helm:v2.9.1" - ])) - } - options { - skipDefaultCheckout() - buildDiscarder(logRotator(numToKeepStr: '15')) - } - stages { - stage('Checkout') { - steps { - container('nodejs') { - script { - def vars = checkout scm - vars.each { k,v -> env.setProperty(k, v) } - } - slackSend channel: SLACK_CHANNEL, message: slackStartMsg() - slackSend channel: SLACK_CHANNEL, message: "", attachments: slackBuildInfo() - } - } - } - /* - stage('Build PR') { - when { - branch 'PR-*' - } - stages { - stage('Build') { - steps { - echo 'build & test' - dockerBuildAndPushToRegistry "${NAMESPACE}/${APP_NAME}", [IMAGE_BUILD_TAG] - } - } - stage('Deploy preview') { - steps { - echo 'build & test' - } - } - } - } - */ - stage('Build Dev') { - when { - branch env.DEV_BRANCH - } - stages { - stage('Build') { - steps { - container('nodejs') { - sh 'npm install' - sh 'npm run build:prod' - dockerBuildAndPushToRegistry "${NAMESPACE}/${APP_NAME}", [IMAGE_BUILD_TAG] - } - } - } - stage("Helm chart") { - steps { - container('helm') { - helmBuildAndPushToRegistry HELM_CHART_NAME - } - } - } - stage('Deploy preview') { - steps { - deployHelmTo "dev", NAMESPACE - } - } - } - post { - success { - container('nodejs') { slackSend channel: SLACK_CHANNEL, message: slackEndMsg(), color: 'good' } - } - failure { - container('nodejs') { slackSend channel: SLACK_CHANNEL, message: slackEndMsg(), color: 'danger' } - } - } - } - stage('Build Release') { - when { - branch 'master' - } - stages { - stage("Build") { - steps { - container('nodejs') { - sh 'npm install' - sh 'npm run build:prod' - dockerBuildAndPushToRegistry "${NAMESPACE}/${APP_NAME}", [IMAGE_BUILD_TAG] - } - } - } - stage("Helm chart") { - steps { - container('helm') { - helmBuildAndPushToRegistry HELM_CHART_NAME - } - } - } - stage("Approval: Deploy to staging ?") { - steps { - slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: build #$BUILD_NUMBER ready to deploy to `STAGING`, approval required: $BUILD_URL (24h)" - - timeout(time: 24, unit: 'HOURS') { input 'Deploy to staging ?' } - } - post { failure { echo 'Deploy aborted for build #...' }} - } - stage("Deploy to staging") { - steps { - slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: deploying build #$BUILD_NUMBER to `STAGING`" - deployHelmTo "staging", NAMESPACE - } - } - stage("Approval: Deploy to production ?") { - steps { - slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: build #$BUILD_NUMBER ready to deploy to `PRODUCTION`, approval required: $BUILD_URL (24h)" - - timeout(time: 7, unit: 'DAYS') { input 'Deploy to production ?' } - } - post { failure { echo 'Deploy aborted for build #...' }} - } - stage('Tagging release') { - steps { - container('nodejs') { - // Updating the "latest tag" - dockerTagLatestAndPushToRegistry "${NAMESPACE}/${APP_NAME}", IMAGE_BUILD_TAG - } - } - } - /* - stage('Deploy release to canary') { - steps { - slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: deploying build #$BUILD_NUMBER to `PRODUCTION` (canary)" - echo "deploy to canary" - } - } - */ - stage("Deploy to production") { - steps { - slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: deploying build #$BUILD_NUMBER to `PRODUCTION`" - - deployHelmTo "prod", NAMESPACE - } - } - } - } - stage('Build Desktop Release') { - when { - branch env.DESKTOP_BRANCH - } - stages { - stage("Build") { - steps { - container('nodejs') { - sh 'npm install' - sh 'npm run build:prod' - dockerBuildAndPushToRegistry "${NAMESPACE_DESKTOP}/${APP_NAME_DESKTOP}", [IMAGE_BUILD_TAG_DESKTOP] - } - } - } - stage("Helm chart") { - steps { - container('helm') { - helmBuildAndPushToRegistry HELM_CHART_NAME_DESKTOP - } - } - } - stage("Approval: Deploy to staging ?") { - steps { - slackSend channel: SLACK_CHANNEL_DESKTOP, message: "$APP_NAME_DESKTOP: build #$BUILD_NUMBER ready to deploy to `STAGING`, approval required: $BUILD_URL (24h)" - - timeout(time: 24, unit: 'HOURS') { input 'Deploy to staging ?' } - } - post { failure { echo 'Deploy aborted for build #...' }} - } - stage("Deploy to staging") { - steps { - slackSend channel: SLACK_CHANNEL_DESKTOP, message: "$APP_NAME_DESKTOP: deploying build #$BUILD_NUMBER to `STAGING`" - deployHelmTo "staging", NAMESPACE_DESKTOP - } - } - stage("Approval: Deploy to production ?") { - steps { - slackSend channel: SLACK_CHANNEL_DESKTOP, message: "$APP_NAME_DESKTOP: build #$BUILD_NUMBER ready to deploy to `PRODUCTION`, approval required: $BUILD_URL (24h)" - - timeout(time: 7, unit: 'DAYS') { input 'Deploy to production ?' } - } - post { failure { echo 'Deploy aborted for build #...' }} - } - /* - stage('Tagging release') { - steps { - container('nodejs') { - // Updating the "latest tag" - dockerTagLatestAndPushToRegistry "${NAMESPACE_DESKTOP}/${APP_NAME_DESKTOP}", IMAGE_BUILD_TAG_DESKTOP - } - } - } - */ - stage("Deploy to production") { - steps { - slackSend channel: SLACK_CHANNEL_DESKTOP, message: "$APP_NAME_DESKTOP: deploying build #$BUILD_NUMBER to `PRODUCTION`" - - deployHelmTo "prod", NAMESPACE_DESKTOP - } - } - } - } - } -} +#!/usr/bin/env groovy + +@Library('nynja-common') _ + +pipeline { + environment { + SLACK_CHANNEL = "#nynja-app-web" + NAMESPACE = "nynja-app" + APP_NAME = "nynja-app-web" + IMAGE_NAME = "eu.gcr.io/nynja-ci-201610/${NAMESPACE}/${APP_NAME}" + IMAGE_BUILD_TAG = "$BRANCH_NAME-$BUILD_NUMBER" + HELM_CHART_NAME = "nynja-app-web" + DEV_BRANCH = "dev" + SLACK_CHANNEL_DESKTOP = "#nynja-app-desktop" + NAMESPACE_DESKTOP = "nynja-desktop" + APP_NAME_DESKTOP = "nynja-app-desktop" + IMAGE_NAME_DESKTOP = "eu.gcr.io/nynja-ci-201610/${NAMESPACE_DESKTOP}/${APP_NAME_DESKTOP}" + IMAGE_BUILD_TAG_DESKTOP = "$BRANCH_NAME-$BUILD_NUMBER" + HELM_CHART_NAME_DESKTOP = "nynja-app-desktop" + DESKTOP_BRANCH = "desktop-master" + } + agent { + kubernetes(builders.multi([ + "nodejs":"node:10.4.0", + "helm":"lachlanevenson/k8s-helm:v2.9.1" + ])) + } + options { + skipDefaultCheckout() + buildDiscarder(logRotator(numToKeepStr: '15')) + } + stages { + stage('Checkout') { + steps { + container('nodejs') { + script { + def vars = checkout scm + vars.each { k,v -> env.setProperty(k, v) } + } + slackSend channel: SLACK_CHANNEL, message: slackStartMsg() + slackSend channel: SLACK_CHANNEL, message: "", attachments: slackBuildInfo() + } + } + } + /* + stage('Build PR') { + when { + branch 'PR-*' + } + stages { + stage('Build') { + steps { + echo 'build & test' + dockerBuildAndPushToRegistry "${NAMESPACE}/${APP_NAME}", [IMAGE_BUILD_TAG] + } + } + stage('Deploy preview') { + steps { + echo 'build & test' + } + } + } + } + */ + stage('Build Dev') { + when { + branch env.DEV_BRANCH + } + stages { + stage('Build') { + steps { + container('nodejs') { + sh 'npm install' + sh 'npm run build:prod' + dockerBuildAndPushToRegistry "${NAMESPACE}/${APP_NAME}", [IMAGE_BUILD_TAG] + } + } + } + stage("Helm chart") { + steps { + container('helm') { + helmBuildAndPushToRegistry HELM_CHART_NAME + } + } + } + stage('Deploy preview') { + steps { + deployHelmTo "dev", NAMESPACE + } + } + } + post { + success { + container('nodejs') { slackSend channel: SLACK_CHANNEL, message: slackEndMsg(), color: 'good' } + } + failure { + container('nodejs') { slackSend channel: SLACK_CHANNEL, message: slackEndMsg(), color: 'danger' } + } + } + } + stage('Build Release') { + when { + branch 'master' + } + stages { + stage("Build") { + steps { + container('nodejs') { + sh 'npm install' + sh 'npm run build:prod' + dockerBuildAndPushToRegistry "${NAMESPACE}/${APP_NAME}", [IMAGE_BUILD_TAG] + } + } + } + stage("Helm chart") { + steps { + container('helm') { + helmBuildAndPushToRegistry HELM_CHART_NAME + } + } + } + stage("Approval: Deploy to staging ?") { + steps { + slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: build #$BUILD_NUMBER ready to deploy to `STAGING`, approval required: $BUILD_URL (24h)" + + timeout(time: 24, unit: 'HOURS') { input 'Deploy to staging ?' } + } + post { failure { echo 'Deploy aborted for build #...' }} + } + stage("Deploy to staging") { + steps { + slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: deploying build #$BUILD_NUMBER to `STAGING`" + // Added release file filter based on metadata.namespace + deployHelmToNamespace "staging", NAMESPACE + } + } + stage("Approval: Deploy to production ?") { + steps { + slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: build #$BUILD_NUMBER ready to deploy to `PRODUCTION`, approval required: $BUILD_URL (24h)" + + timeout(time: 7, unit: 'DAYS') { input 'Deploy to production ?' } + } + post { failure { echo 'Deploy aborted for build #...' }} + } + stage('Tagging release') { + steps { + container('nodejs') { + // Updating the "latest tag" + dockerTagLatestAndPushToRegistry "${NAMESPACE}/${APP_NAME}", IMAGE_BUILD_TAG + } + } + } + /* + stage('Deploy release to canary') { + steps { + slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: deploying build #$BUILD_NUMBER to `PRODUCTION` (canary)" + echo "deploy to canary" + } + } + */ + stage("Deploy to production") { + steps { + slackSend channel: SLACK_CHANNEL, message: "$APP_NAME: deploying build #$BUILD_NUMBER to `PRODUCTION`" + // Added release file filter based on metadata.namespace + deployHelmToNamespace "prod", NAMESPACE + } + } + } + } + stage('Build Desktop Release') { + when { + branch env.DESKTOP_BRANCH + } + stages { + stage("Build") { + steps { + container('nodejs') { + sh 'npm install' + sh 'npm run build:prod' + dockerBuildAndPushToRegistry "${NAMESPACE_DESKTOP}/${APP_NAME_DESKTOP}", [IMAGE_BUILD_TAG_DESKTOP] + } + } + } + stage("Helm chart") { + steps { + container('helm') { + helmBuildAndPushToRegistry HELM_CHART_NAME_DESKTOP + } + } + } + stage("Approval: Deploy to staging ?") { + steps { + slackSend channel: SLACK_CHANNEL_DESKTOP, message: "$APP_NAME_DESKTOP: build #$BUILD_NUMBER ready to deploy to `STAGING`, approval required: $BUILD_URL (24h)" + + timeout(time: 24, unit: 'HOURS') { input 'Deploy to staging ?' } + } + post { failure { echo 'Deploy aborted for build #...' }} + } + stage("Deploy to staging") { + steps { + slackSend channel: SLACK_CHANNEL_DESKTOP, message: "$APP_NAME_DESKTOP: deploying build #$BUILD_NUMBER to `STAGING`" + // Added release file filter based on metadata.namespace + deployHelmToNamespace "staging", NAMESPACE_DESKTOP + } + } + stage("Approval: Deploy to production ?") { + steps { + slackSend channel: SLACK_CHANNEL_DESKTOP, message: "$APP_NAME_DESKTOP: build #$BUILD_NUMBER ready to deploy to `PRODUCTION`, approval required: $BUILD_URL (24h)" + + timeout(time: 7, unit: 'DAYS') { input 'Deploy to production ?' } + } + post { failure { echo 'Deploy aborted for build #...' }} + } + /* + stage('Tagging release') { + steps { + container('nodejs') { + // Updating the "latest tag" + dockerTagLatestAndPushToRegistry "${NAMESPACE_DESKTOP}/${APP_NAME_DESKTOP}", IMAGE_BUILD_TAG_DESKTOP + } + } + } + */ + stage("Deploy to production") { + steps { + slackSend channel: SLACK_CHANNEL_DESKTOP, message: "$APP_NAME_DESKTOP: deploying build #$BUILD_NUMBER to `PRODUCTION`" + // Added release file filter based on metadata.namespace + deployHelmToNamespace "prod", NAMESPACE_DESKTOP + } + } + } + } + } +} diff --git a/charts/nynja-app-desktop/Chart.yaml b/charts/nynja-app-desktop/Chart.yaml index 4297728b928f61958340f0b458110483938ca4dd..343792e45fc13db6bc77039103d844f198be64dc 100644 --- a/charts/nynja-app-desktop/Chart.yaml +++ b/charts/nynja-app-desktop/Chart.yaml @@ -1,5 +1,5 @@ -apiVersion: v1 -appVersion: "1.0" -description: Deployment of the nynja desktop application -name: nynja-app-desktop -version: 0.2.5 +apiVersion: v1 +appVersion: "1.0" +description: Deployment of the nynja desktop application +name: nynja-app-desktop +version: 0.2.6 diff --git a/charts/nynja-app-desktop/templates/nginx-configmap.yaml b/charts/nynja-app-desktop/templates/nginx-configmap.yaml index ef3fca8c5c4c642418eb8e127695e7ea361c8718..00243952fb6f25b6772084688c04c15ec81d9a44 100644 --- a/charts/nynja-app-desktop/templates/nginx-configmap.yaml +++ b/charts/nynja-app-desktop/templates/nginx-configmap.yaml @@ -1,125 +1,125 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: {{ template "nynja-app-desktop.fullname" . }}-nginx-conf - labels: - app: {{ template "nynja-app-desktop.name" . }} - chart: {{ template "nynja-app-desktop.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -data: - default.conf: |- - server { - listen 80; - server_name _; - - #sendfile on; - sendfile off; - sendfile_max_chunk 1m; - - tcp_nopush on; - tcp_nodelay off; - - charset utf-8; - access_log off; - #access_log /var/log/nginx/host.access.log main; - - # GZIP settings - gzip on; - gzip_disable "msie6"; - gzip_vary on; - gzip_proxied any; - gzip_comp_level 5; - gzip_buffers 16 4k; - gzip_min_length 256; - gzip_types - application/javascript - application/x-javascript - application/json - application/xml - application/xml+rss - text/plain - text/css - text/javascript - text/xml - image/jpeg - image/png - image/gif; - - location / { - root /usr/share/nginx/html; - index index.html; - try_files $uri /index.html; - - set $auth_type "Restricted"; - # Handle join links (ex. join.nynja.net/123) - set $join_link 0; - - if ( $host ~ ^join\.(?.+)$ ) { - set $join_link 1; - set $auth_type "off"; - } - if ($request_uri ~ ^/.well-known/.*$ ) { - set $join_link 0; - set $auth_type "off"; - } - if ($join_link = 1) { - return 302 https://web.$domain/join$request_uri; - } - - # {{ if .Values.auth.basic.enabled }} - auth_basic $auth_type; - auth_basic_user_file /usr/share/nginx/html/.htpasswd; - # {{ end }} - } - - location /status { - auth_basic off; - return 200; - } - - location /appversion { - auth_basic off; - default_type application/json; - return 200 '{"status":"success","version":"0.4.0","build":"1589451878"}'; - } - - # Webpack debug proxy (temporary) - #location /debug { - # proxy_set_header X-Forwarded-For $remote_addr; - # proxy_set_header Host $http_host; - # proxy_pass "http://127.0.0.1:8080"; - #} - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - #error_page 500 502 503 504 /50x.html; - #location = /50x.html { - # root /usr/share/nginx/html; - #} - - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - location ~ /\.ht { - deny all; - } - } +kind: ConfigMap +apiVersion: v1 +metadata: + name: {{ template "nynja-app-desktop.fullname" . }}-nginx-conf + labels: + app: {{ template "nynja-app-desktop.name" . }} + chart: {{ template "nynja-app-desktop.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + default.conf: |- + server { + listen 80; + server_name _; + + #sendfile on; + sendfile off; + sendfile_max_chunk 1m; + + tcp_nopush on; + tcp_nodelay off; + + charset utf-8; + access_log off; + #access_log /var/log/nginx/host.access.log main; + + # GZIP settings + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 5; + gzip_buffers 16 4k; + gzip_min_length 256; + gzip_types + application/javascript + application/x-javascript + application/json + application/xml + application/xml+rss + text/plain + text/css + text/javascript + text/xml + image/jpeg + image/png + image/gif; + + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri /index.html; + + set $auth_type "Restricted"; + # Handle join links (ex. join.nynja.net/123) + set $join_link 0; + + if ( $host ~ ^join\.(?.+)$ ) { + set $join_link 1; + set $auth_type "off"; + } + if ($request_uri ~ ^/.well-known/.*$ ) { + set $join_link 0; + set $auth_type "off"; + } + if ($join_link = 1) { + return 302 https://desktop.$domain/join$request_uri; + } + + # {{ if .Values.auth.basic.enabled }} + auth_basic $auth_type; + auth_basic_user_file /usr/share/nginx/html/.htpasswd; + # {{ end }} + } + + location /status { + auth_basic off; + return 200; + } + + location /appversion { + auth_basic off; + default_type application/json; + return 200 '{"status":"success","version":"0.4.0","build":"1589451878","notes":["Electron Framework updated to latest version 8.0.1","Fixed select all keyboard shortcut (command + A) issue in Mac OS","Handled mic and camera permission issue on Mac OS","Handled black thumbnails in screen share popup on Windows OS","Updated spellcheck feature with stable library","Fixed cancel button issue in Print dialog of Pdf Viewer","Fullscreen and close button issue fixed in Pdf viewer","Added single process for upgrading web and native app upgrade","Seperated Codebase for native application","Fixed screen share and invite link issue for full screenshare dialog"]}'; + } + + # Webpack debug proxy (temporary) + #location /debug { + # proxy_set_header X-Forwarded-For $remote_addr; + # proxy_set_header Host $http_host; + # proxy_pass "http://127.0.0.1:8080"; + #} + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + #error_page 500 502 503 504 /50x.html; + #location = /50x.html { + # root /usr/share/nginx/html; + #} + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + location ~ /\.ht { + deny all; + } + } diff --git a/lib/desktop_updater.js b/lib/desktop_updater.js index 66cc981deb0b4719d4434a0d69e805c024fcb09f..cc361d719cff273c2ce78eb4119bd2889c8941f2 100644 --- a/lib/desktop_updater.js +++ b/lib/desktop_updater.js @@ -3,6 +3,11 @@ console.log(process.versions) var isrequestedCheckForUpdate037 = false; var releaseNotes = {}; + +var appversionObj = {}; +var isBuildUpdate = false; +var isVersionUpdate = false; + ipcRendererUpdateWeb.on('update', function (event, message) { var msgJSON = JSON.parse(message); console.log('[DTU] update event ',message); // // message = {key:'',text:''}; @@ -22,21 +27,46 @@ ipcRendererUpdateWeb.on('update', function (event, message) { console.log('[DTU] update for v0.3.7', 'startDownload') startDownloading() } + } else if(msgJSON.key==='update-check-menu') { + getAppVesrion('update-check-menu'); + // ipcRendererOnUpdateEvent(msgJSON); } else { - + ipcRendererOnUpdateEvent(msgJSON); } -}) - +}); +/** + * + * ipcRendererOnUpdateEvent + */ function ipcRendererOnUpdateEvent(msgJSON) { - + /** + * msgJSON key's + * key: 'update-check', + * upgrade: true/false, + * upgradeType: 'version' / 'build', + * version: '0.4.0', + * build: 1590208348, + * currentVersion: '0.4.0', + * currentBuild: 1590208348, + * status: 200 + */ switch (msgJSON.key) { case 'update-check-menu': //Update UI button or text document.getElementById('update-info').style = (msgJSON.upgrade ? '' : (msgJSON.version !== '' ? 'display: none;' : 'display: none;')); + document.getElementById('update-info').innerHTML = (msgJSON.upgrade ? 'Update Available' : (msgJSON.version !== '' ? '' : '')); - document.getElementById('update_latest_version').innerHTML = (msgJSON.upgrade ? 'A new release is available (' + msgJSON.version + ').' : (msgJSON.version !== '' ? 'You are using latest version of Nynja.' : 'Encountered an error while updating, try again later.')); - document.getElementById('update_current_version').innerHTML = 'version ' + msgJSON.currentVersion; + + // document.getElementById('update_latest_version').innerHTML = (msgJSON.upgrade ? 'A new release is available (' + msgJSON.version + ').' : (msgJSON.version !== '' ? 'You are using latest version of Nynja.' : 'Encountered an error while updating, try again later.')); + document.getElementById('update_latest_version').innerHTML = (msgJSON.upgrade ? + (msgJSON.upgradeType==="version"? 'A new release is available ' + msgJSON.version +' (Build: ' + msgJSON.build + ')' : + 'A new build (' + msgJSON.build + ') is available in release ' + msgJSON.version + '.'): + (msgJSON.version !== '' ? 'You are using latest version of Nynja.' : + 'Unable to update, please try again later.')); + + //document.getElementById('update_current_version').innerHTML = 'current version ' + msgJSON.currentVersion; + document.getElementById('update_current_version').innerHTML = 'current version ' + msgJSON.currentVersion+ ' (Build: ' + msgJSON.currentBuild+')'; document.getElementById('update_version_electron').innerHTML = (msgJSON.electron === undefined ? process.versions.electron : msgJSON.electron); document.getElementById('update_version_chromium').innerHTML = (msgJSON.chromium === undefined ? process.versions.chrome : msgJSON.chromium); @@ -58,9 +88,16 @@ function ipcRendererOnUpdateEvent(msgJSON) { //Update UI button or text document.getElementById('update-info').style = (msgJSON.upgrade ? '' : (msgJSON.version !== '' ? 'display: none;' : 'display: none;')); + document.getElementById('update-info').innerHTML = (msgJSON.upgrade ? 'Update Available' : (msgJSON.version !== '' ? '' : '')); - document.getElementById('update_latest_version').innerHTML = (msgJSON.upgrade ? 'A new release is available (' + msgJSON.version + ').' : (msgJSON.version !== '' ? 'You are using latest version of Nynja.' : 'Encountered an error while updating, try again later.')); - document.getElementById('update_current_version').innerHTML = 'version ' + msgJSON.currentVersion; + + document.getElementById('update_latest_version').innerHTML = (msgJSON.upgrade ? + (msgJSON.upgradeType==="version"? 'A new release is available ' + msgJSON.version +' (Build: ' + msgJSON.build + ')' : + 'A new build (' + msgJSON.build + ') is available in release ' + msgJSON.version + '.'): + (msgJSON.version !== '' ? 'You are using latest version of Nynja.' : + 'Unable to update, please try again later.')); + + document.getElementById('update_current_version').innerHTML = 'current version ' + msgJSON.currentVersion+ ' (Build: ' + msgJSON.currentBuild+')'; //document.getElementById('update_version_electron').innerHTML = msgJSON.electron; //document.getElementById('update_version_chromium').innerHTML = msgJSON.chromium; //document.getElementById('update_version_nodejs').innerHTML = msgJSON.nodejs; @@ -122,6 +159,9 @@ function showReleaseNotes(type, msgJSON) { if(msgJSON.upgrade){ releaseNotesVersions = [msgJSON.version]; console.log('[DTU]', 'msgJSON.upgrade:',msgJSON.upgrade,releaseNotesVersions) + console.log('[DTU]', 'msgJSON.upgrade:',releaseNotes[msgJSON.version],msgJSON.notes) + releaseNotes[msgJSON.version] = {}; + releaseNotes[msgJSON.version]["content"] = msgJSON.notes; }else{ releaseNotesVersions = releaseNotesVersions.slice(releaseNotesVersions.indexOf(msgJSON.currentVersion)); console.log('[DTU]', 'msgJSON.upgrade:',msgJSON.upgrade, releaseNotesVersions) @@ -171,14 +211,28 @@ function updateVersionNotesClick() { * Update Available click handler * Show update popup */ -function updateInfoClick(msgJSON) {//alert(1); +function updateInfoClick(msgJSON) { //show modal popup document.getElementById('update-desc-box').style = ''; - + console.log(msgJSON) if (msgJSON.upgrade) { - // // document.getElementById('update-install').removeEventListener('click'); - document.getElementById('update_download_install').style = ''; - document.getElementById('update_download_install').addEventListener("click", updateConfClick) + // // // document.getElementById('update-install').removeEventListener('click'); + // document.getElementById('update_download_install').style = ''; + // document.getElementById('update_download_install').addEventListener("click", updateConfClick) + if(msgJSON.upgradeType==="version"){ + // alert(1) + document.getElementById('update_download_install').innerHTML = 'Update'; + document.getElementById('update_download_install').style = ''; + document.getElementById('update_download_install').addEventListener("click", updateConfClick) + document.getElementById('releases_info_p').innerHTML = 'After finishing the download, NYNJA application will be restarted to apply new updates.'; + }else{ + // alert(2) + + document.getElementById('update_download_install').innerHTML = 'Refresh Only'; + document.getElementById('update_refresh_only').style = ''; + document.getElementById('update_refresh_only').addEventListener("click", startDownloading) + document.getElementById('releases_info_p').innerHTML = 'By clicking on Confirm button, Nynja application will refresh to apply new updates.'; + } } } @@ -187,6 +241,8 @@ function updateInfoClick(msgJSON) {//alert(1); * Show confirmation popup */ function updateConfClick(msgJSON) {//alert(1); + document.getElementById('update-desc-box').style = 'display: none;'; + //show modal popup document.getElementById('update-conf-box').style = ''; document.getElementById('update-conf-box').style = 'z-index: 1002'; @@ -203,12 +259,24 @@ function updateConfClick(msgJSON) {//alert(1); function startDownloading() { console.log('start-download') //Update confirm and notify main process - ipcRendererUpdateWeb.send('update-main', 'update-start'); + if(isVersionUpdate){ + // alert('start1') + document.getElementById('update-notify-box').style = ''; + + appversionObj.action = 'update-start'; + ipcRendererUpdateWeb.send('update-main', appversionObj); + } else if(isBuildUpdate){ + // alert('start2') + appversionObj.action = 'update-build'; + ipcRendererUpdateWeb.send('update-main', appversionObj); + } + + //ipcRendererUpdateWeb.send('update-main', 'update-start'); document.getElementById('update-info').style = 'display: none;'; document.getElementById('update-desc-box').style = 'display: none;'; document.getElementById('update-conf-box').style = 'display: none;'; document.getElementById('update-conf-yes').style = 'display: none;'; - document.getElementById('update-notify-box').style = ''; +// document.getElementById('update-notify-box').style = ''; } @@ -422,4 +490,102 @@ if (process.env.currentVersion) { }); +/******************************** Single Update Feature ********************************/ + /** + * Call api to get version(major), build(minor) + * and latest notes for release + */ + getAppVesrion(); + setInterval(function(){ + console.log('[DTU] CHECK APP VERSION AFTER 10 MINS') + getAppVesrion(); + },10*60*1000) + function getAppVesrion(type='update-check'){ + fetch('https://desktop.staging.nynja.net/appversion', { + cache: 'no-store', + method: 'GET', + headers: { + 'Cache-Control': 'no-store', + 'Pragma': 'no-cache', + }, + }) + .then(function (res) { + // console.log('[DTU]',res); + console.log('[DTU] appversion api res',res); + return res.json(); + }) + .then(function (data) { + console.log('[DTU] appversion api data',data); + appversionObj = data; + // appversionObj = {"status":"success","version":"0.4.0","build":1590208350, "notes":['notes-sample']}; + // appversionObj = { + // "status":"success", + // "version":"0.4.0", + // "build":1590208350, + // "notes":[ + // "Updated login page design.", + // "Added download guideline in app update process.", + // "Added release notes in update popup.", + // "Fixed issues in PDF viewer (close button and fullscreen)", + // "Fixed issue in Check for Update after reload application.", + // "Removed duplicate wibdow in check for update option, single popup will appear for update option.", + // "Added confirmation popup before starting upgrade.", + // "Handled application crash on force reload.", + // "Fixed Google Login issue.", + // "Improvements in upgrading application." + // ] + // }; + + console.log('[DTU] current build',process.env.currentBuild); + console.log('[DTU] appversionObj.currentBuild > process.env.currentBuild',(appversionObj.currentBuild > parseInt(process.env.currentBuild))); + if(process.env.currentBuild){ + if(appversionObj.build > parseInt(process.env.currentBuild)) { + isBuildUpdate = true; + } + } + console.log('[DTU] current version',process.env.currentVersion); + if(process.env.currentVersion){ + var api_version_split = appversionObj.version.split('.'); + var app_env_curr_ver_split = process.env.currentVersion.split('.'); + console.log('[DTU] check version major ',api_version_split[0]>app_env_curr_ver_split[0]); + console.log('[DTU] check version minor ',api_version_split[1]>app_env_curr_ver_split[1]); + console.log('[DTU] check version patch ',api_version_split[2]>app_env_curr_ver_split[2]); + // check major + if(parseInt(api_version_split[0])>parseInt(app_env_curr_ver_split[0])){ + isVersionUpdate = true; + }else{ + // check minor + if(parseInt(api_version_split[1])>parseInt(app_env_curr_ver_split[1])){ + isVersionUpdate = true; + }else{ + // check patch + if(parseInt(api_version_split[2])>parseInt(app_env_curr_ver_split[2])){ + isVersionUpdate = true; + }else{ + + isVersionUpdate = false; + } + } + } + } + console.log('[DTU] isVersionUpdate: ', isVersionUpdate); + console.log('[DTU] isBuildUpdate: ', isBuildUpdate); + + ipcRendererOnUpdateEvent({ + key: type, + upgrade: isVersionUpdate||isBuildUpdate, + upgradeType: (isVersionUpdate?'version':(isBuildUpdate?'build':'')), + version: appversionObj.version, + build: appversionObj.build, + currentVersion: process.env.currentVersion, + currentBuild: parseInt(process.env.currentBuild), + notes: appversionObj.notes, + status: 200 + }) + + }) + .catch(function(err) { + console.log('[DTU] appversion api err', err); + }); + } } diff --git a/lib/releaseNotes/releaseNotesDesktop.json b/lib/releaseNotes/releaseNotesDesktop.json index 354b6ea43a2cf0f8a05cc4b2aabcf0e7127c7a6d..b924862f06452b7fbf00eac04380991f2a57f1c4 100644 --- a/lib/releaseNotes/releaseNotesDesktop.json +++ b/lib/releaseNotes/releaseNotesDesktop.json @@ -1,9 +1,23 @@ { - "0.3.9": { + "0.4.1": { "content": [ "Stability improvements" ] }, + "0.4.0": { + "content": [ + "Electron Framework updated to latest version 8.0.1", + "Fixed select all keyboard shortcut (command + A) issue in Mac OS", + "Handled mic and camera permission issue on Mac OS", + "Handled black thumbnails in screen share popup on Windows OS", + "Updated spellcheck feature with stable library", + "Fixed cancel button issue in Print dialog of Pdf Viewer", + "Fullscreen and close button issue fixed in Pdf viewer", + "Added single process for upgrading web and native app upgrade", + "Seperated Codebase for native application", + "Fixed screen share and invite link issue for full screenshare dialog" + ] + }, "0.3.8": { "content": [ "Updated login page design.", diff --git a/releases/prod/nynja-app-desktop.yaml b/releases/prod/nynja-app-desktop.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a70feb13d42176a182d26b27e1508ad0dd888a90 --- /dev/null +++ b/releases/prod/nynja-app-desktop.yaml @@ -0,0 +1,34 @@ +apiVersion: flux.weave.works/v1beta1 +kind: HelmRelease +metadata: + name: nynja-app-desktop + namespace: nynja-desktop +spec: + releaseName: nynja-app-desktop + chart: + repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ + name: nynja-app-desktop + version: 0.2.6 + values: + replicaCount: 3 + auth: + basic: + enabled: false + sealedSecret: "" + image: + repository: ${IMAGE_NAME_DESKTOP} + tag: ${IMAGE_BUILD_TAG_DESKTOP} + gateway: + selector: + - api-gateway.default.svc.cluster.local + hosts: + - desktop.nynja.net + - join.nynja.net + wellKnown: + appleAppSiteAssociation: + appId: 9GKQ5AMF2B.com.nynja.mobile.communicator + mqtt: + host: messaging-service.messaging.svc.cluster.local + confcall: + service: calling-service.callconf.svc.cluster.local + historyService: calling-service-history.callconf.svc.cluster.local diff --git a/releases/staging/nynja-app-desktop.yaml b/releases/staging/nynja-app-desktop.yaml index 824cb250ebabe1e502b708e629cf22afad141a9f..c845934a33805f4bb2c1960d74058bd27fd548dc 100644 --- a/releases/staging/nynja-app-desktop.yaml +++ b/releases/staging/nynja-app-desktop.yaml @@ -1,34 +1,34 @@ -apiVersion: flux.weave.works/v1beta1 -kind: HelmRelease -metadata: - name: nynja-app-desktop - namespace: nynja-desktop -spec: - releaseName: nynja-app-desktop - chart: - repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ - name: nynja-app-desktop - version: 0.2.5 - values: - replicaCount: 3 - auth: - basic: - enabled: false - sealedSecret: "" - image: - repository: ${IMAGE_NAME_DESKTOP} - tag: ${IMAGE_BUILD_TAG_DESKTOP} - gateway: - selector: - - api-gateway.default.svc.cluster.local - hosts: - - desktop.staging.nynja.net - - join.staging.nynja.net - wellKnown: - appleAppSiteAssociation: - appId: 9GKQ5AMF2B.com.nynja.rc.mobile.communicator - mqtt: - host: messaging-service.messaging.svc.cluster.local - confcall: - service: calling-service.callconf.svc.cluster.local - historyService: calling-service-history.callconf.svc.cluster.local +apiVersion: flux.weave.works/v1beta1 +kind: HelmRelease +metadata: + name: nynja-app-desktop + namespace: nynja-desktop +spec: + releaseName: nynja-app-desktop + chart: + repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ + name: nynja-app-desktop + version: 0.2.6 + values: + replicaCount: 3 + auth: + basic: + enabled: false + sealedSecret: "" + image: + repository: ${IMAGE_NAME_DESKTOP} + tag: ${IMAGE_BUILD_TAG_DESKTOP} + gateway: + selector: + - api-gateway.default.svc.cluster.local + hosts: + - desktop.staging.nynja.net + - join.staging.nynja.net + wellKnown: + appleAppSiteAssociation: + appId: 9GKQ5AMF2B.com.nynja.rc.mobile.communicator + mqtt: + host: messaging-service.messaging.svc.cluster.local + confcall: + service: calling-service.callconf.svc.cluster.local + historyService: calling-service-history.callconf.svc.cluster.local diff --git a/src/containers/MenuAppBar/MenuAppBar.js b/src/containers/MenuAppBar/MenuAppBar.js index ca8f06cfe378134478c3246e51228f478591ac97..e7cf6cf637464ce514b0c7499b04969f3e1c9e3e 100644 --- a/src/containers/MenuAppBar/MenuAppBar.js +++ b/src/containers/MenuAppBar/MenuAppBar.js @@ -179,7 +179,7 @@ class MenuAppBar extends Component { // } - {shouldUpdate && + {(shouldUpdate && (!isElectron || !isElectron())) && diff --git a/src/template.ejs b/src/template.ejs index 8065d21d72baea1efb545480dd0531bebd602e55..4b3f864d2b00debff6e5a68ffda3a99f44d5c08b 100644 --- a/src/template.ejs +++ b/src/template.ejs @@ -141,8 +141,8 @@