Compare commits

..

12 Commits

Author SHA1 Message Date
wh1te909
9970911249 Release 0.17.1 2023-11-07 18:52:49 +00:00
wh1te909
5fed81c27b bump versions 2023-11-07 17:19:35 +00:00
wh1te909
dce4f1a5ae update reqs 2023-11-07 17:19:23 +00:00
wh1te909
7e1fc32a1c forgot to bump version of backup script last update 2023-11-07 17:17:37 +00:00
sadnub
a69f14f504 add loop controls and expression extensions to jinja 2023-11-03 15:49:10 -04:00
wh1te909
931069458d add custom filter for local_ips and rework imports 2023-11-03 17:17:54 +00:00
wh1te909
a5259baab0 start adding support for custom jinja filters 2023-11-03 16:58:43 +00:00
wh1te909
8aaa27350d expose ZoneInfo to template 2023-11-03 16:22:11 +00:00
wh1te909
6db6eb70da remove debug stuff
(cherry picked from commit ac74d2b7c2)
2023-11-02 21:27:06 +00:00
wh1te909
ac74d2b7c2 remove debug stuff 2023-11-02 21:25:24 +00:00
sadnub
2b316aeae9 expose datetime and re modules to template 2023-11-02 16:37:23 -04:00
wh1te909
aff96a45c6 back to dev [skip ci] 2023-11-01 23:31:26 +00:00
6 changed files with 59 additions and 28 deletions

View File

@@ -0,0 +1,28 @@
from contextlib import suppress
from zoneinfo import ZoneInfo
import validators
def as_tz(date_obj, tz, format="%b %d, %I:%M %p"):
return date_obj.astimezone(ZoneInfo(tz)).strftime(format)
def local_ips(wmi_detail):
ret = []
with suppress(Exception):
ips = wmi_detail["network_config"]
for i in ips:
try:
addr = [x["IPAddress"] for x in i if "IPAddress" in x][0]
except:
continue
if addr is None:
continue
for ip in addr:
if validators.ipv4(ip):
ret.append(ip)
return ret

View File

@@ -4,20 +4,24 @@ This file is subject to the EE License Agreement.
For details, see: https://license.tacticalrmm.com/ee
"""
import datetime
import json
import re
from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Tuple, Type, Union, cast
from zoneinfo import ZoneInfo
import yaml
from django.apps import apps
from jinja2 import Environment, FunctionLoader
from rest_framework.serializers import ValidationError
from tacticalrmm.utils import get_db_value
from weasyprint import CSS, HTML
from weasyprint.text.fonts import FontConfiguration
from tacticalrmm.utils import get_db_value
from .constants import REPORTING_MODELS
from .custom_filters import as_tz, local_ips
from .markdown.config import Markdown
from .models import ReportAsset, ReportDataQuery, ReportHTMLTemplate, ReportTemplate
@@ -57,9 +61,25 @@ env = Environment(
loader=FunctionLoader(db_template_loader),
comment_start_string="{=",
comment_end_string="=}",
extensions=["jinja2.ext.do", "jinja2.ext.loopcontrols"],
)
custom_globals = {
"datetime": datetime,
"ZoneInfo": ZoneInfo,
"re": re,
}
custom_filters = {
"as_tz": as_tz,
"local_ips": local_ips,
}
env.globals.update(custom_globals)
env.filters.update(custom_filters)
def generate_pdf(*, html: str, css: str = "") -> bytes:
font_config = FontConfiguration()

View File

@@ -6,7 +6,7 @@ cffi==1.15.1
channels==4.0.0
channels_redis==4.1.0
cryptography==41.0.5
Django==4.2.6
Django==4.2.7
django-cors-headers==4.3.0
django-filter==23.3
django-ipware==5.0.0
@@ -41,7 +41,7 @@ zipp==3.17.0
pandas==2.1.2
kaleido==0.2.1
jinja2==3.1.2
markdown==3.5
markdown==3.5.1
plotly==5.18.0
weasyprint==60.1
ocxsect==0.1.5

View File

@@ -20,14 +20,14 @@ MAC_UNINSTALL = BASE_DIR / "core" / "mac_uninstall.sh"
AUTH_USER_MODEL = "accounts.User"
# latest release
TRMM_VERSION = "0.17.0"
TRMM_VERSION = "0.17.1"
# https://github.com/amidaware/tacticalrmm-web
WEB_VERSION = "0.101.34"
WEB_VERSION = "0.101.35"
# bump this version everytime vue code is changed
# to alert user they need to manually refresh their browser
APP_VER = "0.0.186"
APP_VER = "0.0.187"
# https://github.com/amidaware/rmmagent
LATEST_AGENT_VER = "2.5.0"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
SCRIPT_VERSION="30"
SCRIPT_VERSION="31"
GREEN='\033[0;32m'
YELLOW='\033[1;33m'

View File

@@ -1,24 +1,7 @@
#!/usr/bin/env bash
REPO=amidaware
BRANCH=master
while [[ $# -gt 0 ]]; do
case $1 in
-r | --repo)
REPO="$2"
shift # past argument
shift # past value
;;
-b | --branch)
BRANCH="$2"
shift # past argument
shift # past value
;;
esac
done
SCRIPT_VERSION="79"
SCRIPT_URL="https://raw.githubusercontent.com/${REPO}/tacticalrmm/${BRANCH}/install.sh"
SCRIPT_VERSION="80"
SCRIPT_URL="https://raw.githubusercontent.com/amidaware/tacticalrmm/master/install.sh"
sudo apt install -y curl wget dirmngr gnupg lsb-release ca-certificates
@@ -338,11 +321,11 @@ sudo mkdir /rmm
sudo chown ${USER}:${USER} /rmm
sudo mkdir -p /var/log/celery
sudo chown ${USER}:${USER} /var/log/celery
git clone https://github.com/${REPO}/tacticalrmm.git /rmm/
git clone https://github.com/amidaware/tacticalrmm.git /rmm/
cd /rmm
git config user.email "admin@example.com"
git config user.name "Bob"
git checkout ${BRANCH}
git checkout master
sudo mkdir -p ${SCRIPTS_DIR}
sudo chown ${USER}:${USER} ${SCRIPTS_DIR}