Compare commits

...

1 Commits

Author SHA1 Message Date
Flatlogic Bot
fdb9583bdb i 2025-11-15 23:04:38 +00:00
26 changed files with 679 additions and 180 deletions

View File

@ -0,0 +1,148 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Page not found at /assets/vm-shot-2025-11-15T22-23-11-632Z.jpg</title>
<meta name="robots" content="NONE,NOARCHIVE">
<style>
html * { padding:0; margin:0; }
body * { padding:10px 20px; }
body * * { padding:0; }
body { font-family: sans-serif; background:#eee; color:#000; }
body > :where(header, main, footer) { border-bottom:1px solid #ddd; }
h1 { font-weight:normal; margin-bottom:.4em; }
h1 small { font-size:60%; color:#666; font-weight:normal; }
table { border:none; border-collapse: collapse; width:100%; }
td, th { vertical-align:top; padding:2px 3px; }
th { width:12em; text-align:right; color:#666; padding-right:.5em; }
#info { background:#f6f6f6; }
#info ol { margin: 0.5em 4em; }
#info ol li { font-family: monospace; }
#summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; }
pre.exception_value { font-family: sans-serif; color: #575757; font-size: 1.5em; margin: 10px 0 10px 0; }
</style>
</head>
<body>
<header id="summary">
<h1>Page not found <small>(404)</small></h1>
<table class="meta">
<tr>
<th scope="row">Request Method:</th>
<td>GET</td>
</tr>
<tr>
<th scope="row">Request URL:</th>
<td>http://muhammad-ishraq.dev.flatlogic.app/assets/vm-shot-2025-11-15T22-23-11-632Z.jpg</td>
</tr>
</table>
</header>
<main id="info">
<p>
Using the URLconf defined in <code>config.urls</code>,
Django tried these URL patterns, in this order:
</p>
<ol>
<li>
<code>
admin/
</code>
</li>
<li>
<code>
</code>
<code>
[name='index']
</code>
</li>
<li>
<code>
</code>
<code>
analyze/
[name='analyze']
</code>
</li>
<li>
<code>
</code>
<code>
signup/
[name='signup']
</code>
</li>
<li>
<code>
</code>
<code>
login/
[name='login']
</code>
</li>
<li>
<code>
</code>
<code>
logout/
[name='logout']
</code>
</li>
</ol>
<p>
The current path, <code>assets/vm-shot-2025-11-15T22-23-11-632Z.jpg</code>,
didnt match any of these.
</p>
</main>
<footer id="explanation">
<p>
Youre seeing this error because you have <code>DEBUG = True</code> in
your Django settings file. Change that to <code>False</code>, and Django
will display a standard 404 page.
</p>
</footer>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

View File

@ -0,0 +1,24 @@
{
"manifest_version": 3,
"name": "Scam Protector",
"version": "1.0",
"description": "Proactively protects you from scams.",
"permissions": [
"activeTab",
"storage",
"http://127.0.0.1:8000/*"
],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
},
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
}

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Scam Protector</title>
<style>
body {
font-family: sans-serif;
width: 300px;
}
#result {
margin-top: 10px;
}
</style>
</head>
<body>
<h1>Scam Protector</h1>
<p>Enter a URL to analyze:</p>
<input type="text" id="urlInput" placeholder="https://example.com">
<button id="analyzeBtn">Analyze</button>
<div id="result"></div>
<script src="popup.js"></script>
</body>
</html>

View File

@ -0,0 +1,29 @@
document.getElementById('analyzeBtn').addEventListener('click', () => {
const url = document.getElementById('urlInput').value;
const resultDiv = document.getElementById('result');
if (url) {
resultDiv.textContent = 'Analyzing...';
fetch('http://127.0.0.1:8000/api/analyze/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ content: url }),
})
.then(response => response.json())
.then(data => {
if (data.status === 'ok') {
resultDiv.textContent = `Analysis: ${data.message}`;
} else {
resultDiv.textContent = `Error: ${data.message}`;
}
})
.catch(error => {
console.error('Error:', error);
resultDiv.textContent = 'An error occurred during analysis.';
});
} else {
resultDiv.textContent = 'Please enter a URL.';
}
});

Binary file not shown.

View File

@ -1,3 +1,8 @@
from django.contrib import admin
from .models import ScamReport
# Register your models here.
@admin.register(ScamReport)
class ScamReportAdmin(admin.ModelAdmin):
list_display = ('description', 'source', 'reported_at', 'status')
list_filter = ('status', 'reported_at')
search_fields = ('description', 'source')

25
core/forms.py Normal file
View File

@ -0,0 +1,25 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import ScamReport
class ScamReportForm(forms.ModelForm):
class Meta:
model = ScamReport
fields = ['description', 'source']
widgets = {
'description': forms.Textarea(attrs={
'class': 'form-control',
'placeholder': 'Describe the scam in detail...',
'rows': 4
}),
'source': forms.TextInput(attrs={
'class': 'form-control',
'placeholder': 'e.g., suspicious.com or scammer@example.com'
}),
}
class SignUpForm(UserCreationForm):
class Meta:
model = User
fields = ('username', 'email')

View File

@ -0,0 +1,27 @@
# Generated by Django 5.2.7 on 2025-11-15 22:10
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ScamReport',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField(help_text='Describe the suspicious activity.')),
('source', models.CharField(blank=True, help_text='The source (e.g., URL, email address).', max_length=255, null=True)),
('reported_at', models.DateTimeField(auto_now_add=True)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('VERIFIED', 'Verified'), ('DISMISSED', 'Dismissed')], default='PENDING', max_length=10)),
],
options={
'ordering': ['-reported_at'],
},
),
]

View File

@ -1,3 +1,19 @@
from django.db import models
# Create your models here.
class ScamReport(models.Model):
description = models.TextField(help_text="Describe the suspicious activity.")
source = models.CharField(max_length=255, blank=True, null=True, help_text="The source (e.g., URL, email address).")
reported_at = models.DateTimeField(auto_now_add=True)
STATUS_CHOICES = [
('PENDING', 'Pending'),
('VERIFIED', 'Verified'),
('DISMISSED', 'Dismissed'),
]
status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='PENDING')
class Meta:
ordering = ['-reported_at']
def __str__(self):
return f"{self.description[:50]}..."

View File

@ -1,11 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8">
<title>{% block title %}Knowledge Base{% endblock %}</title>
{% block head %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
</body>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ScamGuard - Community-Powered Scam Prevention</title>
<meta name="description" content="Protect yourself from online fraud. Report suspicious activity and browse our community-powered database of scams.">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Poppins:wght@600;700&display=swap" rel="stylesheet">
{% load static %}
<link rel="stylesheet" href="{% static 'css/custom.css' %}">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="{% url 'index' %}">ScamGuard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
{% if user.is_authenticated %}
<li class="nav-item">
<span class="nav-link">Welcome, {{ user.username }}</span>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'logout' %}">Logout</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'login' %}">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'signup' %}">Sign Up</a>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>
<main class="container mt-4">
{% block content %}
{% endblock %}
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,41 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<div class="container content-section">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="analysis-container">
<h2 class="text-center mb-4">Analysis Result</h2>
<div class="card mb-4">
<div class="card-header">
<strong>Your Submission</strong>
</div>
<div class="card-body">
<p class="card-text">{{ report.description }}</p>
{% if report.source %}
<footer class="blockquote-footer">Source: <cite title="Source">{{ report.source }}</cite></footer>
{% endif %}
</div>
</div>
<div class="card border-primary">
<div class="card-header bg-primary text-white">
<strong>AI Risk Assessment</strong>
</div>
<div class="card-body">
<h4 class="card-title">Analysis In Progress...</h4>
<p class="card-text">Our AI is currently analyzing your submission. This feature is under development and will be available soon.</p>
<p class="card-text">For now, we have recorded this item for future analysis. Thank you for helping us build a safer digital environment.</p>
</div>
</div>
<div class="text-center mt-4">
<a href="{% url 'index' %}" class="btn btn-secondary">Analyze Another Item</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -1,154 +1,36 @@
{% extends "base.html" %}
{% block title %}{{ project_name }}{% endblock %}
{% block head %}
{% if project_description %}
<meta name="description" content="{{ project_description }}">
<meta property="og:description" content="{{ project_description }}">
<meta property="twitter:description" content="{{ project_description }}">
{% endif %}
{% if project_image_url %}
<meta property="og:image" content="{{ project_image_url }}">
<meta property="twitter:image" content="{{ project_image_url }}">
{% endif %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
inset: 0;
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><path d='M-10 10L110 10M10 -10L10 110' stroke-width='1' stroke='rgba(255,255,255,0.05)'/></svg>");
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% {
background-position: 0% 0%;
}
100% {
background-position: 100% 100%;
}
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2.5rem 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}
h1 {
font-size: clamp(2.2rem, 3vw + 1.2rem, 3.2rem);
font-weight: 700;
margin: 0 0 1.2rem;
letter-spacing: -0.02em;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
opacity: 0.92;
}
.loader {
margin: 1.5rem auto;
width: 56px;
height: 56px;
border: 4px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.runtime code {
background: rgba(0, 0, 0, 0.25);
padding: 0.15rem 0.45rem;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
footer {
position: absolute;
bottom: 1rem;
width: 100%;
text-align: center;
font-size: 0.85rem;
opacity: 0.75;
}
</style>
{% endblock %}
{% load static %}
{% block content %}
<main>
<div class="card">
<h1>Analyzing your requirements and generating your app…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
<div class="hero-section">
<div class="container text-center">
<h1 class="hero-title">Your Shield Against Digital Scams</h1>
<p class="hero-subtitle">Analyze suspicious messages, emails, and websites to protect yourself from digital threats.</p>
<a href="#report-form" class="btn btn-accent btn-lg">Check for Scams</a>
</div>
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will refresh automatically as the plan is implemented.</p>
<p class="runtime">
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
</p>
</div>
</main>
<footer>
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
</footer>
{% endblock %}
</div>
<div class="container content-section">
<div class="row justify-content-center">
<!-- Analysis Form Column -->
<div class="col-lg-8">
<div id="analysis-form" class="form-container">
<h2>Analyze a Potential Scam</h2>
<p>Enter any text, URL, or message below. Our AI will analyze it for signs of a scam and give you a risk assessment.</p>
<form method="post" action="/analyze/" novalidate>
{% csrf_token %}
<div class="mb-3">
{{ form.description.label_tag }}
{{ form.description }}
</div>
<div class="mb-4">
{{ form.source.label_tag }}
{{ form.source }}
</div>
<button type="submit" class="btn btn-primary w-100">Analyze Now</button>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block title %}Login{% endblock title %}
{% block content %}
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<h2 class="text-center mt-5">Login</h2>
<form method="post" class="mt-4">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary w-100">Login</button>
</form>
</div>
</div>
</div>
{% endblock content %}

View File

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block title %}Sign Up{% endblock title %}
{% block content %}
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<h2 class="text-center mt-5">Create an Account</h2>
<form method="post" class="mt-4">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary w-100">Sign Up</button>
</form>
</div>
</div>
</div>
{% endblock content %}

View File

@ -1,7 +1,11 @@
from django.urls import path
from .views import home
from .views import index, analyze_report, SignupView, CustomLoginView, CustomLogoutView, api_analyze
urlpatterns = [
path("", home, name="home"),
path('', index, name='index'),
path('analyze/', analyze_report, name='analyze'),
path('api/analyze/', api_analyze, name='api_analyze'),
path('signup/', SignupView.as_view(), name='signup'),
path('login/', CustomLoginView.as_view(), name='login'),
path('logout/', CustomLogoutView.as_view(), name='logout'),
]

View File

@ -2,24 +2,70 @@ import os
import platform
from django import get_version as django_version
from django.shortcuts import render
from django.utils import timezone
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.views import LoginView, LogoutView
from django.shortcuts import render, redirect
from django.urls import reverse_lazy
from django.views.generic import CreateView
from .forms import ScamReportForm, SignUpForm
from .models import ScamReport
def home(request):
"""Render the landing screen with loader and environment details."""
host_name = request.get_host().lower()
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
now = timezone.now()
def index(request):
"""Render the homepage with a scam submission form."""
form = ScamReportForm()
return render(request, 'core/index.html', {'form': form})
context = {
"project_name": "New Style",
"agent_brand": agent_brand,
"django_version": django_version(),
"python_version": platform.python_version(),
"current_time": now,
"host_name": host_name,
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
}
return render(request, "core/index.html", context)
def analyze_report(request):
"""Process the scam report submission and display an analysis page."""
if request.method == 'POST':
form = ScamReportForm(request.POST)
if form.is_valid():
report = form.save()
return render(request, 'core/analysis_result.html', {'report': report})
# Redirect to home if not a POST request or form is invalid
return redirect('index')
class SignupView(CreateView):
form_class = SignUpForm
success_url = reverse_lazy('login')
template_name = 'registration/signup.html'
class CustomLoginView(LoginView):
template_name = 'registration/login.html'
redirect_authenticated_user = True
def get_success_url(self):
return reverse_lazy('index')
class CustomLogoutView(LogoutView):
next_page = reverse_lazy('index')
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
import json
@csrf_exempt
def api_analyze(request):
"""API endpoint to analyze content for scams."""
if request.method == 'POST':
try:
data = json.loads(request.body)
content_to_analyze = data.get('content')
if content_to_analyze:
# In the future, we will add real analysis logic here.
# For now, we'll return a placeholder response.
return JsonResponse({'status': 'ok', 'message': 'Analysis complete.'})
else:
return JsonResponse({'status': 'error', 'message': 'No content provided.'}, status=400)
except json.JSONDecodeError:
return JsonResponse({'status': 'error', 'message': 'Invalid JSON.'}, status=400)
return JsonResponse({'status': 'error', 'message': 'Invalid request method.'}, status=405)

152
static/css/custom.css Normal file
View File

@ -0,0 +1,152 @@
/*
ScamGuard Custom Stylesheet
*/
:root {
--primary-dark-blue: #0A192F;
--secondary-slate: #8892B0;
--accent-green: #64FFDA;
--background-light-navy: #0E1F3A;
--text-light-slate: #CCD6F6;
--text-dark-slate: #495670;
--card-background: #112240;
--font-family-headings: 'Poppins', sans-serif;
--font-family-body: 'Inter', sans-serif;
}
body {
background-color: var(--primary-dark-blue);
color: var(--text-light-slate);
font-family: var(--font-family-body);
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-family-headings);
color: var(--text-light-slate);
font-weight: 600;
}
/* Hero Section */
.hero-section {
display: flex;
align-items: center;
justify-content: center;
min-height: 60vh;
padding: 4rem 0;
background: linear-gradient(180deg, var(--background-light-navy) 0%, var(--primary-dark-blue) 100%);
}
.hero-title {
font-size: 3.5rem;
font-weight: 700;
color: #fff;
}
.hero-subtitle {
font-size: 1.25rem;
color: var(--secondary-slate);
max-width: 600px;
margin: 1rem auto 2rem;
}
.btn-accent {
background-color: var(--accent-green);
color: var(--primary-dark-blue);
border: none;
padding: 12px 30px;
font-weight: 700;
font-family: var(--font-family-headings);
transition: all 0.3s ease;
}
.btn-accent:hover {
background-color: #fff;
color: var(--primary-dark-blue);
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
/* Content Section */
.content-section {
padding: 4rem 0;
}
.form-container, .reports-container {
background-color: var(--card-background);
padding: 2.5rem;
border-radius: 8px;
height: 100%;
}
.form-container h2, .reports-container h2 {
margin-bottom: 0.5rem;
color: #fff;
}
.form-container p {
color: var(--secondary-slate);
margin-bottom: 1.5rem;
}
.form-control {
background-color: var(--primary-dark-blue);
border: 1px solid var(--text-dark-slate);
color: var(--text-light-slate);
padding: 0.75rem 1rem;
}
.form-control:focus {
background-color: var(--primary-dark-blue);
border-color: var(--accent-green);
color: #fff;
box-shadow: 0 0 0 0.25rem rgba(100, 255, 218, 0.25);
}
.form-control::placeholder {
color: var(--secondary-slate);
}
.btn-primary {
background-color: var(--accent-green);
border-color: var(--accent-green);
color: var(--primary-dark-blue);
padding: 10px 20px;
font-weight: 700;
transition: background-color 0.3s;
}
.btn-primary:hover {
background-color: #52d9b8;
border-color: #52d9b8;
}
/* Reports List */
.reports-container .list-group {
max-height: 400px;
overflow-y: auto;
}
.report-item {
background-color: var(--primary-dark-blue);
border: 1px solid var(--text-dark-slate);
margin-bottom: 1rem;
border-radius: 5px;
}
.report-description {
color: var(--text-light-slate);
margin-bottom: 0.5rem;
}
.report-source {
color: var(--accent-green);
font-family: monospace;
font-size: 0.9rem;
}
.report-meta {
display: block;
font-size: 0.8rem;
color: var(--secondary-slate);
margin-top: 0.5rem;
text-align: right;
}