Mercurial > prosody-modules
annotate mod_http_libjs/mod_http_libjs.lua @ 5646:d67980d9e12d
mod_http_oauth2: Apply refresh token ttl to refresh token instead of grant
The intent in 59d5fc50f602 was for refresh tokens to extend the lifetime
of the grant, but the refresh token ttl was applied to the grant and
mod_tokenauth does not change it, leading to the grant expiring
regardless of refresh token usage.
This makes grant lifetimes unlimited, which seems to be standard
practice in the wild.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 11 Sep 2023 10:48:31 +0200 |
parents | 75b6e5df65f9 |
children |
rev | line source |
---|---|
4087
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local mime_map = module:shared("/*/http_files/mime").types or { |
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 css = "text/css", |
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 js = "application/javascript", |
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 }; |
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 |
4095
de2390d6bbe4
mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents:
4087
diff
changeset
|
6 local serve; |
4976
75b6e5df65f9
various: Improve error reporting if missing file server module on 0.12
Kim Alvefur <zash@zash.se>
parents:
4604
diff
changeset
|
7 if prosody.process_type == "prosody" then |
4095
de2390d6bbe4
mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents:
4087
diff
changeset
|
8 local http_files = require "net.http.files"; |
de2390d6bbe4
mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents:
4087
diff
changeset
|
9 serve = http_files.serve; |
4976
75b6e5df65f9
various: Improve error reporting if missing file server module on 0.12
Kim Alvefur <zash@zash.se>
parents:
4604
diff
changeset
|
10 else |
4095
de2390d6bbe4
mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents:
4087
diff
changeset
|
11 serve = module:depends"http_files".serve; |
de2390d6bbe4
mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents:
4087
diff
changeset
|
12 end |
de2390d6bbe4
mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents:
4087
diff
changeset
|
13 |
4087
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 local libjs_path = module:get_option_string("libjs_path", "/usr/share/javascript"); |
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 |
4604
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
16 do -- sanity check |
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
17 local lfs = require "lfs"; |
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
18 |
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
19 local exists, err = lfs.attributes(libjs_path, "mode"); |
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
20 if exists ~= "directory" then |
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
21 module:log("error", "Problem with 'libjs_path': %s", err or "not a directory"); |
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
22 end |
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
23 end |
f0efbb0b0b5b
mod_http_libjs: Check that the path to serve exists
Kim Alvefur <zash@zash.se>
parents:
4095
diff
changeset
|
24 |
4087
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 module:provides("http", { |
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 default_path = "/share"; |
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 route = { |
4095
de2390d6bbe4
mod_http_libjs: Add compatibility with Prosody 0.11.x
Matthew Wild <mwild1@gmail.com>
parents:
4087
diff
changeset
|
28 ["GET /*"] = serve({ path = libjs_path, mime_map = mime_map }); |
4087
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 } |
88a469b285f5
mod_http_libjs: New module to serve common CSS/Javascript libraries
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 }); |