mirror of https://github.com/DJ2LS/FreeDATA.git
imporved system information
parent
ecdce6d8f5
commit
f35ff767ab
|
@ -222,6 +222,44 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Info Section -->
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button
|
||||
class="accordion-button collapsed"
|
||||
type="button"
|
||||
data-bs-target="#systemStatusCollapse"
|
||||
data-bs-toggle="collapse"
|
||||
>
|
||||
System Info
|
||||
<button @click="copyToClipboard">Copy</button>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="systemStatusCollapse" class="accordion-collapse collapse">
|
||||
<div class="accordion-body">
|
||||
<h3>API Information</h3>
|
||||
<p><strong>API Version:</strong> {{ state.api_version }}</p>
|
||||
<p><strong>Modem Version:</strong> {{ state.modem_version }}</p>
|
||||
|
||||
<h3>Operating System Information</h3>
|
||||
<p><strong>System:</strong> {{ state.os_info.system }}</p>
|
||||
<p><strong>Node:</strong> {{ state.os_info.node }}</p>
|
||||
<p><strong>Release:</strong> {{ state.os_info.release }}</p>
|
||||
<p><strong>Version:</strong> {{ state.os_info.version }}</p>
|
||||
<p><strong>Machine:</strong> {{ state.os_info.machine }}</p>
|
||||
<p><strong>Processor:</strong> {{ state.os_info.processor }}</p>
|
||||
|
||||
<h3>Python Information</h3>
|
||||
<p><strong>Build:</strong> {{ state.python_info.build.join(' ') }}</p>
|
||||
<p><strong>Compiler:</strong> {{ state.python_info.compiler }}</p>
|
||||
<p><strong>Branch:</strong> {{ state.python_info.branch || 'N/A' }}</p>
|
||||
<p><strong>Implementation:</strong> {{ state.python_info.implementation }}</p>
|
||||
<p><strong>Revision:</strong> {{ state.python_info.revision || 'N/A' }}</p>
|
||||
<p><strong>Version:</strong> {{ state.python_info.version }}</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -231,65 +269,93 @@
|
|||
|
||||
<script setup>
|
||||
import { Modal } from 'bootstrap/dist/js/bootstrap.esm.min.js';
|
||||
import { onMounted } from "vue";
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
// Pinia setup
|
||||
import { setActivePinia } from "pinia";
|
||||
import pinia from "../store/index";
|
||||
import { setActivePinia } from 'pinia';
|
||||
import pinia from '../store/index';
|
||||
setActivePinia(pinia);
|
||||
|
||||
// Store imports
|
||||
import { settingsStore as settings, onChange } from "../store/settingsStore.js";
|
||||
import { sendModemCQ } from "../js/api.js";
|
||||
import { useStateStore } from "../store/stateStore.js";
|
||||
import { useAudioStore } from "../store/audioStore";
|
||||
import { useSerialStore } from "../store/serialStore.js";
|
||||
|
||||
import { settingsStore as settings } from '../store/settingsStore.js';
|
||||
import { sendModemCQ } from '../js/api.js';
|
||||
import { useStateStore } from '../store/stateStore.js';
|
||||
import { useAudioStore } from '../store/audioStore';
|
||||
import { useSerialStore } from '../store/serialStore.js';
|
||||
|
||||
// API imports
|
||||
import {
|
||||
getVersion,
|
||||
startModem,
|
||||
stopModem,
|
||||
} from "../js/api";
|
||||
import { getVersion, getSysInfo } from '../js/api';
|
||||
|
||||
// Reactive state
|
||||
const state = useStateStore(pinia);
|
||||
const audioStore = useAudioStore(pinia);
|
||||
const serialStore = useSerialStore(pinia);
|
||||
|
||||
// Get the full API URL
|
||||
const apiUrl = `${window.location.protocol}//${window.location.hostname}:${window.location.port}`;
|
||||
|
||||
// Initialize modal on mount
|
||||
onMounted(() => {
|
||||
getSysInfo().then((res) => {
|
||||
if (res) {
|
||||
state.api_version = res.api_version;
|
||||
state.modem_version = res.modem_version;
|
||||
state.os_info = res.os_info;
|
||||
state.python_info = res.python_info;
|
||||
}
|
||||
});
|
||||
|
||||
getVersion().then((res) => {
|
||||
state.modem_version = res;
|
||||
});
|
||||
new Modal("#modemCheck", {}).show();
|
||||
|
||||
new Modal('#modemCheck', {}).show();
|
||||
});
|
||||
|
||||
const copyToClipboard = () => {
|
||||
const info = `
|
||||
API Version: ${state.api_version}
|
||||
Modem Version: ${state.modem_version}
|
||||
|
||||
Operating System Information:
|
||||
System: ${state.os_info.system}
|
||||
Node: ${state.os_info.node}
|
||||
Release: ${state.os_info.release}
|
||||
Version: ${state.os_info.version}
|
||||
Machine: ${state.os_info.machine}
|
||||
Processor: ${state.os_info.processor}
|
||||
|
||||
Python Information:
|
||||
Build: ${state.python_info.build.join(' ')}
|
||||
Compiler: ${state.python_info.compiler}
|
||||
Branch: ${state.python_info.branch || 'N/A'}
|
||||
Implementation: ${state.python_info.implementation}
|
||||
Revision: ${state.python_info.revision || 'N/A'}
|
||||
Version: ${state.python_info.version}
|
||||
`;
|
||||
navigator.clipboard.writeText(info).then(() => {
|
||||
alert('Information copied to clipboard!');
|
||||
});
|
||||
};
|
||||
|
||||
// Helper functions
|
||||
function getModemStateLocal() {
|
||||
return state.is_modem_running ? "Active" : "Inactive";
|
||||
return state.is_modem_running ? 'Active' : 'Inactive';
|
||||
}
|
||||
|
||||
function getNetworkState() {
|
||||
return state.modem_connection === "connected" ? "Connected" : "Disconnected";
|
||||
return state.modem_connection === 'connected' ? 'Connected' : 'Disconnected';
|
||||
}
|
||||
|
||||
function getRigControlStatus() {
|
||||
switch (settings.remote.RADIO.control) {
|
||||
case "disabled":
|
||||
case 'disabled':
|
||||
return true;
|
||||
case "serial_ptt":
|
||||
case "rigctld":
|
||||
case "rigctld_bundle":
|
||||
case "tci":
|
||||
case 'serial_ptt':
|
||||
case 'rigctld':
|
||||
case 'rigctld_bundle':
|
||||
case 'tci':
|
||||
return state.radio_status;
|
||||
default:
|
||||
console.error("Unknown radio control mode " + settings.remote.RADIO.control);
|
||||
return "Unknown control type" + settings.remote.RADIO.control;
|
||||
console.error('Unknown radio control mode ' + settings.remote.RADIO.control);
|
||||
return 'Unknown control type' + settings.remote.RADIO.control;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ export async function apiDelete(endpoint, payload = {}) {
|
|||
}
|
||||
}
|
||||
|
||||
// Example functions using updated apiGet and apiPost
|
||||
// functions using updated apiGet and apiPost
|
||||
export async function getVersion() {
|
||||
let data = await apiGet("/version");
|
||||
if (data && data.version) {
|
||||
|
@ -124,6 +124,30 @@ export async function getVersion() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
export async function getSysInfo() {
|
||||
let data = await apiGet("/version");
|
||||
return {
|
||||
api_version: data?.api_version || "N/A",
|
||||
modem_version: data?.modem_version || "N/A",
|
||||
os_info: {
|
||||
system: data?.os_info?.system || "N/A",
|
||||
node: data?.os_info?.node || "N/A",
|
||||
release: data?.os_info?.release || "N/A",
|
||||
version: data?.os_info?.version || "N/A",
|
||||
machine: data?.os_info?.machine || "N/A",
|
||||
processor: data?.os_info?.processor || "N/A",
|
||||
},
|
||||
python_info: {
|
||||
build: data?.python_info?.build || ["N/A", "N/A"],
|
||||
compiler: data?.python_info?.compiler || "N/A",
|
||||
branch: data?.python_info?.branch || "N/A",
|
||||
implementation: data?.python_info?.implementation || "N/A",
|
||||
revision: data?.python_info?.revision || "N/A",
|
||||
version: data?.python_info?.version || "N/A",
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export async function getConfig() {
|
||||
return await apiGet("/config");
|
||||
}
|
||||
|
|
|
@ -69,7 +69,9 @@ export const useStateStore = defineStore("stateStore", () => {
|
|||
var rigctld_started = ref();
|
||||
var rigctld_process = ref();
|
||||
|
||||
var python_version = ref();
|
||||
var python_info = ref();
|
||||
var os_info = ref();
|
||||
var api_version = ref();
|
||||
var modem_version = ref();
|
||||
|
||||
var rx_buffer_length = ref();
|
||||
|
@ -121,8 +123,10 @@ export const useStateStore = defineStore("stateStore", () => {
|
|||
away_from_key,
|
||||
rigctld_started,
|
||||
rigctld_process,
|
||||
python_version,
|
||||
python_info,
|
||||
modem_version,
|
||||
api_version,
|
||||
os_info,
|
||||
rx_buffer_length,
|
||||
radio_status,
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ import signal
|
|||
import queue
|
||||
import asyncio
|
||||
import webbrowser
|
||||
import platform
|
||||
|
||||
|
||||
|
||||
|
@ -43,7 +44,7 @@ from schedule_manager import ScheduleManager
|
|||
CONFIG_ENV_VAR = 'FREEDATA_CONFIG'
|
||||
DEFAULT_CONFIG_FILE = 'config.ini'
|
||||
MODEM_VERSION = "0.16.0-alpha"
|
||||
API_VERSION = 2
|
||||
API_VERSION = 3
|
||||
LICENSE = 'GPL3.0'
|
||||
DOCUMENTATION_URL = 'https://wiki.freedata.app'
|
||||
|
||||
|
@ -159,13 +160,14 @@ async def enqueue_tx_command(cmd_class, params={}):
|
|||
# API Endpoints
|
||||
@app.get("/")
|
||||
async def index():
|
||||
|
||||
return {
|
||||
'name': 'FreeDATA API',
|
||||
'description': '',
|
||||
'description': 'A sample API that provides free data services',
|
||||
'api_version': API_VERSION,
|
||||
'modem_version': MODEM_VERSION,
|
||||
'license': LICENSE,
|
||||
'documentation': DOCUMENTATION_URL
|
||||
'documentation': DOCUMENTATION_URL,
|
||||
}
|
||||
|
||||
@app.get("/config")
|
||||
|
@ -263,7 +265,30 @@ async def post_modem_stop():
|
|||
|
||||
@app.get("/version")
|
||||
async def get_modem_version():
|
||||
return {"version": MODEM_VERSION}
|
||||
os_info = {
|
||||
'system': platform.system(),
|
||||
'node': platform.node(),
|
||||
'release': platform.release(),
|
||||
'version': platform.version(),
|
||||
'machine': platform.machine(),
|
||||
'processor': platform.processor(),
|
||||
}
|
||||
|
||||
python_info = {
|
||||
'build': platform.python_build(),
|
||||
'compiler': platform.python_compiler(),
|
||||
'branch': platform.python_branch(),
|
||||
'implementation': platform.python_implementation(),
|
||||
'revision': platform.python_revision(),
|
||||
'version': platform.python_version()
|
||||
}
|
||||
|
||||
return {
|
||||
'api_version': API_VERSION,
|
||||
'modem_version': MODEM_VERSION,
|
||||
'os_info': os_info,
|
||||
'python_info': python_info
|
||||
}
|
||||
|
||||
@app.post("/modem/send_arq_raw")
|
||||
async def post_modem_send_raw(request: Request):
|
||||
|
|
Loading…
Reference in New Issue