Fix critical bugs in app_urls
- init_db.py: parameterize SQL queries to prevent SQL injection - scheduled_tasks.json: resolve duplicate periodic task pk (4 -> 15) - db_utils.py: use function parameter in _get_status_pattern_matching instead of capturing the enclosing scope variable - url_detail.html: fix wrong field name image_urls -> images_url - settings.py: align Celery queues (default/light/heavy) with the task queues and supervisord workers - Add /task/publish_<id>/ route to fix broken publish links in templates
This commit is contained in:
@@ -2,12 +2,13 @@ from .views_base import link_list, logs, log_db #, trigger_task,
|
||||
|
||||
from django.core.paginator import Paginator
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import StreamingHttpResponse, JsonResponse
|
||||
from django.http import StreamingHttpResponse, JsonResponse, HttpResponse
|
||||
from django.db.models import Q, Count
|
||||
from django.utils import timezone
|
||||
from django.utils.timezone import now, timedelta
|
||||
from .models import Urls, Source, Search, UrlContent, UrlsSourceSearch, UrlsDuplicate
|
||||
from .src.llm import OllamaClient
|
||||
from .src.publisher import Publisher
|
||||
import json
|
||||
|
||||
|
||||
@@ -62,6 +63,15 @@ def url_detail_view(request, id):
|
||||
}
|
||||
return render(request, 'url_detail.html', context)
|
||||
|
||||
def publish(request, id):
|
||||
# Publish URL content to Ghost
|
||||
try:
|
||||
Publisher().publish(id)
|
||||
message = "URL ID {} published".format(id)
|
||||
except Exception as e:
|
||||
message = "Error publishing URL ID {}: {}".format(id, str(e))
|
||||
return HttpResponse(message)
|
||||
|
||||
####################################################################################################
|
||||
def charts(request):
|
||||
return render(request, 'charts.html')
|
||||
|
||||
Reference in New Issue
Block a user