Skip to content

Add MVP external API with Django Ninja#151

Open
Sylthionys wants to merge 4 commits intoversun:mainfrom
Sylthionys:feature/external-api
Open

Add MVP external API with Django Ninja#151
Sylthionys wants to merge 4 commits intoversun:mainfrom
Sylthionys:feature/external-api

Conversation

@Sylthionys
Copy link
Copy Markdown
Contributor

Summary

Add a small external management API for third-party integrations and fix the Windows uv run dev launcher interpreter selection.

What Changed

  • add a disabled-by-default Django Ninja API at /api/v1/
  • add Bearer token auth via EXTERNAL_API_ENABLED and EXTERNAL_API_TOKEN
  • implement MVP feed endpoints:
    • list
    • detail
    • create
    • patch
    • delete
    • refresh
  • implement MVP tag endpoints:
    • list
    • create
    • patch
    • delete
    • replace feed tag set
  • keep refresh asynchronous by queueing existing update_multiple_feeds() logic
  • hide Ninja docs and OpenAPI routes
  • switch the dev launcher to sys.executable so uv run dev uses the project interpreter on Windows

Scope Notes

  • feed create/patch only save configuration
  • refresh must be called explicitly to queue processing
  • no digest API, agent API, filter API, pagination, or frontend/admin redesign

Testing

  • added launcher regression test
  • added focused API tests for:
    • disabled-by-default behavior
    • auth success/failure
    • feed CRUD
    • duplicate conflict handling
    • tag CRUD
    • tag replacement/clear behavior
    • refresh queueing

Manual Verification

Verified locally:

  • POST /api/v1/tags -> 201
  • POST /api/v1/feeds -> 201
  • POST /api/v1/feeds/{id}/tags -> 200
  • POST /api/v1/feeds/{id}/refresh -> 202
  • GET /api/v1/feeds/{id} -> 200
  • DELETE /api/v1/feeds/{id} -> 204
  • DELETE /api/v1/tags/{id} -> 204

Verification

uv run python manage.py test core.tests.test_dev_server core.tests.test_external_api

@Sylthionys
Copy link
Copy Markdown
Contributor Author

Additional verification in Docker:

  • built a local image from this branch
  • verified the container starts successfully
  • verified Bearer-authenticated access to /api/v1/feeds
  • verified tag creation, feed creation, tag assignment, and refresh via API
  • verified refresh completed successfully and updated feed metadata (fetch_status=True, last_fetch populated, subtitle/link fetched)

Note: while testing Docker on Windows, I also found separate Docker build/runtime compatibility issues related to cron installation and CRLF line endings in shell scripts. I did not include those fixes in this PR to keep the scope focused on the external API MVP.

@versun
Copy link
Copy Markdown
Owner

versun commented Mar 19, 2026

@Sylthionys
话说pr前你有使用并测试过吗😂

@Sylthionys
Copy link
Copy Markdown
Contributor Author

@Sylthionys 公关前你有使用并测试过吗😂

跑倒是跑过,但确实覆盖得不够完整,感谢补充。🤔

@versun
Copy link
Copy Markdown
Owner

versun commented Mar 22, 2026

@Sylthionys
还有很多边缘条件没有覆盖,我实在没时间补充了,还得麻烦你帮忙多使用测试下,感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants