Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
Nextcloud Notify Push
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
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
Eduardo Trujillo
Nextcloud Notify Push
Commits
b4a4da2d
Commit
b4a4da2d
authored
4 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
remove direct url dependency for test_client
parent
e2fb0e41
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test_client/Cargo.toml
+0
-1
0 additions, 1 deletion
test_client/Cargo.toml
test_client/src/main.rs
+7
-4
7 additions, 4 deletions
test_client/src/main.rs
with
7 additions
and
5 deletions
test_client/Cargo.toml
+
0
−
1
View file @
b4a4da2d
...
...
@@ -7,5 +7,4 @@ edition = "2018"
[dependencies]
tungstenite
=
"0.11.0"
color-eyre
=
"0.5.8"
url
=
"2.2.0"
ureq
=
{
version
=
"1.5"
,
features
=
[
"json"
]
}
This diff is collapsed.
Click to expand it.
test_client/src/main.rs
+
7
−
4
View file @
b4a4da2d
use
color_eyre
::{
eyre
::
WrapErr
,
Report
,
Result
};
use
tungstenite
::
http
::
Request
;
use
tungstenite
::{
connect
,
Message
};
use
url
::
Url
;
fn
main
()
->
Result
<
()
>
{
color_eyre
::
install
()
?
;
...
...
@@ -18,8 +18,10 @@ fn main() -> Result<()> {
let
ws_url
=
get_endpoint
(
&
nc_url
,
&
username
,
&
password
)
?
;
let
(
mut
socket
,
_response
)
=
connect
(
Url
::
parse
(
&
ws_url
)
.wrap_err
(
"Invalid websocket url"
)
?
)
.wrap_err
(
"Can't connect to server"
)
?
;
let
ws_request
=
Request
::
get
(
ws_url
)
.body
(())
.wrap_err
(
"Invalid websocket url"
)
?
;
let
(
mut
socket
,
_response
)
=
connect
(
ws_request
)
.wrap_err
(
"Can't connect to server"
)
?
;
socket
.write_message
(
Message
::
Text
(
username
))
...
...
@@ -50,7 +52,8 @@ fn get_endpoint(nc_url: &str, user: &str, password: &str) -> Result<String> {
.set
(
"Accept"
,
"application/json"
)
.set
(
"OCS-APIREQUEST"
,
"true"
)
.call
()
.into_json
()
?
;
.into_json
()
.wrap_err
(
"Failed to decode json capabilities response"
)
?
;
Ok
(
json
[
"ocs"
][
"data"
][
"capabilities"
][
"notify_push"
][
"endpoints"
][
"websocket"
]
.as_str
()
...
...
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