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 api/tacticalrmm/static
celerybeat-schedule celerybeat-schedule
meshagent.exe meshagent.exe
meshagent-x86.exe
app.ini app.ini
.env.dev .env.dev
.env .env

View File

@ -19,11 +19,14 @@ class UploadMeshAgent(APIView):
parser_class = (FileUploadParser,) parser_class = (FileUploadParser,)
def put(self, request, format=None): 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") raise ParseError("Empty content")
arch = request.data["arch"]
f = request.data["meshagent"] 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: with open(mesh_exe, "wb+") as j:
for chunk in f.chunks(): for chunk in f.chunks():
j.write(chunk) j.write(chunk)

View File

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