diff --git a/LICENSE.txt b/LICENSE.txt index 08bc850..4d96b5f 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -18,4 +18,31 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. + +--- + +Substantial portions of spiderweb/middleware/cors.py and docs/middleware/cors.md +are from django-cors-headers and are subject to the following license: + +MIT License + +Copyright (c) 2017 Otto Yiu (https://ottoyiu.com) and other contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 31b9039..5c3944d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,22 @@ # spiderweb +
+ + + + + +
+ As a professional web developer focusing on arcane uses of Django for arcane purposes, it occurred to me a little while ago that I didn't actually know how a web framework _worked_. So I built one. diff --git a/docs/README.md b/docs/README.md index b5ffbd8..e2c6eb4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,13 +8,15 @@ This is `spiderweb`, a WSGI-compatible web framework that's just big enough to h - Learn a lot - Create an unholy blend of Django and Flask -- Not look at any existing code. Go off of vibes alone and try to solve all the problems I could think of in my own way +- Not look at any existing code[^1]. Go off of vibes alone and try to solve all the problems I could think of in my own way > [!WARNING] > This is a learning project. It should not be used for production without heavy auditing. It's not secure. It's not fast. It's not well-tested. It's not well-documented. It's not well-anything. It's a learning project. > > That being said, it's fun and it works, so I'm counting that as a win. +> [!TIP|style:flat] +> To jump in with both feet, [head over to the quickstart!](quickstart.md) ## Design & Usage Decisions @@ -90,6 +92,7 @@ Simply having these declared in a place that Django can find them is enough, and Spiderweb takes a middle ground approach: it allows you to declare framework-first arguments on the SpiderwebRouter object, and if you need to pass along other data to other parts of the system (like custom middleware), you can do so by passing in any keyword argument you'd like to the constructor. ```python +from spiderweb import SpiderwebRouter from peewee import SqliteDatabase app = SpiderwebRouter( @@ -112,7 +115,6 @@ Here's a non-exhaustive list of things this can do: - URLs with variables in them a lá Django - Full middleware implementation - Limit routes by HTTP verbs - - (Only GET and POST are implemented right now) - Custom error routes - Built-in dev server - Gunicorn support @@ -120,13 +122,11 @@ Here's a non-exhaustive list of things this can do: - Static files support - Cookies (reading and setting) - Optional append_slash (with automatic redirects!) -- ~~CSRF middleware implementation~~ (it's there, but it's crappy and unsafe. This might be beyond my skillset.) +- CSRF middleware +- CORS middleware - Optional POST data validation middleware with Pydantic -- Database support (using Peewee, but you can use whatever you want as long as there's a Peewee driver for it) - Session middleware with built-in session store +- Database support (using Peewee, but you can use whatever you want as long as there's a Peewee driver for it) - Tests (currently a little over 80% coverage) -## What's left to build? - -- Fix CSRF middleware -- Add more HTTP verbs +[^1]: I mostly succeeded. The way that I'm approaching this is that I did my level best, then looked at (and copied) existing solutions where necessary. At the time of this writing, I did all of it solo except for the CORS middleware. [Read more about it here.](middleware/cors.md) \ No newline at end of file diff --git a/docs/_coverpage.md b/docs/_coverpage.md index dba531e..d2247e6 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -3,7 +3,7 @@ > the web framework just big enough for a spider [GitHub](https://github.com/itsthejoker/spiderweb/) -[Get Started](#spiderweb) +[Get Started](/README) ![color](#222) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index ce8cf8b..82a8fe0 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -5,5 +5,6 @@ - [overview](middleware/overview.md) - [session](middleware/sessions.md) - [csrf](middleware/csrf.md) + - [cors](middleware/cors.md) - [pydantic](middleware/pydantic.md) - [writing your own](middleware/custom_middleware.md) diff --git a/docs/example.md b/docs/example.md index b1289fd..4ae00c0 100644 --- a/docs/example.md +++ b/docs/example.md @@ -9,4 +9,11 @@ > An alert of type 'warning' using global style 'callout'. > [!NOTE] -> An alert of type 'note' using global style 'callout'. \ No newline at end of file +> An alert of type 'note' using global style 'callout'. + +> [!TIP|style:flat|label:My own heading|iconVisibility:hidden] +> An alert of type 'tip' using alert specific style 'flat' which overrides global style 'callout'. +> In addition, this alert uses an own heading and hides specific icon. + +> [!NOTE|icon:fa-solid fa-notes] +> A custom icon! \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 1464fc9..ce73306 100644 --- a/docs/index.html +++ b/docs/index.html @@ -48,6 +48,7 @@ + @@ -57,5 +58,11 @@ + + + + + +