mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-06-02 15:32:30 +02:00
Added update system [WIP]
This commit is contained in:
parent
f44e06d7a6
commit
62d7614591
2
apolloui
2
apolloui
@ -1 +1 @@
|
|||||||
Subproject commit 9419d5e6c8ac2f221b1d043fd1fdd0c4b719de29
|
Subproject commit 25c121f447d40aabe58b5df8891aca3004f0eb8f
|
@ -29,7 +29,7 @@ OS=$(lsb_release -s -i -c -r | sed ':a;N;$!ba;s/\n/ /g')
|
|||||||
UPTIME=$(uptime -s)
|
UPTIME=$(uptime -s)
|
||||||
LOADAVG=$(cat /proc/loadavg)
|
LOADAVG=$(cat /proc/loadavg)
|
||||||
ARCHITECTURE=$(uname -m)
|
ARCHITECTURE=$(uname -m)
|
||||||
if [ -f /sys/devices/virtual/thermal/thermal_zone0/temp ]; then
|
if [ -f "/sys/devices/virtual/thermal/thermal_zone0/temp" ]; then
|
||||||
TEMP=$(cat /sys/devices/virtual/thermal/thermal_zone0/temp)
|
TEMP=$(cat /sys/devices/virtual/thermal/thermal_zone0/temp)
|
||||||
else
|
else
|
||||||
TEMP="0"
|
TEMP="0"
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
"run-container": "docker run --rm -it -v \"$(pwd)\":/hostdir --entrypoint=/bin/bash orange"
|
"run-container": "docker run --rm -it -v \"$(pwd)\":/hostdir --entrypoint=/bin/bash orange"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"axios": "^0.21.1",
|
||||||
"backend-helpers": "^0.5.0",
|
"backend-helpers": "^0.5.0",
|
||||||
"backend-store": "^0.7.0",
|
"backend-store": "^0.7.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
|
@ -13,6 +13,7 @@ module.exports.typeDefs = `
|
|||||||
}
|
}
|
||||||
|
|
||||||
type McuStats {
|
type McuStats {
|
||||||
|
currentAppVersion: String,
|
||||||
timestamp: String!
|
timestamp: String!
|
||||||
hostname: String,
|
hostname: String,
|
||||||
operatingSystem: String
|
operatingSystem: String
|
||||||
|
13
src/graphql/graphqlModules/Mcu/mcuUpdate.js
Normal file
13
src/graphql/graphqlModules/Mcu/mcuUpdate.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module.exports.typeDefs = `
|
||||||
|
type McuActions {
|
||||||
|
update: EmptyOutput!
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
module.exports.resolvers = {
|
||||||
|
McuActions: {
|
||||||
|
update (root, args, { dispatch }) {
|
||||||
|
return dispatch('api/mcu/update')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,12 @@
|
|||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
const { exec } = require('child_process')
|
const { exec } = require('child_process')
|
||||||
|
const axios = require('axios')
|
||||||
|
|
||||||
module.exports = ({ define }) => {
|
module.exports = ({ define }) => {
|
||||||
define('stats', async (payload, { knex, errors, utils }) => {
|
define('stats', async (payload, { knex, errors, utils }) => {
|
||||||
const stats = await getOsStats()
|
const stats = await getOsStats()
|
||||||
|
const gitAppVersion = await axios.get('https://raw.githubusercontent.com/CryptofyCH/apolloui/dev-BTC/package.json');
|
||||||
|
stats.currentAppVersion = (gitAppVersion && gitAppVersion.data) ? gitAppVersion.data.version : null;
|
||||||
stats.timestamp = new Date().toISOString()
|
stats.timestamp = new Date().toISOString()
|
||||||
return { stats }
|
return { stats }
|
||||||
}, {
|
}, {
|
||||||
|
13
src/store/api/mcu/mcuUpdate.js
Normal file
13
src/store/api/mcu/mcuUpdate.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const { join } = require('path')
|
||||||
|
const { exec } = require('child_process')
|
||||||
|
|
||||||
|
module.exports = ({ define }) => {
|
||||||
|
define('update', async (payload, { knex, errors, utils }) => {
|
||||||
|
const updateScript = join(__dirname, '..', '..', '..', '..', 'backend', 'update')
|
||||||
|
if (process.env.NODE_ENV === 'production') return exec(`bash ${updateScript}`)
|
||||||
|
else console.log(updateScript)
|
||||||
|
return;
|
||||||
|
}, {
|
||||||
|
auth: true
|
||||||
|
})
|
||||||
|
}
|
12
yarn.lock
12
yarn.lock
@ -219,6 +219,13 @@ aws4@^1.8.0:
|
|||||||
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
|
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
|
||||||
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
|
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
|
||||||
|
|
||||||
|
axios@^0.21.1:
|
||||||
|
version "0.21.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
|
||||||
|
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
|
||||||
|
dependencies:
|
||||||
|
follow-redirects "^1.10.0"
|
||||||
|
|
||||||
babel-polyfill@^6.23.0:
|
babel-polyfill@^6.23.0:
|
||||||
version "6.26.0"
|
version "6.26.0"
|
||||||
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
|
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
|
||||||
@ -1116,6 +1123,11 @@ finalhandler@~1.1.2:
|
|||||||
statuses "~1.5.0"
|
statuses "~1.5.0"
|
||||||
unpipe "~1.0.0"
|
unpipe "~1.0.0"
|
||||||
|
|
||||||
|
follow-redirects@^1.10.0:
|
||||||
|
version "1.14.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.0.tgz#f5d260f95c5f8c105894491feee5dc8993b402fe"
|
||||||
|
integrity sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==
|
||||||
|
|
||||||
for-in@^1.0.2:
|
for-in@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
|
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
|
||||||
|
Loading…
Reference in New Issue
Block a user