Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
0ab43ef4
Commit
0ab43ef4
authored
Jun 21, 2014
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
have webfinger output a JSON file in STORAGE_ROOT/webfinger/(acct/..)
parent
326cc2a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
3 deletions
+38
-3
web.sh
setup/web.sh
+2
-0
webfinger.php
tools/webfinger.php
+36
-3
No files found.
setup/web.sh
View file @
0ab43ef4
...
...
@@ -34,6 +34,8 @@ update-rc.d php-fastcgi defaults
# Put our webfinger server script into a well-known location.
cp
tools/webfinger.php /usr/local/bin/mailinabox-webfinger.php
chown
www-data.www-data /usr/local/bin/mailinabox-webfinger.php
mkdir
-p
$STORAGE_ROOT
/webfinger/acct
;
chown
-R
$STORAGE_USER
$STORAGE_ROOT
/webfinger
# Start services.
service nginx restart
...
...
tools/webfinger.php
View file @
0ab43ef4
<?php
$resource
=
$_GET
[
'resource'
];
// Parse our configuration file to get the STORAGE_ROOT.
$STORAGE_ROOT
=
NULL
;
foreach
(
file
(
"/etc/mailinabox.conf"
)
as
$line
)
{
$line
=
explode
(
"="
,
rtrim
(
$line
),
2
);
if
(
$line
[
0
]
==
"STORAGE_ROOT"
)
{
$STORAGE_ROOT
=
$line
[
1
];
}
}
if
(
$STORAGE_ROOT
==
NULL
)
exit
(
"no STORAGE_ROOT"
);
// Turn the resource into a file path. First URL-encode the resource
// so that it is filepath-safe.
$fn
=
urlencode
(
$resource
);
// Replace the first colon (it's URL-encoded) with a slash since we'll
// break off the files into scheme subdirectories.
$fn
=
preg_replace
(
"/%3A/"
,
"/"
,
$fn
,
1
);
// Since this is often for email addresses, un-escape @-signs so they
// are not odd-looking. It's filename-safe anyway.
$fn
=
preg_replace
(
"/%40/"
,
"@"
,
$fn
);
// Combine with root path.
$fn
=
$STORAGE_ROOT
.
"/webfinger/"
.
$fn
.
".json"
;
// See if the file exists.
if
(
!
file_exists
(
$fn
))
{
header
(
"HTTP/1.0 404 Not Found"
);
exit
;
}
header
(
"Content-type: application/json"
);
echo
json_encode
(
array
(
subject
=>
$resource
,
),
JSON_PRETTY_PRINT
);
echo
file_get_contents
(
$fn
);
//json_encode(array(
// subject => $resource,
//), JSON_PRETTY_PRINT);
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment