mirror of
https://github.com/kjanat/livegraphs-django.git
synced 2026-01-16 18:42:07 +01:00
Compare commits
2 Commits
dependabot
...
alert-auto
| Author | SHA1 | Date | |
|---|---|---|---|
| e48b0c90f3 | |||
| 9d8322064b |
@ -1,7 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export UV_LINK_MODE=copy;
|
||||
|
||||
sudo apt update
|
||||
sudo apt full-upgrade -y
|
||||
sudo apt autoremove -y;
|
||||
@ -74,7 +72,6 @@ fi
|
||||
if [ -f ~/.cache/oh-my-posh-completion.bash ]; then
|
||||
source ~/.cache/oh-my-posh-completion.bash
|
||||
fi
|
||||
|
||||
export UV_LINK_MODE=copy;
|
||||
|
||||
EOF
|
||||
|
||||
24
.github/dependabot.yml
vendored
24
.github/dependabot.yml
vendored
@ -6,17 +6,17 @@
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "devcontainers"
|
||||
directory: "/"
|
||||
- package-ecosystem: devcontainers
|
||||
directory: /
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "tuesday"
|
||||
time: "03:00"
|
||||
timezone: "Europe/Amsterdam"
|
||||
- package-ecosystem: "uv"
|
||||
directory: "/"
|
||||
interval: weekly
|
||||
day: tuesday
|
||||
time: 03:00
|
||||
timezone: Europe/Amsterdam
|
||||
- package-ecosystem: uv
|
||||
directory: /
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "tuesday"
|
||||
time: "03:00"
|
||||
timezone: "Europe/Amsterdam"
|
||||
interval: weekly
|
||||
day: tuesday
|
||||
time: 03:00
|
||||
timezone: Europe/Amsterdam
|
||||
|
||||
51
.github/workflows/bandit.yml
vendored
51
.github/workflows/bandit.yml
vendored
@ -1,51 +0,0 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# Bandit is a security linter designed to find common security issues in Python code.
|
||||
# This action will run Bandit on your codebase.
|
||||
# The results of the scan will be found under the Security tab of your repository.
|
||||
|
||||
# https://github.com/marketplace/actions/bandit-scan is ISC licensed, by abirismyname
|
||||
# https://pypi.org/project/bandit/ is Apache v2.0 licensed, by PyCQA
|
||||
|
||||
name: Bandit
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: ["master"]
|
||||
schedule:
|
||||
- cron: "37 3 * * 3"
|
||||
|
||||
jobs:
|
||||
bandit:
|
||||
permissions:
|
||||
contents: read # for actions/checkout to fetch code
|
||||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Bandit Scan
|
||||
uses: shundor/python-bandit-scan@ab1d87dfccc5a0ffab88be3aaac6ffe35c10d6cd
|
||||
with: # optional arguments
|
||||
# exit with 0, even with results found
|
||||
exit_zero: true # optional, default is DEFAULT
|
||||
# Github token of the repository (automatically created by Github)
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information.
|
||||
# File or directory to run bandit on
|
||||
# path: # optional, default is .
|
||||
# Report only issues of a given severity level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
|
||||
# level: # optional, default is UNDEFINED
|
||||
# Report only issues of a given confidence level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
|
||||
# confidence: # optional, default is UNDEFINED
|
||||
# comma-separated list of paths (glob patterns supported) to exclude from scan (note that these are in addition to the excluded paths provided in the config file) (default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)
|
||||
# excluded_paths: # optional, default is DEFAULT
|
||||
# comma-separated list of test IDs to skip
|
||||
# skips: # optional, default is DEFAULT
|
||||
# path to a .bandit file that supplies command line arguments
|
||||
# ini_path: # optional, default is DEFAULT
|
||||
61
.github/workflows/codacy.yml
vendored
61
.github/workflows/codacy.yml
vendored
@ -1,61 +0,0 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# This workflow checks out code, performs a Codacy security scan
|
||||
# and integrates the results with the
|
||||
# GitHub Advanced Security code scanning feature. For more information on
|
||||
# the Codacy security scan action usage and parameters, see
|
||||
# https://github.com/codacy/codacy-analysis-cli-action.
|
||||
# For more information on Codacy Analysis CLI in general, see
|
||||
# https://github.com/codacy/codacy-analysis-cli.
|
||||
|
||||
name: Codacy Security Scan
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: ["master"]
|
||||
schedule:
|
||||
- cron: "36 10 * * 3"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
codacy-security-scan:
|
||||
permissions:
|
||||
contents: read # for actions/checkout to fetch code
|
||||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||
name: Codacy Security Scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Checkout the repository to the GitHub Actions runner
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
|
||||
with:
|
||||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
|
||||
# You can also omit the token and run the tools that support default configurations
|
||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
verbose: true
|
||||
output: results.sarif
|
||||
format: sarif
|
||||
# Adjust severity of non-security issues
|
||||
gh-code-scanning-compat: true
|
||||
# Force 0 exit code to allow SARIF file generation
|
||||
# This will handover control about PR rejection to the GitHub side
|
||||
max-allowed-issues: 2147483647
|
||||
|
||||
# Upload the SARIF file generated in the previous step
|
||||
- name: Upload SARIF results file
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@ -1,15 +1,8 @@
|
||||
# default_install_hook_types:
|
||||
# - pre-commit
|
||||
# - post-checkout
|
||||
# - post-merge
|
||||
# - post-rewrite
|
||||
|
||||
ci:
|
||||
skip: [django-check, django-check-migrations]
|
||||
|
||||
default_language_version:
|
||||
node: 22.15.1
|
||||
python: python3.13
|
||||
default_install_hook_types:
|
||||
- pre-commit
|
||||
- post-checkout
|
||||
- post-merge
|
||||
- post-rewrite
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/adamchainz/django-upgrade
|
||||
@ -41,21 +34,28 @@ repos:
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
|
||||
- repo: local
|
||||
# - repo: https://github.com/psf/black
|
||||
# rev: 22.10.0
|
||||
# hooks:
|
||||
# - id: black
|
||||
|
||||
# # HTML/Django template linting
|
||||
# - repo: https://github.com/rtts/djhtml
|
||||
# rev: 3.0.7
|
||||
# hooks:
|
||||
# - id: djhtml
|
||||
# entry: djhtml --tabwidth 4
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v3.1.0
|
||||
hooks:
|
||||
- id: prettier-jinja
|
||||
name: Prettier Jinja
|
||||
language: node
|
||||
- id: prettier
|
||||
types_or: [javascript, jsx, ts, tsx, css, scss, html, json, yaml, markdown]
|
||||
additional_dependencies:
|
||||
- prettier
|
||||
- prettier-plugin-jinja-template
|
||||
types_or: [html, jinja]
|
||||
entry: npx prettier --plugin=prettier-plugin-jinja-template --parser=jinja-template --write
|
||||
- id: prettier-all
|
||||
name: Prettier All
|
||||
language: node
|
||||
types_or: [javascript, jsx, ts, tsx, css, scss, json, yaml, markdown]
|
||||
entry: npx prettier --write
|
||||
# types_or: [javascript, jsx, ts, tsx, css, scss, json, yaml, markdown]
|
||||
# exclude: '.*\.html$'
|
||||
|
||||
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
||||
rev: v0.18.1
|
||||
@ -77,19 +77,17 @@ repos:
|
||||
- id: django-check
|
||||
name: Django Check
|
||||
entry: uv run python dashboard_project/manage.py check
|
||||
language: python
|
||||
language: system
|
||||
pass_filenames: false
|
||||
types: [python]
|
||||
always_run: true
|
||||
additional_dependencies: [uv]
|
||||
|
||||
- id: django-check-migrations
|
||||
name: Django Check Migrations
|
||||
entry: uv run python dashboard_project/manage.py makemigrations --check --dry-run
|
||||
language: python
|
||||
language: system
|
||||
pass_filenames: false
|
||||
types: [python]
|
||||
additional_dependencies: [uv]
|
||||
|
||||
# Security checks
|
||||
- repo: https://github.com/pycqa/bandit
|
||||
@ -97,7 +95,7 @@ repos:
|
||||
hooks:
|
||||
- id: bandit
|
||||
args: [-c, pyproject.toml, -r, dashboard_project]
|
||||
# additional_dependencies: ["bandit[toml]"]
|
||||
additional_dependencies: ["bandit[toml]"]
|
||||
|
||||
# # Type checking
|
||||
# - repo: https://github.com/pre-commit/mirrors-mypy
|
||||
|
||||
11
Makefile
11
Makefile
@ -104,10 +104,10 @@ run-redis:
|
||||
|
||||
# Start all development services (web, redis, celery, celery-beat)
|
||||
run-all:
|
||||
foreman start
|
||||
|
||||
procfile:
|
||||
foreman start
|
||||
make run-redis & \
|
||||
make run & \
|
||||
make celery & \
|
||||
make celery-beat
|
||||
|
||||
# Test Celery task
|
||||
test-celery:
|
||||
@ -122,3 +122,6 @@ init-data-integration:
|
||||
# Setup development environment
|
||||
setup-dev: venv install-dev migrate create_default_datasource
|
||||
@echo "Development environment setup complete"
|
||||
|
||||
procfile:
|
||||
foreman start
|
||||
|
||||
@ -2,6 +2,7 @@ from django.contrib import messages
|
||||
from django.contrib.admin.views.decorators import staff_member_required
|
||||
from django.contrib.auth.decorators import login_required, user_passes_test
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.utils.http import url_has_allowed_host_and_scheme
|
||||
|
||||
from .models import ExternalDataSource
|
||||
from .tasks import periodic_fetch_chat_data, refresh_specific_source
|
||||
@ -36,7 +37,10 @@ def manual_data_refresh(request):
|
||||
)
|
||||
except Exception as e:
|
||||
messages.error(request, f"Failed to refresh data: {e}")
|
||||
return redirect(request.headers.get("referer", "dashboard")) # Redirect to previous page or dashboard
|
||||
referer = request.headers.get("referer", "")
|
||||
if url_has_allowed_host_and_scheme(referer, allowed_hosts=None):
|
||||
return redirect(referer)
|
||||
return redirect("dashboard") # Redirect to a safe default
|
||||
|
||||
|
||||
@staff_member_required
|
||||
@ -51,4 +55,7 @@ def refresh_specific_datasource(request, source_id):
|
||||
except Exception as e:
|
||||
messages.error(request, f"Failed to refresh data source {source.name}: {e}")
|
||||
|
||||
return redirect(request.headers.get("referer", "/admin/data_integration/externaldatasource/"))
|
||||
referer = request.headers.get("referer", "")
|
||||
if url_has_allowed_host_and_scheme(referer, allowed_hosts=None):
|
||||
return redirect(referer)
|
||||
return redirect("/admin/data_integration/externaldatasource/") # Redirect to a safe default
|
||||
|
||||
@ -299,6 +299,15 @@
|
||||
});
|
||||
|
||||
function createToast(messageText, messageTags) {
|
||||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
let toastClass = "";
|
||||
let autohide = true;
|
||||
let delay = 5000;
|
||||
@ -329,7 +338,7 @@
|
||||
<button type="button" class="btn-close ${toastClass.includes("text-white") ? "btn-close-white" : ""}" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="toast-body">
|
||||
${messageText}
|
||||
${escapeHtml(messageText)}
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
@ -137,8 +137,8 @@ django==5.2.1 \
|
||||
# django-stubs-ext
|
||||
# django-timezone-field
|
||||
# livegraphsdjango
|
||||
django-allauth==65.9.0 \
|
||||
--hash=sha256:a06bca9974df44321e94c33bcf770bb6f924d1a44b57defbce4d7ec54a55483e
|
||||
django-allauth==65.8.0 \
|
||||
--hash=sha256:9da589d99d412740629333a01865a90c95c97e0fae0cde789aa45a8fda90e83b
|
||||
# via livegraphsdjango
|
||||
django-celery-beat==2.8.1 \
|
||||
--hash=sha256:da2b1c6939495c05a551717509d6e3b79444e114a027f7b77bf3727c2a39d171 \
|
||||
|
||||
4
uv.lock
generated
4
uv.lock
generated
@ -282,13 +282,13 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "django-allauth"
|
||||
version = "65.9.0"
|
||||
version = "65.8.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "asgiref" },
|
||||
{ name = "django" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9d/a3/00aa9d5bb5df4f7464495675074dc11107c08b3eea3462fb3edc059d71e1/django_allauth-65.9.0.tar.gz", hash = "sha256:a06bca9974df44321e94c33bcf770bb6f924d1a44b57defbce4d7ec54a55483e", size = 1710514, upload-time = "2025-06-01T19:21:07.771Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/09/50/4fa3a907be1a49f5ad3b7cd67944d4b91186ef6743fe0fd401c160ba6341/django_allauth-65.8.0.tar.gz", hash = "sha256:9da589d99d412740629333a01865a90c95c97e0fae0cde789aa45a8fda90e83b", size = 1679978, upload-time = "2025-05-08T19:31:27.975Z" }
|
||||
|
||||
[[package]]
|
||||
name = "django-celery-beat"
|
||||
|
||||
Reference in New Issue
Block a user