This allows an OAuth client to get metadata about the auth server, i.e.
the frappe bench being used as an OAuth2 auth server.
Metadata includes values for auth server urls and endpoints and
supported types and modes.
* perf: chain transactions
Frequently used rollback/commits can be modified to chain previous
transaction.
This reduces one query to DB in most requests.
* perf: chain transactions in requests
* fix: update instead of extend
None of these are supposed to be extended over defaults.
* feat: custom response header support
* refactor: use response_headers to set cache control headers
* feat: Decorator to cache API response using cache-control headers
* perf: cache notifications for 1 minute
+ SWR for 5 minutes
* perf: cache `get_events` on desk load
* perf: slow down auto-refresh even more
once every 5 seconds instead of 2 seconds.
* perf: Cache plain link validation for 30 minutes
Very often you're picking same documents again and again, there's no
need to validate them.
Also, document is JUST selected using search_link, so it's 99%
guaranteed to be valid.
The real purpose of this function is to provide "fetch from" feature,
not link validation like the name suggests.
It will get validated server side anyway.
* fix: Never use HTTP cache in developer mode
* perf: cache "is_document_amended"
A document that is amended from something stays amended.
* perf: proxy-cache website_script.js
* fix: only cache if called directly
* fix: remove whitespace in restrict ip in validate
* fix: added check for request_ip
* fix: return if no restrict ip
* fix: set to localhost if none, refactor validate_ip_addr
* fix: validate ip_address cleanup and removed uncessary comments
* fix: validate ip_addr cleanup
* fix: remove unecessary check
* perf: add cache-control headers on private files
- Client(browser) side cache
- 1 hr expiry
- 1 day revalidation
- etagged by nginx in default config (so no data transfer on expiry still)
In conjunction with https://github.com/frappe/agent/pull/157
* fix: Don't override existing headers
Developers can easily enable `can_cache` without knowing what it
entails. Public cache means proxy can likely cache things without
talking to backend.
Obviously many endpoints which can be cached on client side should
probably not be cached in proxy.
E.g. linked PR to the PR that added this feature suggest caching
notification log for short time... we don't want to leak one user's
cached notification to another user.
I don't buy that developers should know about cache implementation to
ensure it's secure or correct to enable it on certain endpoint. In
addition to that, we have very few mechanisms to burst cache
inside proxy. End user hitting ctrl+shift+r won't do anything if proxy
wants to serve stale response.
We should figure out better way to instruct FW about final cache
control headers than hardcoding it IMO.
* feat: Add deprecation_dumpster.py file
* docs: add jovial and jocose docstring for frappe/deprecation_dumpster.py
* refactor: fill the dumpster with its own kind
* refactor: move to the deprecation dumpster
* chore: color coding class
* fix: only check import error when import errors
num2words - 260KB - Used frequently on ERPNext sites.
babel - 1.1MB Gets imported because of dates, localization
sentry - 2.8MB should be loaded only if envvar is set
gettext - required for reading translations
- There is code that depends on "commit", everything that happens with `db.after_commit`.
- There are operations that will not write anything to DB but just
enqueue the function, if it's enqueue_after_commit then it will break.
There can be external APIs like webhooks that only send array request,
in which case Frappe has no mechanism to accept such requests.
After this PR such request data can be accessed using `data` list
argument on function.
I've considered directly storing list in form_dict but it's not
feasible:
1. It breaks semantics, "form_dict" can't be a list. That ship has long
sailed.
2. Way too much code expects form_dict to be a dict.
- better boot config name
- send sentry after - because frappe namespce doesn't exist if it starts
first
- remove import in app.py because __init__ is always imported so no
need.
- leave telemetry JS always present, this is used even when telemetry is
not enabled.
Inspired primarily from sentry's generic WSGI integration
Environment variable `FRAPPE_SENTRY_DSN` needs to be enabled as well
as explicit opt-in from the user's side in system sid telemetry
settings
Conditionally include telemetry JS bundles
Signed-off-by: Akhil Narang <me@akhilnarang.dev>