Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sfphoton-web-plugin-dyndns
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Schulcz Ferenc
sfphoton-web-plugin-dyndns
Commits
2d4a1f50
Commit
2d4a1f50
authored
2 months ago
by
Ferenc Schulcz
Browse files
Options
Downloads
Patches
Plain Diff
Fix API endpoints
parent
3657ad76
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dyndns.py
+4
-4
4 additions, 4 deletions
dyndns.py
with
4 additions
and
4 deletions
dyndns.py
+
4
−
4
View file @
2d4a1f50
...
...
@@ -45,9 +45,9 @@ async def sendRequest(session, url, urlparams):
print
(
f
"
Could not reach
{
url
}
:
{
e
}
"
)
return
(
url
,
600
)
async
def
sendAllRequests
(
urls
,
urlparams
):
async
def
sendAllRequests
(
hosts
,
endpoint
,
urlparams
):
async
with
aiohttp
.
ClientSession
()
as
session
:
requests
=
[
sendRequest
(
session
,
url
,
urlparams
)
for
url
in
url
s
]
requests
=
[
sendRequest
(
session
,
host
+
endpoint
,
urlparams
)
for
host
in
host
s
]
return
await
asyncio
.
gather
(
*
requests
)
def
dyndnsRegister
(
**
kwargs
):
...
...
@@ -66,7 +66,7 @@ def dyndnsRegister(**kwargs):
return
rqtools
.
redirect
(
rqtools
.
url_for
(
'
service
'
,
servicename
=
'
dyndns
'
))
tokenseed
=
str
(
random
.
randint
(
1
,
2
**
32
))
+
str
(
random
.
randint
(
1
,
2
**
32
))
domain
=
request
.
form
[
'
domainname
'
]
registrationStatuses
=
asyncio
.
run
(
sendAllRequests
(
config
.
get
(
'
DYNDNS_SERVER_URLS
'
),
{
'
domain
'
:
domain
,
'
tokenseed
'
:
tokenseed
}))
registrationStatuses
=
asyncio
.
run
(
sendAllRequests
(
config
.
get
(
'
DYNDNS_SERVER_URLS
'
),
'
/register
'
,
{
'
domain
'
:
domain
,
'
tokenseed
'
:
tokenseed
}))
allFail
=
True
allSuccess
=
True
for
s
in
registrationStatuses
:
...
...
@@ -101,7 +101,7 @@ def dyndnsUpdate(**kwargs):
x
=
db
.
db
[
'
dyndns-records
'
].
find_one
({
'
token
'
:
request
.
args
[
'
token
'
]})
if
x
[
'
ip
'
]
==
ip
:
return
{
'
message
'
:
'
Already set.
'
},
200
updateStatuses
=
asyncio
.
run
(
sendAllRequests
(
config
.
get
(
'
DYNDNS_SERVER_URLS
'
),
{
'
token
'
:
request
.
args
[
'
token
'
],
'
ip
'
:
ip
}))
updateStatuses
=
asyncio
.
run
(
sendAllRequests
(
config
.
get
(
'
DYNDNS_SERVER_URLS
'
),
'
/update
'
,
{
'
token
'
:
request
.
args
[
'
token
'
],
'
ip
'
:
ip
}))
allFail
=
True
allSuccess
=
True
for
s
in
updateStatuses
:
...
...
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