Mercurial > prosody-modules
annotate mod_webpresence/mod_webpresence.lua @ 5472:b80b6947b079
mod_http_oauth2: Always show early errors to user
Before having validated the client_id, communicating an error back to
the client via redirect would make this an open redirect, so we may just
as well skip past that logic, and especially the warning log message.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 18 May 2023 13:43:17 +0200 |
parents | 1903add39b7c |
children |
rev | line source |
---|---|
643
28b0a8cd950a
mod_webpresence: Update to timber, remove squish hack (icons are now loaded relative to the module file)
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
1 module:depends("http"); |
28b0a8cd950a
mod_webpresence: Update to timber, remove squish hack (icons are now loaded relative to the module file)
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
2 |
4
63080b8973ee
mod_webpresence: Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 local jid_split = require "util.jid".prepped_split; |
782
2d83708ea901
mod_webpresence: fixed text notation, added html, added status message output
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
779
diff
changeset
|
4 local b64 = require "util.encodings".base64.encode; |
2d83708ea901
mod_webpresence: fixed text notation, added html, added status message output
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
779
diff
changeset
|
5 local sha1 = require "util.hashes".sha1; |
1054
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
6 local stanza = require "util.stanza".stanza; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
7 local json = require "util.json".encode_ordered; |
4
63080b8973ee
mod_webpresence: Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 |
779
36044b77b6c2
mod_webpresence: Added possibility to get status as text
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
643
diff
changeset
|
9 local function require_resource(name) |
1054
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
10 local icon_path = module:get_option_string("presence_icons", "icons"); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
11 local f, err = module:load_resource(icon_path.."/"..name); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
12 if f then |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
13 return f:read("*a"); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
14 end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
15 module:log("warn", "Failed to open image file %s", icon_path..name); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
16 return ""; |
4
63080b8973ee
mod_webpresence: Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 end |
63080b8973ee
mod_webpresence: Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 |
779
36044b77b6c2
mod_webpresence: Added possibility to get status as text
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
643
diff
changeset
|
19 local statuses = { online = {}, away = {}, xa = {}, dnd = {}, chat = {}, offline = {} }; |
4
63080b8973ee
mod_webpresence: Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 |
643
28b0a8cd950a
mod_webpresence: Update to timber, remove squish hack (icons are now loaded relative to the module file)
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
21 local function handle_request(event, path) |
1054
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
22 local status, message; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
23 local jid, type = path:match("([^/]+)/?(.*)$"); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
24 if jid then |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
25 local user, host = jid_split(jid); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
26 if host and not user then |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
27 user, host = host, event.request.headers.host; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
28 if host then host = host:gsub(":%d+$", ""); end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
29 end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
30 if user and host then |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
31 local user_sessions = hosts[host] and hosts[host].sessions[user]; |
2348
1903add39b7c
mod_webpresence: Check that top resources are set (fixes #665)
Kim Alvefur <zash@zash.se>
parents:
1495
diff
changeset
|
32 if user_sessions and user_sessions.top_resources then |
1054
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
33 status = user_sessions.top_resources[1]; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
34 if status and status.presence then |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
35 message = status.presence:child_with_name("status"); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
36 status = status.presence:child_with_name("show"); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
37 if not status then |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
38 status = "online"; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
39 else |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
40 status = status:get_text(); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
41 end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
42 if message then |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
43 message = message:get_text(); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
44 end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
45 end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
46 end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
47 end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
48 end |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
49 status = status or "offline"; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
50 |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
51 statuses[status].image = function() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
52 return { status_code = 200, headers = { content_type = "image/png" }, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
53 body = require_resource("status_"..status..".png") |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
54 }; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
55 end; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
56 statuses[status].html = function() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
57 local jid_hash = sha1(jid, true); |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
58 return { status_code = 200, headers = { content_type = "text/html" }, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
59 body = [[<!DOCTYPE html>]].. |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
60 tostring( |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
61 stanza("html") |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
62 :tag("head") |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
63 :tag("title"):text("XMPP Status Page for "..jid):up():up() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
64 :tag("body") |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
65 :tag("div", { id = jid_hash.."_status", class = "xmpp_status" }) |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
66 :tag("img", { id = jid_hash.."_img", class = "xmpp_status_image xmpp_status_"..status, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
67 src = "data:image/png;base64,"..b64(require_resource("status_"..status..".png")) }):up() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
68 :tag("span", { id = jid_hash.."_status_name", class = "xmpp_status_name" }) |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
69 :text("\194\160"..status):up() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
70 :tag("span", { id = jid_hash.."_status_message", class = "xmpp_status_message" }) |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
71 :text(message and "\194\160"..message.."" or "") |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
72 ) |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
73 }; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
74 end; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
75 statuses[status].text = function() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
76 return { status_code = 200, headers = { content_type = "text/plain" }, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
77 body = status |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
78 }; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
79 end; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
80 statuses[status].message = function() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
81 return { status_code = 200, headers = { content_type = "text/plain" }, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
82 body = (message and message or "") |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
83 }; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
84 end; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
85 statuses[status].json = function() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
86 return { status_code = 200, headers = { content_type = "application/json" }, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
87 body = json({ |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
88 jid = jid, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
89 show = status, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
90 status = (message and message or "null") |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
91 }) |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
92 }; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
93 end; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
94 statuses[status].xml = function() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
95 return { status_code = 200, headers = { content_type = "application/xml" }, |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
96 body = [[<?xml version="1.0" encoding="utf-8"?>]].. |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
97 tostring( |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
98 stanza("result") |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
99 :tag("jid"):text(jid):up() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
100 :tag("show"):text(status):up() |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
101 :tag("status"):text(message) |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
102 ) |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
103 }; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
104 end |
1495
9a1b3f0d0939
mod_webpresence: fixed render-type handling (thanks to biszkopcik and Zash)
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
1054
diff
changeset
|
105 |
9a1b3f0d0939
mod_webpresence: fixed render-type handling (thanks to biszkopcik and Zash)
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
1054
diff
changeset
|
106 if ((type == "") or (not statuses[status][type])) then |
9a1b3f0d0939
mod_webpresence: fixed render-type handling (thanks to biszkopcik and Zash)
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
1054
diff
changeset
|
107 type = "image" |
9a1b3f0d0939
mod_webpresence: fixed render-type handling (thanks to biszkopcik and Zash)
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
1054
diff
changeset
|
108 end; |
9a1b3f0d0939
mod_webpresence: fixed render-type handling (thanks to biszkopcik and Zash)
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
1054
diff
changeset
|
109 |
1054
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
110 return statuses[status][type](); |
4
63080b8973ee
mod_webpresence: Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
111 end |
63080b8973ee
mod_webpresence: Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
112 |
643
28b0a8cd950a
mod_webpresence: Update to timber, remove squish hack (icons are now loaded relative to the module file)
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
113 module:provides("http", { |
1054
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
114 default_path = "/status"; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
115 route = { |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
116 ["GET /*"] = handle_request; |
432dc4056114
mod_webpresence: added /xml and /json; Rewritten /html; A bit of refactoring;
Vadim Misbakh-Soloviov <mva@mva.name>
parents:
847
diff
changeset
|
117 }; |
643
28b0a8cd950a
mod_webpresence: Update to timber, remove squish hack (icons are now loaded relative to the module file)
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
118 }); |