Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SpoCCify Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SpoCCify
SpoCCify Backend
Commits
c29113f8
Commit
c29113f8
authored
2 years ago
by
Falk Rehse
Browse files
Options
Downloads
Patches
Plain Diff
Rename to websockets
parent
fc187764
No related branches found
No related tags found
No related merge requests found
Pipeline
#118736
failed
2 years ago
Stage: build
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+4
-4
4 additions, 4 deletions
Dockerfile
src/http.rs
+1
-1
1 addition, 1 deletion
src/http.rs
src/main.rs
+7
-7
7 additions, 7 deletions
src/main.rs
src/websockets.rs
+3
-3
3 additions, 3 deletions
src/websockets.rs
with
15 additions
and
15 deletions
Dockerfile
+
4
−
4
View file @
c29113f8
...
@@ -19,11 +19,11 @@ RUN yarn build
...
@@ -19,11 +19,11 @@ RUN yarn build
FROM
docker.io/library/alpine:latest
FROM
docker.io/library/alpine:latest
ARG
SPOCCIFY_HTTP_BIND_HOST 0.0.0.0
ENV
SPOCCIFY_HTTP_BIND_HOST 0.0.0.0
ARG
SPOCCIFY_HTTP_BIND_PORT 9000
ENV
SPOCCIFY_HTTP_BIND_PORT 9000
ARG
SPOCCIFY_WEBSOCKET_BIND_HOST 0.0.0.0
ENV
SPOCCIFY_WEBSOCKET
S
_BIND_HOST 0.0.0.0
ARG
SPOCCIFY_WEBSOCKET_BIND_PORT 9001
ENV
SPOCCIFY_WEBSOCKET
S
_BIND_PORT 9001
RUN
apk add ffmpeg yt-dlp
RUN
apk add ffmpeg yt-dlp
COPY
--from=builder-backend /usr/src/spoccify/target/release/spoccify /spoccify/spoccify
COPY
--from=builder-backend /usr/src/spoccify/target/release/spoccify /spoccify/spoccify
...
...
This diff is collapsed.
Click to expand it.
src/http.rs
+
1
−
1
View file @
c29113f8
...
@@ -10,7 +10,7 @@ use tower_http::services::ServeDir;
...
@@ -10,7 +10,7 @@ use tower_http::services::ServeDir;
// use crate::song::Song;
// use crate::song::Song;
pub
async
fn
handle_http
(
http_bind_address
:
&
str
,
/* playlist
_websocket
: &Mutable<Vec<Song>> */
)
{
pub
async
fn
handle_http
(
http_bind_address
:
&
str
,
/* playlist: &Mutable<Vec<Song>> */
)
{
println!
(
"Listening for http connections on {}!"
,
http_bind_address
);
println!
(
"Listening for http connections on {}!"
,
http_bind_address
);
async
fn
handle_404
()
->
(
StatusCode
,
&
'static
str
)
{
async
fn
handle_404
()
->
(
StatusCode
,
&
'static
str
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main.rs
+
7
−
7
View file @
c29113f8
...
@@ -4,7 +4,7 @@ mod http;
...
@@ -4,7 +4,7 @@ mod http;
mod
player
;
mod
player
;
mod
song
;
mod
song
;
mod
util
;
mod
util
;
mod
websocket
;
mod
websocket
s
;
mod
websocket_command
;
mod
websocket_command
;
use
futures_signals
::
signal
::
Mutable
;
use
futures_signals
::
signal
::
Mutable
;
...
@@ -34,17 +34,17 @@ async fn main() {
...
@@ -34,17 +34,17 @@ async fn main() {
let
client_token
=
let
client_token
=
Arc
::
new
(
env
::
var
(
"SPOCCIFY_CLIENT_TOKEN"
)
.expect
(
"No client token provided!"
));
Arc
::
new
(
env
::
var
(
"SPOCCIFY_CLIENT_TOKEN"
)
.expect
(
"No client token provided!"
));
let
websocket_bind_host
=
let
websocket
s
_bind_host
=
env
::
var
(
"SPOCCIFY_WEBSOCKET_BIND_HOST"
)
.unwrap_or
(
"127.0.0.1"
.to_owned
());
env
::
var
(
"SPOCCIFY_WEBSOCKET
S
_BIND_HOST"
)
.unwrap_or
(
"127.0.0.1"
.to_owned
());
let
websocket_bind_port
=
env
::
var
(
"SPOCCIFY_WEBSOCKET_BIND_PORT"
)
.unwrap_or
(
"9001"
.to_owned
());
let
websocket
s
_bind_port
=
env
::
var
(
"SPOCCIFY_WEBSOCKET
S
_BIND_PORT"
)
.unwrap_or
(
"9001"
.to_owned
());
let
websocket_bind_address
=
format!
(
"{}:{}"
,
websocket_bind_host
,
websocket_bind_port
);
let
websocket
s
_bind_address
=
format!
(
"{}:{}"
,
websocket
s
_bind_host
,
websocket
s
_bind_port
);
let
_websockets_task
=
tokio
::
task
::
spawn
(
async
move
{
let
_websockets_task
=
tokio
::
task
::
spawn
(
async
move
{
websocket
::
handle_websockets
(
websocket
s
::
handle_websockets
(
&
player_token
,
&
player_token
,
&
client_token
,
&
client_token
,
&
websocket_bind_address
,
&
websocket
s
_bind_address
,
&
playlist_websockets
,
&
playlist_websockets
,
)
)
.await
;
.await
;
...
...
This diff is collapsed.
Click to expand it.
src/websocket.rs
→
src/websocket
s
.rs
+
3
−
3
View file @
c29113f8
...
@@ -13,14 +13,14 @@ use crate::song::Song;
...
@@ -13,14 +13,14 @@ use crate::song::Song;
pub
async
fn
handle_websockets
(
pub
async
fn
handle_websockets
(
player_token
:
&
Arc
<
String
>
,
player_token
:
&
Arc
<
String
>
,
client_token
:
&
Arc
<
String
>
,
client_token
:
&
Arc
<
String
>
,
websocket_bind_address
:
&
str
,
websocket
s
_bind_address
:
&
str
,
playlist_websocket
:
&
Mutable
<
Vec
<
Song
>>
,
playlist_websocket
:
&
Mutable
<
Vec
<
Song
>>
,
)
{
)
{
let
server
=
TcpListener
::
bind
(
websocket_bind_address
)
.expect
(
"Failed to bind websocket port!"
);
let
server
=
TcpListener
::
bind
(
websocket
s
_bind_address
)
.expect
(
"Failed to bind websocket port!"
);
println!
(
println!
(
"Listening for websocket connections on {}!"
,
"Listening for websocket connections on {}!"
,
websocket_bind_address
websocket
s
_bind_address
);
);
for
stream
in
server
.incoming
()
{
for
stream
in
server
.incoming
()
{
...
...
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