forked from retoor/devplacepy
feat: add push notification infrastructure with VAPID key generation and PWA manifest support
- Introduce push notification module with VAPID certificate generation, Web Push encryption, and subscription management - Add push registration table index and database schema for storing user subscriptions - Integrate push notification dispatch into existing notification creation flow via async background tasks - Include PWA manifest, service worker, and install prompt UI elements in base template - Register new push router and ensure certificate initialization on application startup - Add configuration variables for VAPID private/public key file paths and subscription contact email - Update JavaScript application entry point with PushManager and PwaInstaller modules - Extend top navigation bar with hidden install and push enable buttons for authenticated users
This commit is contained in:
+4
-1
@@ -12,7 +12,7 @@ from devplacepy.database import init_db, get_table, db, get_users_by_uids, get_c
|
||||
from devplacepy.templating import templates
|
||||
from devplacepy.utils import get_current_user, time_ago
|
||||
from devplacepy.seo import base_seo_context, site_url, website_schema
|
||||
from devplacepy.routers import auth, feed, posts, comments, projects, profile, messages, notifications, votes, avatar, follow, admin, seo, bugs, news, gists, services as services_router, uploads
|
||||
from devplacepy.routers import auth, feed, posts, comments, projects, profile, messages, notifications, votes, avatar, follow, admin, seo, bugs, news, gists, services as services_router, uploads, push
|
||||
from devplacepy.services.manager import service_manager
|
||||
from devplacepy.services.news import NewsService
|
||||
|
||||
@@ -108,6 +108,7 @@ app.include_router(avatar.router, prefix="/avatar")
|
||||
app.include_router(follow.router, prefix="/follow")
|
||||
app.include_router(admin.router, prefix="/admin")
|
||||
app.include_router(seo.router)
|
||||
app.include_router(push.router)
|
||||
app.include_router(bugs.router, prefix="/bugs")
|
||||
app.include_router(gists.router, prefix="/gists")
|
||||
app.include_router(news.router, prefix="/news")
|
||||
@@ -140,6 +141,8 @@ async def rate_limit_middleware(request: Request, call_next):
|
||||
@app.on_event("startup")
|
||||
async def startup():
|
||||
init_db()
|
||||
from devplacepy.push import ensure_certificates
|
||||
ensure_certificates()
|
||||
if not os.environ.get("DEVPLACE_DISABLE_SERVICES"):
|
||||
news_service = NewsService()
|
||||
service_manager.register(news_service)
|
||||
|
||||
Reference in New Issue
Block a user