Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9970911249 | ||
|
|
5fed81c27b | ||
|
|
dce4f1a5ae | ||
|
|
7e1fc32a1c | ||
|
|
a69f14f504 | ||
|
|
931069458d | ||
|
|
a5259baab0 | ||
|
|
8aaa27350d | ||
|
|
6db6eb70da | ||
|
|
ac74d2b7c2 | ||
|
|
2b316aeae9 | ||
|
|
aff96a45c6 |
28
api/tacticalrmm/ee/reporting/custom_filters.py
Normal file
28
api/tacticalrmm/ee/reporting/custom_filters.py
Normal 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
|
||||||
@@ -4,20 +4,24 @@ This file is subject to the EE License Agreement.
|
|||||||
For details, see: https://license.tacticalrmm.com/ee
|
For details, see: https://license.tacticalrmm.com/ee
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import datetime
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, Literal, Optional, Tuple, Type, Union, cast
|
from typing import Any, Dict, List, Literal, Optional, Tuple, Type, Union, cast
|
||||||
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from jinja2 import Environment, FunctionLoader
|
from jinja2 import Environment, FunctionLoader
|
||||||
from rest_framework.serializers import ValidationError
|
from rest_framework.serializers import ValidationError
|
||||||
from tacticalrmm.utils import get_db_value
|
|
||||||
from weasyprint import CSS, HTML
|
from weasyprint import CSS, HTML
|
||||||
from weasyprint.text.fonts import FontConfiguration
|
from weasyprint.text.fonts import FontConfiguration
|
||||||
|
|
||||||
|
from tacticalrmm.utils import get_db_value
|
||||||
|
|
||||||
from .constants import REPORTING_MODELS
|
from .constants import REPORTING_MODELS
|
||||||
|
from .custom_filters import as_tz, local_ips
|
||||||
from .markdown.config import Markdown
|
from .markdown.config import Markdown
|
||||||
from .models import ReportAsset, ReportDataQuery, ReportHTMLTemplate, ReportTemplate
|
from .models import ReportAsset, ReportDataQuery, ReportHTMLTemplate, ReportTemplate
|
||||||
|
|
||||||
@@ -57,9 +61,25 @@ env = Environment(
|
|||||||
loader=FunctionLoader(db_template_loader),
|
loader=FunctionLoader(db_template_loader),
|
||||||
comment_start_string="{=",
|
comment_start_string="{=",
|
||||||
comment_end_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:
|
def generate_pdf(*, html: str, css: str = "") -> bytes:
|
||||||
font_config = FontConfiguration()
|
font_config = FontConfiguration()
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ cffi==1.15.1
|
|||||||
channels==4.0.0
|
channels==4.0.0
|
||||||
channels_redis==4.1.0
|
channels_redis==4.1.0
|
||||||
cryptography==41.0.5
|
cryptography==41.0.5
|
||||||
Django==4.2.6
|
Django==4.2.7
|
||||||
django-cors-headers==4.3.0
|
django-cors-headers==4.3.0
|
||||||
django-filter==23.3
|
django-filter==23.3
|
||||||
django-ipware==5.0.0
|
django-ipware==5.0.0
|
||||||
@@ -41,7 +41,7 @@ zipp==3.17.0
|
|||||||
pandas==2.1.2
|
pandas==2.1.2
|
||||||
kaleido==0.2.1
|
kaleido==0.2.1
|
||||||
jinja2==3.1.2
|
jinja2==3.1.2
|
||||||
markdown==3.5
|
markdown==3.5.1
|
||||||
plotly==5.18.0
|
plotly==5.18.0
|
||||||
weasyprint==60.1
|
weasyprint==60.1
|
||||||
ocxsect==0.1.5
|
ocxsect==0.1.5
|
||||||
@@ -20,14 +20,14 @@ MAC_UNINSTALL = BASE_DIR / "core" / "mac_uninstall.sh"
|
|||||||
AUTH_USER_MODEL = "accounts.User"
|
AUTH_USER_MODEL = "accounts.User"
|
||||||
|
|
||||||
# latest release
|
# latest release
|
||||||
TRMM_VERSION = "0.17.0"
|
TRMM_VERSION = "0.17.1"
|
||||||
|
|
||||||
# https://github.com/amidaware/tacticalrmm-web
|
# https://github.com/amidaware/tacticalrmm-web
|
||||||
WEB_VERSION = "0.101.34"
|
WEB_VERSION = "0.101.35"
|
||||||
|
|
||||||
# bump this version everytime vue code is changed
|
# bump this version everytime vue code is changed
|
||||||
# to alert user they need to manually refresh their browser
|
# 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
|
# https://github.com/amidaware/rmmagent
|
||||||
LATEST_AGENT_VER = "2.5.0"
|
LATEST_AGENT_VER = "2.5.0"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SCRIPT_VERSION="30"
|
SCRIPT_VERSION="31"
|
||||||
|
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
|
|||||||
25
install.sh
25
install.sh
@@ -1,24 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
REPO=amidaware
|
SCRIPT_VERSION="80"
|
||||||
BRANCH=master
|
SCRIPT_URL="https://raw.githubusercontent.com/amidaware/tacticalrmm/master/install.sh"
|
||||||
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"
|
|
||||||
|
|
||||||
sudo apt install -y curl wget dirmngr gnupg lsb-release ca-certificates
|
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 chown ${USER}:${USER} /rmm
|
||||||
sudo mkdir -p /var/log/celery
|
sudo mkdir -p /var/log/celery
|
||||||
sudo chown ${USER}:${USER} /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
|
cd /rmm
|
||||||
git config user.email "admin@example.com"
|
git config user.email "admin@example.com"
|
||||||
git config user.name "Bob"
|
git config user.name "Bob"
|
||||||
git checkout ${BRANCH}
|
git checkout master
|
||||||
|
|
||||||
sudo mkdir -p ${SCRIPTS_DIR}
|
sudo mkdir -p ${SCRIPTS_DIR}
|
||||||
sudo chown ${USER}:${USER} ${SCRIPTS_DIR}
|
sudo chown ${USER}:${USER} ${SCRIPTS_DIR}
|
||||||
|
|||||||
Reference in New Issue
Block a user