Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hiboo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
frju365
Hiboo
Commits
2a2caf19
Commit
2a2caf19
authored
5 years ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Add a podop API for resolving emails
parent
0cdb11ae
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
hiboo/__init__.py
+2
-1
2 additions, 1 deletion
hiboo/__init__.py
hiboo/api/__init__.py
+6
-0
6 additions, 0 deletions
hiboo/api/__init__.py
hiboo/api/views.py
+19
-0
19 additions, 0 deletions
hiboo/api/views.py
hiboo/configuration.py
+1
-0
1 addition, 0 deletions
hiboo/configuration.py
with
28 additions
and
1 deletion
hiboo/__init__.py
+
2
−
1
View file @
2a2caf19
...
...
@@ -32,12 +32,13 @@ def create_app_from_config(config):
return
dict
(
config
=
app
.
config
,
utils
=
utils
)
# Import views
from
hiboo
import
account
,
user
,
profile
,
service
,
sso
from
hiboo
import
account
,
user
,
profile
,
service
,
sso
,
api
app
.
register_blueprint
(
account
.
blueprint
,
url_prefix
=
'
/account
'
)
app
.
register_blueprint
(
user
.
blueprint
,
url_prefix
=
'
/user
'
)
app
.
register_blueprint
(
profile
.
blueprint
,
url_prefix
=
'
/profile
'
)
app
.
register_blueprint
(
service
.
blueprint
,
url_prefix
=
'
/service
'
)
app
.
register_blueprint
(
sso
.
blueprint
,
url_prefix
=
'
/sso
'
)
app
.
register_blueprint
(
api
.
blueprint
,
url_prefix
=
'
/api
'
)
@app.route
(
"
/
"
)
def
index
():
...
...
This diff is collapsed.
Click to expand it.
hiboo/api/__init__.py
0 → 100644
+
6
−
0
View file @
2a2caf19
import
flask
blueprint
=
flask
.
Blueprint
(
"
api
"
,
__name__
,
template_folder
=
"
templates
"
)
from
hiboo.api
import
views
This diff is collapsed.
Click to expand it.
hiboo/api/views.py
0 → 100644
+
19
−
0
View file @
2a2caf19
from
hiboo
import
models
,
utils
,
security
from
hiboo.api
import
blueprint
import
flask
@blueprint.route
(
"
/mail/resolve/<email>
"
)
def
resolve_mail
(
email
):
"""
This API endpoint behaves as a podop/postfis alias map
"""
flask
.
request
.
args
[
"
token
"
]
==
flask
.
current_app
.
config
[
"
PODOP_API_TOKEN
"
]
or
flask
.
abort
(
403
)
localpart
,
domain
=
email
.
split
(
"
@
"
,
1
)
if
domain
!=
flask
.
current_app
.
config
[
"
MAIL_DOMAIN
"
]:
flask
.
abort
(
404
)
user
=
models
.
User
.
query
.
filter_by
(
uuid
=
localpart
).
first
()
or
flask
.
abort
(
404
)
if
"
email
"
in
user
.
contact
:
return
flask
.
jsonify
(
user
.
contact
[
"
email
"
])
else
:
flask
.
abort
(
404
)
This diff is collapsed.
Click to expand it.
hiboo/configuration.py
+
1
−
0
View file @
2a2caf19
...
...
@@ -14,6 +14,7 @@ DEFAULT_CONFIG = {
'
TEMPLATES_AUTO_RELOAD
'
:
False
,
'
MAIL_DOMAIN
'
:
'
tedomum.net
'
,
'
WEBSITE_NAME
'
:
'
Hiboo
'
,
'
PODOP_API_TOKEN
'
:
'
changeMe
'
}
class
ConfigManager
(
dict
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment