mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-28 00:20:48 +00:00
add about tab to show version and config paths
This commit is contained in:
parent
d55e2b4db4
commit
e512198e50
3 changed files with 101 additions and 7 deletions
|
|
@ -119,6 +119,18 @@
|
|||
</a>
|
||||
</li>
|
||||
|
||||
<!-- info -->
|
||||
<li>
|
||||
<button @click="showAboutTab" type="button" :class="[ tab === 'about' ? 'bg-blue-100 text-blue-800 group:text-blue-800 hover:bg-blue-100' : '']" class="w-full text-gray-800 hover:bg-gray-100 group flex gap-x-3 rounded-r-full p-2 mr-2 text-sm leading-6 font-semibold focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600">
|
||||
<span class="my-auto">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z" />
|
||||
</svg>
|
||||
</span>
|
||||
<span class="my-auto">About</span>
|
||||
</button>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
@ -1027,6 +1039,53 @@
|
|||
|
||||
</div>
|
||||
|
||||
<!-- about tab -->
|
||||
<div v-if="tab === 'about'" class="overflow-y-auto space-y-2 p-2">
|
||||
|
||||
<!-- app info -->
|
||||
<div v-if="appInfo" class="bg-white rounded shadow">
|
||||
<div class="flex border-b border-gray-300 text-gray-700 p-2 font-semibold">App Info</div>
|
||||
<div class="divide-y text-gray-900">
|
||||
<div class="p-1">
|
||||
<div>Version</div>
|
||||
<div class="text-sm text-gray-700">v{{ appInfo.version }}</div>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<div>Reticulum Config Path</div>
|
||||
<div class="text-sm text-gray-700">{{ appInfo.reticulum_config_path }}</div>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<div>Database Path</div>
|
||||
<div class="text-sm text-gray-700">{{ appInfo.database_path }}</div>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<div>Database File Size</div>
|
||||
<div class="text-sm text-gray-700">{{ formatBytes(appInfo.database_file_size) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- my addresses -->
|
||||
<div v-if="config" class="bg-white rounded shadow">
|
||||
<div class="flex border-b border-gray-300 text-gray-700 p-2 font-semibold">My Addresses</div>
|
||||
<div class="divide-y text-gray-900">
|
||||
<div class="p-1">
|
||||
<div>Identity Hash</div>
|
||||
<div class="text-sm text-gray-700">{{ config.identity_hash }}</div>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<div>LXMF Address</div>
|
||||
<div class="text-sm text-gray-700">{{ config.lxmf_address_hash }}</div>
|
||||
</div>
|
||||
<div class="p-1">
|
||||
<div>Audio Call Address</div>
|
||||
<div class="text-sm text-gray-700">{{ config.audio_call_address_hash }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -1053,6 +1112,7 @@
|
|||
|
||||
displayName: "Anonymous Peer",
|
||||
config: null,
|
||||
appInfo: null,
|
||||
|
||||
audioCalls: [],
|
||||
lxmfDeliveryAnnounces: [],
|
||||
|
|
@ -1112,6 +1172,7 @@
|
|||
},
|
||||
mounted: function() {
|
||||
|
||||
this.getAppInfo();
|
||||
this.connectWebsocket();
|
||||
this.getLxmfDeliveryAnnounces();
|
||||
this.getNomadnetworkNodeAnnounces();
|
||||
|
|
@ -1325,6 +1386,15 @@
|
|||
container.scrollTop = container.scrollHeight;
|
||||
});
|
||||
},
|
||||
async getAppInfo() {
|
||||
try {
|
||||
const response = await window.axios.get(`/api/v1/app/info`);
|
||||
this.appInfo = response.data.app_info;
|
||||
} catch(e) {
|
||||
// do nothing if failed to load app info
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
async getConfig() {
|
||||
try {
|
||||
const response = await window.axios.get(`/api/v1/config`);
|
||||
|
|
@ -2291,6 +2361,10 @@
|
|||
await this.getConversations();
|
||||
|
||||
},
|
||||
showAboutTab() {
|
||||
this.tab = "about";
|
||||
this.getAppInfo();
|
||||
},
|
||||
async enableInterface(interfaceName) {
|
||||
|
||||
// enable interface
|
||||
|
|
|
|||
1
setup.py
1
setup.py
|
|
@ -26,6 +26,7 @@ setup(
|
|||
],
|
||||
# files that are required
|
||||
'include_files': [
|
||||
'package.json', # used to determine app version from python
|
||||
'public/', # static files served by web server
|
||||
],
|
||||
# slim down the build by excluding these unused libs
|
||||
|
|
|
|||
33
web.py
33
web.py
|
|
@ -48,17 +48,17 @@ class ReticulumWebChat:
|
|||
# ./storage/identities/<identity_hex>/database.db
|
||||
|
||||
# ensure a storage path exists for the loaded identity
|
||||
base_storage_dir = storage_dir or os.path.join("storage")
|
||||
storage_path = os.path.join(base_storage_dir, "identities", identity.hash.hex())
|
||||
print("Using Storage Path: {}".format(storage_path))
|
||||
os.makedirs(storage_path, exist_ok=True)
|
||||
self.storage_dir = storage_dir or os.path.join("storage")
|
||||
self.storage_path = os.path.join(self.storage_dir, "identities", identity.hash.hex())
|
||||
print("Using Storage Path: {}".format(self.storage_path))
|
||||
os.makedirs(self.storage_path, exist_ok=True)
|
||||
|
||||
# define path to files based on storage path
|
||||
database_path = os.path.join(storage_path, "database.db")
|
||||
lxmf_router_path = os.path.join(storage_path, "lxmf_router")
|
||||
self.database_path = os.path.join(self.storage_path, "database.db")
|
||||
lxmf_router_path = os.path.join(self.storage_path, "lxmf_router")
|
||||
|
||||
# init database
|
||||
sqlite_database = SqliteDatabase(database_path)
|
||||
sqlite_database = SqliteDatabase(self.database_path)
|
||||
database.database.initialize(sqlite_database)
|
||||
self.db = database.database
|
||||
self.db.connect()
|
||||
|
|
@ -109,6 +109,12 @@ class ReticulumWebChat:
|
|||
thread.daemon = True
|
||||
thread.start()
|
||||
|
||||
# gets app version from package.json
|
||||
def get_app_version(self) -> str:
|
||||
with open(get_file_path("package.json")) as f:
|
||||
package_json = json.load(f)
|
||||
return package_json["version"]
|
||||
|
||||
# automatically announces based on user config
|
||||
async def announce_loop(self):
|
||||
while True:
|
||||
|
|
@ -443,6 +449,19 @@ class ReticulumWebChat:
|
|||
|
||||
return websocket_response
|
||||
|
||||
# get app info
|
||||
@routes.get("/api/v1/app/info")
|
||||
async def index(request):
|
||||
return web.json_response({
|
||||
"app_info": {
|
||||
"version": self.get_app_version(),
|
||||
"storage_path": self.storage_path,
|
||||
"database_path": self.database_path,
|
||||
"database_file_size": os.path.getsize(self.database_path),
|
||||
"reticulum_config_path": self.reticulum.configpath,
|
||||
},
|
||||
})
|
||||
|
||||
# get config
|
||||
@routes.get("/api/v1/config")
|
||||
async def index(request):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue