diff --git a/_webGui/testWebComponents.page b/_webGui/testWebComponents.page index 67b7bef99..4d955f5a3 100644 --- a/_webGui/testWebComponents.page +++ b/_webGui/testWebComponents.page @@ -90,7 +90,7 @@ $serverData = [ "flashBackupActivated" => empty($flashbackup_status['activated']) ? '' : 'true', "guid" => $var['flashGUID'], "hasRemoteApikey" => !empty($myservers['remote']['apikey']), - "internalIp" => ipaddr(), + "lanIp" => ipaddr(), "internalPort" => $_SERVER['SERVER_PORT'], "keyfile" => empty($var['regFILE'])? "" : str_replace(['+','/','='], ['-','_',''], trim(base64_encode(@file_get_contents($var['regFILE'])))), "locale" => ($_SESSION['locale']) ? $_SESSION['locale'] : 'en_US', diff --git a/package.json b/package.json index 2bf66773f..11113cffc 100644 --- a/package.json +++ b/package.json @@ -3,14 +3,13 @@ "private": true, "scripts": { "build": "nuxt build", - "postbuild": "npm run rebuildManifest", "dev": "nuxt dev", "generate": "nuxt generate", - "postgenerate": "npm run rebuildManifest", "preview": "nuxt preview", "postinstall": "nuxt prepare", "serve": "serve dist/nuxt-custom-elements/connect-components", - "rebuildManifest": "node postBuild.ts" + "deploy:dev": "./scripts/deploy-dev.sh", + "build:dev": "nuxt build && npm run deploy:dev" }, "devDependencies": { "@nuxt/devtools": "^0.6.1", diff --git a/postbuild.ts b/postbuild.ts deleted file mode 100644 index 453cfbeb9..000000000 --- a/postbuild.ts +++ /dev/null @@ -1,61 +0,0 @@ -// type Manifest = { -// ['connect-components.client.css']: ManifestCSS; -// ['connect-components.client.mjs']: ManifestJS; -// } - -// type ManifestCSS = { -// file: string; -// src: string; -// } - -// type ManifestJS = { -// css: string[]; -// file: string; -// isEntry: boolean; -// src: string; -// } - -const fs = require('fs'); - -const manifest = '.nuxt/nuxt-custom-elements/dist/connect-components/manifest.json'; -const stringToRemove = '.nuxt/nuxt-custom-elements/entries/'; - -const originalCssKey = '.nuxt/nuxt-custom-elements/entries/connect-components.client.css'; -const originalJsKey = '.nuxt/nuxt-custom-elements/entries/connect-components.client.mjs'; - -console.log('*****************************'); -console.log('* RE-BUILDING MANIFEST.JSON *'); -console.log('*****************************'); - -fs.readFile(manifest, 'utf8', (error, data) => { - if (error){ - console.log(error); - return; - } - const parsedData = JSON.parse(data); - - if ('connect-components.client.mjs' in parsedData) return console.log('Manifest already re-written'); - if (!(originalJsKey in parsedData)) return console.error(`Expected JS key not in ${manifest}`); - - // create new manifest with updated top-level keys - const newManifest = { - 'connect-components.client.css': { - ...parsedData[originalCssKey], - }, - 'connect-components.client.mjs': { - ...parsedData[originalJsKey], - } - }; - // then rewrite the manifest - fs.writeFile(manifest, JSON.stringify(newManifest, null, 2), (err) => { - if (err) { - console.log('Failed to write updated data to file', err); - return; - } - console.log('Updated file successfully'); - }); - // echo out the filename that needs to be created on the server - const map = new Map(Object.entries(newManifest)); - const js = map.get('connect-components.client.mjs'); - console.log(`JS FILE FOR WEBGUI: ${js.file}`); -}); \ No newline at end of file diff --git a/scripts/deploy-dev.sh b/scripts/deploy-dev.sh new file mode 100755 index 000000000..f8c33e725 --- /dev/null +++ b/scripts/deploy-dev.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Path to store the last used server name +state_file="$HOME/.deploy_state" + +# Read the last used server name from the state file +if [[ -f "$state_file" ]]; then + last_server_name=$(cat "$state_file") +else + last_server_name="" +fi + +# Read the server name from the command-line argument or use the last used server name as the default +server_name="${1:-$last_server_name}" + +# Check if the server name is provided +if [[ -z "$server_name" ]]; then + echo "Please provide the SSH server name." + exit 1 +fi + +# Save the current server name to the state file +echo "$server_name" > "$state_file" + +# Replace the value inside the rsync command with the user's input +rsync_command="rsync -avz -e ssh .nuxt/nuxt-custom-elements/dist/connect-components root@${server_name}.local:/usr/local/emhttp/plugins/dynamix.my.servers" + +echo "Executing the following command:" +echo "$rsync_command" + +# Execute the rsync command +eval "$rsync_command"