add 32bit mesh agent upload

This commit is contained in:
wh1te909 2020-09-13 00:09:40 +00:00
parent 6c692a2c09
commit 67b3841327
3 changed files with 14 additions and 2 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ db.sqlite3
api/tacticalrmm/static
celerybeat-schedule
meshagent.exe
meshagent-x86.exe
app.ini
.env.dev
.env

View File

@ -19,11 +19,14 @@ class UploadMeshAgent(APIView):
parser_class = (FileUploadParser,)
def put(self, request, format=None):
if "meshagent" not in request.data:
if "meshagent" not in request.data and "arch" not in request.data:
raise ParseError("Empty content")
arch = request.data["arch"]
f = request.data["meshagent"]
mesh_exe = os.path.join(settings.EXE_DIR, "meshagent.exe")
mesh_exe = os.path.join(
settings.EXE_DIR, "meshagent.exe" if arch == "64" else "meshagent-x86.exe"
)
with open(mesh_exe, "wb+") as j:
for chunk in f.chunks():
j.write(chunk)

View File

@ -4,6 +4,12 @@
<div class="text-h6">Upload New Mesh Agent</div>
</q-card-section>
<q-form @submit.prevent="upload">
<q-card-section>
<div class="q-gutter-sm">
<q-radio v-model="arch" val="64" label="64 bit" />
<q-radio v-model="arch" val="32" label="32 bit" />
</div>
</q-card-section>
<q-card-section>
<div class="row">
<q-file
@ -38,12 +44,14 @@ export default {
data() {
return {
meshagent: null,
arch: "64",
};
},
methods: {
upload() {
this.$q.loading.show({ message: "Uploading..." });
let formData = new FormData();
formData.append("arch", this.arch);
formData.append("meshagent", this.meshagent);
axios
.put("/core/uploadmesh/", formData)