Compare commits
3 Commits
preparing-
...
7-make-a-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9465a3915c | ||
|
|
185182b92f | ||
|
|
976d2453a2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ logs/
|
|||||||
meshtastic/
|
meshtastic/
|
||||||
.vscode/
|
.vscode/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
MeshtasticLogger.service
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=A simple chat interface and autoresponder for meshtastic
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=/home/quinn/Projects/Meshtastic-Webserver/
|
|
||||||
ExecStart=sudo /home/quinn/Projects/Meshtastic-Webserver/meshtastic/bin/python -m flask --app /home/quinn/Projects/Meshtastic-Webserver/app.py run --host=0.0.0.0 --port=80
|
|
||||||
Restart=always
|
|
||||||
User=quinn
|
|
||||||
StandardOutput=append:/home/quinn/Projects/Meshtastic-Webserver/logs/meshtastic_system.log
|
|
||||||
StandardError=append:/home/quinn/Projects/Meshtastic-Webserver/logs/meshtastic_system_error.log
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -25,3 +25,8 @@ And you can stop the service by running:
|
|||||||
|
|
||||||
To have the service start on boot run:
|
To have the service start on boot run:
|
||||||
`systemctl enable MeshtasticLogger`
|
`systemctl enable MeshtasticLogger`
|
||||||
|
|
||||||
|
# Automatic Deployment
|
||||||
|
Make sure the bash script is executable by running: `chmod u+x install.sh`
|
||||||
|
|
||||||
|
Make certain you are actually in the Meshtastic-Webserver Directory or this will fail. Run the script with: `sudo ./install.sh`
|
||||||
89
app.py
89
app.py
@@ -1,89 +0,0 @@
|
|||||||
from flask import Flask, render_template, request, jsonify
|
|
||||||
import meshtastic
|
|
||||||
from MeshtasticLogger import MeshtasticLogger
|
|
||||||
import os
|
|
||||||
|
|
||||||
messages = []
|
|
||||||
app = Flask(__name__)
|
|
||||||
interface = meshtastic.serial_interface.SerialInterface()
|
|
||||||
log_path = "logs/mesh_logs.log"
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open(log_path, 'r') as file:
|
|
||||||
for line in file:
|
|
||||||
messages.append(line)
|
|
||||||
except FileNotFoundError:
|
|
||||||
# make the log directory if it isn't already there
|
|
||||||
with open(log_path, "w") as file:
|
|
||||||
file.write("Begin logs")
|
|
||||||
|
|
||||||
def web_print(message: str):
|
|
||||||
with app.app_context():
|
|
||||||
print(message)
|
|
||||||
messages.append(message)
|
|
||||||
get_messages()
|
|
||||||
|
|
||||||
def callback(message: str):
|
|
||||||
web_print(message)
|
|
||||||
|
|
||||||
def help_response():
|
|
||||||
help_message: str = "Commands:\nhelp - show this message\clear - clear the text log\nsend <text> - sends text to all channels\nchannel <number> - sets the current channel (0-7)\n"
|
|
||||||
web_print(help_message)
|
|
||||||
|
|
||||||
logger = MeshtasticLogger(interface, "logs/mesh_logs.log", channel=1, message_received_callback=callback)
|
|
||||||
|
|
||||||
def channel_response(args: list[str]):
|
|
||||||
if(len(args) < 2):
|
|
||||||
web_print(f"Current channel number: {logger.channel}")
|
|
||||||
return
|
|
||||||
channel: int = int(args[1])
|
|
||||||
if channel > 7 or channel < 0:
|
|
||||||
web_print("Channel must be between 0 and 7")
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
logger.channel = channel
|
|
||||||
except Exception as e:
|
|
||||||
web_print(e)
|
|
||||||
else:
|
|
||||||
web_print(f"Channel set to {channel}")
|
|
||||||
|
|
||||||
def send_response(args: list[str], command: str):
|
|
||||||
if len(args) < 2:
|
|
||||||
web_print("Please provide text to send")
|
|
||||||
else:
|
|
||||||
logger.send(command[5:])
|
|
||||||
web_print(f"Sent: {command[5:]}")
|
|
||||||
|
|
||||||
def parse_command(command):
|
|
||||||
args = command.split(" ")
|
|
||||||
if len(args) < 1:
|
|
||||||
return True
|
|
||||||
|
|
||||||
if args[0] == "clear":
|
|
||||||
messages.clear()
|
|
||||||
elif args[0] == "help":
|
|
||||||
help_response()
|
|
||||||
elif args[0] == "channel":
|
|
||||||
channel_response(args)
|
|
||||||
elif args[0] == "send":
|
|
||||||
send_response(args, command)
|
|
||||||
else:
|
|
||||||
web_print("Command not recognized. Type \'help\' for a list of commands.")
|
|
||||||
|
|
||||||
@app.route('/')
|
|
||||||
def index():
|
|
||||||
return render_template('index.html')
|
|
||||||
|
|
||||||
@app.route('/send', methods=['POST'])
|
|
||||||
def send():
|
|
||||||
data = request.json
|
|
||||||
message = data.get("message", "")
|
|
||||||
parse_command(message)
|
|
||||||
return jsonify({"messages": messages})
|
|
||||||
|
|
||||||
@app.route('/messages', methods=['GET'])
|
|
||||||
def get_messages():
|
|
||||||
return jsonify({"messages": messages})
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
app.run(host="0.0.0.0", port=80, debug=True)
|
|
||||||
18
backend/CommandHandler.py
Normal file
18
backend/CommandHandler.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
class CommandHandler:
|
||||||
|
def __init__(self, print_method):
|
||||||
|
self.commands: dict = {}
|
||||||
|
self.print = print_method
|
||||||
|
|
||||||
|
def register_callback(self, key: str, callback):
|
||||||
|
self.commands[key.lower()] = callback
|
||||||
|
|
||||||
|
def parse_command(self, command : str):
|
||||||
|
args :list[str] = command.split(" ")
|
||||||
|
if args[0].lower() in self.commands:
|
||||||
|
return_message = self.commands[args[0].lower()](args[1:])
|
||||||
|
if not (return_message is None):
|
||||||
|
self.print(return_message)
|
||||||
|
else:
|
||||||
|
self.print("Command not recognized. Type 'help' for a list of commands.")
|
||||||
|
|
||||||
|
|
||||||
94
backend/app.py
Normal file
94
backend/app.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
from flask import Flask, render_template, request, jsonify
|
||||||
|
import meshtastic
|
||||||
|
from MeshtasticLogger import MeshtasticLogger
|
||||||
|
from CommandHandler import CommandHandler
|
||||||
|
import os
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Initialize data and objects
|
||||||
|
# -------------------------------
|
||||||
|
messages = []
|
||||||
|
app = Flask(__name__)
|
||||||
|
interface = meshtastic.serial_interface.SerialInterface()
|
||||||
|
log_path = "logs/mesh_logs.log"
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(log_path, 'r') as file:
|
||||||
|
for line in file:
|
||||||
|
messages.append(line)
|
||||||
|
except FileNotFoundError:
|
||||||
|
# make the log directory if it isn't already there
|
||||||
|
with open(log_path, "w") as file:
|
||||||
|
file.write("Begin logs")
|
||||||
|
|
||||||
|
def web_print(message: str):
|
||||||
|
with app.app_context():
|
||||||
|
print(message)
|
||||||
|
messages.append(message)
|
||||||
|
get_messages()
|
||||||
|
|
||||||
|
command_handler: CommandHandler = CommandHandler(web_print)
|
||||||
|
logger = MeshtasticLogger(interface, "logs/mesh_logs.log", channel=1, message_received_callback=web_print)
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# Command Callback Handlers
|
||||||
|
# -------------------------
|
||||||
|
def help_response(args: list[str]):
|
||||||
|
return "Commands:\nhelp - show this message\clear - clear the text log\nsend <text> - sends text to all channels\nchannel <number> - sets the current channel (0-7)\n"
|
||||||
|
|
||||||
|
def channel_response(args: list[str]):
|
||||||
|
if len(args) < 1:
|
||||||
|
return f"Current channel number: {logger.channel}"
|
||||||
|
channel: int = int(args[0])
|
||||||
|
if channel > 7 or channel < 0:
|
||||||
|
return "Channel must be between 0 and 7"
|
||||||
|
|
||||||
|
try:
|
||||||
|
logger.channel = channel
|
||||||
|
except Exception as e:
|
||||||
|
return e
|
||||||
|
|
||||||
|
return f"Channel set to {channel}"
|
||||||
|
|
||||||
|
def send_response(args: list[str]):
|
||||||
|
if len(args) == 0:
|
||||||
|
return "Please provide text to send"
|
||||||
|
|
||||||
|
command = ""
|
||||||
|
for arg in args:
|
||||||
|
command += arg + " "
|
||||||
|
|
||||||
|
command = command[:-1] # remove the trailing space
|
||||||
|
|
||||||
|
logger.send(command)
|
||||||
|
return_message = f"Sent: {command}"
|
||||||
|
return return_message
|
||||||
|
|
||||||
|
def clear_response(args):
|
||||||
|
messages.clear()
|
||||||
|
return None
|
||||||
|
|
||||||
|
# register callbacks
|
||||||
|
command_handler.register_callback("clear", clear_response)
|
||||||
|
command_handler.register_callback("help", help_response)
|
||||||
|
command_handler.register_callback("channel", channel_response)
|
||||||
|
command_handler.register_callback("send", send_response)
|
||||||
|
|
||||||
|
# -----------------------
|
||||||
|
# Flask Callback Handlers
|
||||||
|
# -----------------------
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
return render_template('index.html')
|
||||||
|
|
||||||
|
@app.route('/send', methods=['POST'])
|
||||||
|
def send():
|
||||||
|
data = request.json
|
||||||
|
message = data.get("message", "")
|
||||||
|
command_handler.parse_command(message)
|
||||||
|
return jsonify({"messages": messages})
|
||||||
|
|
||||||
|
@app.route('/messages', methods=['GET'])
|
||||||
|
def get_messages():
|
||||||
|
return jsonify({"messages": messages})
|
||||||
|
|
||||||
17
frontend/.editorconfig
Normal file
17
frontend/.editorconfig
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.ts]
|
||||||
|
quote_type = single
|
||||||
|
ij_typescript_use_double_quotes = false
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
||||||
42
frontend/.gitignore
vendored
Normal file
42
frontend/.gitignore
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
|
||||||
|
|
||||||
|
# Compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
|
# Node
|
||||||
|
/node_modules
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
.idea/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
/.angular/cache
|
||||||
|
.sass-cache/
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
|
||||||
|
# System files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
59
frontend/README.md
Normal file
59
frontend/README.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Frontend
|
||||||
|
|
||||||
|
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.6.
|
||||||
|
|
||||||
|
## Development server
|
||||||
|
|
||||||
|
To start a local development server, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng serve
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
|
||||||
|
|
||||||
|
## Code scaffolding
|
||||||
|
|
||||||
|
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng generate component component-name
|
||||||
|
```
|
||||||
|
|
||||||
|
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng generate --help
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
To build the project run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng build
|
||||||
|
```
|
||||||
|
|
||||||
|
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running end-to-end tests
|
||||||
|
|
||||||
|
For end-to-end (e2e) testing, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng e2e
|
||||||
|
```
|
||||||
|
|
||||||
|
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
||||||
98
frontend/angular.json
Normal file
98
frontend/angular.json
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"frontend": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {},
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"prefix": "app",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:application",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/frontend",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"browser": "src/main.ts",
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js"
|
||||||
|
],
|
||||||
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "public"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"@angular/material/prebuilt-themes/azure-blue.css",
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "500kB",
|
||||||
|
"maximumError": "1MB"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "4kB",
|
||||||
|
"maximumError": "8kB"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"optimization": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production"
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"buildTarget": "frontend:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"buildTarget": "frontend:build:development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n"
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js",
|
||||||
|
"zone.js/testing"
|
||||||
|
],
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "public"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"@angular/material/prebuilt-themes/azure-blue.css",
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14472
frontend/package-lock.json
generated
Normal file
14472
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
39
frontend/package.json
Normal file
39
frontend/package.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"ng": "ng",
|
||||||
|
"start": "ng serve",
|
||||||
|
"build": "ng build",
|
||||||
|
"watch": "ng build --watch --configuration development",
|
||||||
|
"test": "ng test"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@angular/cdk": "^19.2.8",
|
||||||
|
"@angular/common": "^19.2.0",
|
||||||
|
"@angular/compiler": "^19.2.0",
|
||||||
|
"@angular/core": "^19.2.0",
|
||||||
|
"@angular/forms": "^19.2.0",
|
||||||
|
"@angular/material": "^19.2.8",
|
||||||
|
"@angular/platform-browser": "^19.2.0",
|
||||||
|
"@angular/platform-browser-dynamic": "^19.2.0",
|
||||||
|
"@angular/router": "^19.2.0",
|
||||||
|
"rxjs": "~7.8.0",
|
||||||
|
"tslib": "^2.3.0",
|
||||||
|
"zone.js": "~0.15.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular-devkit/build-angular": "^19.2.6",
|
||||||
|
"@angular/cli": "^19.2.6",
|
||||||
|
"@angular/compiler-cli": "^19.2.0",
|
||||||
|
"@types/jasmine": "~5.1.0",
|
||||||
|
"jasmine-core": "~5.6.0",
|
||||||
|
"karma": "~6.4.0",
|
||||||
|
"karma-chrome-launcher": "~3.2.0",
|
||||||
|
"karma-coverage": "~2.2.0",
|
||||||
|
"karma-jasmine": "~5.1.0",
|
||||||
|
"karma-jasmine-html-reporter": "~2.1.0",
|
||||||
|
"typescript": "~5.7.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
frontend/public/favicon.ico
Normal file
BIN
frontend/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
0
frontend/src/app/app.component.css
Normal file
0
frontend/src/app/app.component.css
Normal file
7
frontend/src/app/app.component.html
Normal file
7
frontend/src/app/app.component.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<head>
|
||||||
|
<title>My Angular App</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Welcome to my Angular app!</h1>
|
||||||
|
</body>
|
||||||
29
frontend/src/app/app.component.spec.ts
Normal file
29
frontend/src/app/app.component.spec.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
describe('AppComponent', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [AppComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create the app', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should have the 'frontend' title`, () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app.title).toEqual('frontend');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render title', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
|
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, frontend');
|
||||||
|
});
|
||||||
|
});
|
||||||
12
frontend/src/app/app.component.ts
Normal file
12
frontend/src/app/app.component.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-root',
|
||||||
|
imports: [MatSlideToggleModule],
|
||||||
|
templateUrl: './app.component.html',
|
||||||
|
styleUrl: './app.component.css'
|
||||||
|
})
|
||||||
|
export class AppComponent {
|
||||||
|
title = 'frontend';
|
||||||
|
}
|
||||||
8
frontend/src/app/app.config.ts
Normal file
8
frontend/src/app/app.config.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
|
||||||
|
import { provideRouter } from '@angular/router';
|
||||||
|
|
||||||
|
import { routes } from './app.routes';
|
||||||
|
|
||||||
|
export const appConfig: ApplicationConfig = {
|
||||||
|
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)]
|
||||||
|
};
|
||||||
3
frontend/src/app/app.routes.ts
Normal file
3
frontend/src/app/app.routes.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import { Routes } from '@angular/router';
|
||||||
|
|
||||||
|
export const routes: Routes = [];
|
||||||
0
frontend/src/app/tab-group/tab-group.html
Normal file
0
frontend/src/app/tab-group/tab-group.html
Normal file
12
frontend/src/app/tab-group/tab-group.ts
Normal file
12
frontend/src/app/tab-group/tab-group.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { MatTabsModule } from '@angular/material/tabs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title Basic use of the tab group
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'tab-group-test',
|
||||||
|
templateUrl: 'tab-group.html',
|
||||||
|
imports: [MatTabsModule],
|
||||||
|
})
|
||||||
|
export class TabGroup { }
|
||||||
23
frontend/src/index.html
Normal file
23
frontend/src/index.html
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Basic use of the tab group</title>
|
||||||
|
<base href="/">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="mat-typography mat-app-background">
|
||||||
|
<tab-group-test>
|
||||||
|
<mat-tab label="Chat"> Content 1 </mat-tab>
|
||||||
|
<mat-tab label="Settings"> Content 2 </mat-tab>
|
||||||
|
<mat-tab label="Nodes"> Content 3 </mat-tab>
|
||||||
|
</tab-group-test>
|
||||||
|
<div style="margin-top: 24px">Current build: 19.2.8</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
10
frontend/src/main.ts
Normal file
10
frontend/src/main.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { importProvidersFrom } from '@angular/core';
|
||||||
|
import { bootstrapApplication } from '@angular/platform-browser';
|
||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
|
import { provideAnimations } from '@angular/platform-browser/animations';
|
||||||
|
import { VERSION as MAT_VERSION, provideNativeDateAdapter } from '@angular/material/core';
|
||||||
|
import { TabGroup } from './app/tab-group/tab-group';
|
||||||
|
|
||||||
|
bootstrapApplication(TabGroup, {
|
||||||
|
providers: [provideAnimations(), provideHttpClient(), provideNativeDateAdapter()],
|
||||||
|
}).catch(err => console.error(err));
|
||||||
4
frontend/src/styles.css
Normal file
4
frontend/src/styles.css
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/* You can add global styles to this file, and also import other style files */
|
||||||
|
|
||||||
|
html, body { height: 100%; }
|
||||||
|
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
|
||||||
15
frontend/tsconfig.app.json
Normal file
15
frontend/tsconfig.app.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||||
|
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/app",
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/main.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
27
frontend/tsconfig.json
Normal file
27
frontend/tsconfig.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||||
|
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./dist/out-tsc",
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"importHelpers": true,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022"
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"strictInputAccessModifiers": true,
|
||||||
|
"strictTemplates": true
|
||||||
|
}
|
||||||
|
}
|
||||||
15
frontend/tsconfig.spec.json
Normal file
15
frontend/tsconfig.spec.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||||
|
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/spec",
|
||||||
|
"types": [
|
||||||
|
"jasmine"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
33
install.sh
Executable file
33
install.sh
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
CURRENT_DIRECTORY=$(pwd)
|
||||||
|
echo "Current directory: $CURRENT_DIRECTORY"
|
||||||
|
|
||||||
|
cd $CURRENT_DIRECTORY
|
||||||
|
|
||||||
|
if test -f "meshtastic"; then
|
||||||
|
echo "Virtual environment already exists. Skipping venv creation."
|
||||||
|
else
|
||||||
|
echo "Making virtual environment..."
|
||||||
|
python3 -m venv meshtastic
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Installing venv requirements"
|
||||||
|
meshtastic/bin/python -m pip install -r requirements.txt
|
||||||
|
|
||||||
|
echo "Generating service file from template"
|
||||||
|
|
||||||
|
read -p "Do you want to continue? (y/n): " choice
|
||||||
|
|
||||||
|
# Check if the user typed 'n' or 'N'
|
||||||
|
if [[ "$choice" == "n" || "$choice" == "N" ]]; then
|
||||||
|
echo "Exiting the script..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Continuing...\n Creating Service file..."
|
||||||
|
# Replace all instances of ${WORKING_DIRECTORY} with the actual working directory and write to the new file
|
||||||
|
sed "s|\${WORKING_DIRECTORY}|$CURRENT_DIRECTORY|g" "service-template/MeshtasticLogger-template.service" > "MeshtasticLogger.service"
|
||||||
|
|
||||||
|
echo "Deploying service"
|
||||||
|
sudo cp "$CURRENT_DIRECTORY/MeshtasticLogger.service" /etc/systemd/system/ && sudo systemctl daemon-reload && sudo systemctl start MeshtasticLogger
|
||||||
|
|
||||||
|
|
||||||
14
service-template/MeshtasticLogger-template.service
Normal file
14
service-template/MeshtasticLogger-template.service
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=A simple chat interface and autoresponder for meshtastic
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
WorkingDirectory=${WORKING_DIRECTORY}/
|
||||||
|
ExecStart=sudo ${WORKING_DIRECTORY}/meshtastic/bin/python -m flask --app ${WORKING_DIRECTORY}/app.py run --host=0.0.0.0 --port=80
|
||||||
|
Restart=always
|
||||||
|
User=quinn
|
||||||
|
StandardOutput=append:${WORKING_DIRECTORY}/logs/meshtastic_system.log
|
||||||
|
StandardError=append:${WORKING_DIRECTORY}/logs/meshtastic_system_error.log
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user