include public in assets

This commit is contained in:
jb-alvarado 2022-07-25 17:26:49 +02:00
parent 2584051e1b
commit 088bce28d4
10 changed files with 96 additions and 90 deletions

View File

@ -3,7 +3,7 @@ Description=Rest API for ffplayout
After=network.target remote-fs.target
[Service]
ExecStart=/usr/bin/ffpapi -l 0.0.0.0:8000
ExecStart=/usr/bin/ffpapi -l 0.0.0.0:8787
Restart=always
RestartSec=1
User=ffpu

7
debian/postinst vendored
View File

@ -16,6 +16,8 @@ if [ ! -d "/usr/share/ffplayout/db" ]; then
chown -R ${sysUser}. "/usr/share/ffplayout"
chown -R ${sysUser}. "/var/lib/ffplayout"
chown -R ${sysUser}. "/etc/ffplayout"
ln -s "/var/lib/ffplayout/tv-media" "/usr/share/ffplayout/public/"
fi
if [ ! -d "/var/log/ffplayout" ]; then
@ -23,8 +25,3 @@ if [ ! -d "/var/log/ffplayout" ]; then
chown ${sysUser}. "/var/log/ffplayout"
fi
tar xf "/usr/share/ffplayout/public.tar.gz" --overwrite -C "/usr/share/ffplayout/"
ln -s "/var/lib/ffplayout/tv-media" "/usr/share/ffplayout/public/"
chown -R ${sysUser}. "/usr/share/ffplayout/public"
yes | rm "/usr/share/ffplayout/public.tar.gz"

View File

@ -3,7 +3,7 @@
Run the API thru the systemd service, or like:
```BASH
ffpapi -l 127.0.0.1:8000
ffpapi -l 127.0.0.1:8787
```
For all endpoints an (Bearer) authentication is required.\
@ -14,7 +14,7 @@ For all endpoints an (Bearer) authentication is required.\
**Login**
```BASH
curl -X POST http://127.0.0.1:8000/auth/login/ -H "Content-Type: application/json" \
curl -X POST http://127.0.0.1:8787/auth/login/ -H "Content-Type: application/json" \
-d '{ "username": "<USER>", "password": "<PASS>" }'
```
**Response:**
@ -34,21 +34,21 @@ From here on all request **must** contain the authorization header:\
**Get current User**
```BASH
curl -X GET 'http://localhost:8000/api/user' -H 'Content-Type: application/json' \
curl -X GET 'http://127.0.0.1:8787/api/user' -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <TOKEN>'
```
**Update current User**
```BASH
curl -X PUT http://localhost:8000/api/user/1 -H 'Content-Type: application/json' \
curl -X PUT http://127.0.0.1:8787/api/user/1 -H 'Content-Type: application/json' \
-d '{"mail": "<MAIL>", "password": "<PASS>"}' -H 'Authorization: <TOKEN>'
```
**Add User**
```BASH
curl -X POST 'http://localhost:8000/api/user/' -H 'Content-Type: application/json' \
curl -X POST 'http://127.0.0.1:8787/api/user/' -H 'Content-Type: application/json' \
-d '{"mail": "<MAIL>", "username": "<USER>", "password": "<PASS>", "role_id": 1, "channel_id": 1}' \
-H 'Authorization: Bearer <TOKEN>'
```
@ -58,7 +58,7 @@ curl -X POST 'http://localhost:8000/api/user/' -H 'Content-Type: application/jso
**Get Settings from Channel**
```BASH
curl -X GET http://127.0.0.1:8000/api/channel/1 -H "Authorization: Bearer <TOKEN>"
curl -X GET http://127.0.0.1:8787/api/channel/1 -H "Authorization: Bearer <TOKEN>"
```
**Response:**
@ -78,13 +78,13 @@ curl -X GET http://127.0.0.1:8000/api/channel/1 -H "Authorization: Bearer <TOKEN
**Get settings from all Channels**
```BASH
curl -X GET http://127.0.0.1:8000/api/channels -H "Authorization: Bearer <TOKEN>"
curl -X GET http://127.0.0.1:8787/api/channels -H "Authorization: Bearer <TOKEN>"
```
**Update Channel**
```BASH
curl -X PATCH http://127.0.0.1:8000/api/channel/1 -H "Content-Type: application/json" \
curl -X PATCH http://127.0.0.1:8787/api/channel/1 -H "Content-Type: application/json" \
-d '{ "id": 1, "name": "Channel 1", "preview_url": "http://localhost/live/stream.m3u8", \
"config_path": "/etc/ffplayout/ffplayout.yml", "extra_extensions": "jpg,jpeg,png", "timezone": "Europe/Berlin"}' \
-H "Authorization: Bearer <TOKEN>"
@ -93,7 +93,7 @@ curl -X PATCH http://127.0.0.1:8000/api/channel/1 -H "Content-Type: application/
**Create new Channel**
```BASH
curl -X POST http://127.0.0.1:8000/api/channel/ -H "Content-Type: application/json" \
curl -X POST http://127.0.0.1:8787/api/channel/ -H "Content-Type: application/json" \
-d '{ "name": "Channel 2", "preview_url": "http://localhost/live/channel2.m3u8", \
"config_path": "/etc/ffplayout/channel2.yml", "extra_extensions": "jpg,jpeg,png",
"timezone": "Europe/Berlin", "service": "ffplayout@channel2.service" }' \
@ -103,7 +103,7 @@ curl -X POST http://127.0.0.1:8000/api/channel/ -H "Content-Type: application/js
**Delete Channel**
```BASH
curl -X DELETE http://127.0.0.1:8000/api/channel/2 -H "Authorization: Bearer <TOKEN>"
curl -X DELETE http://127.0.0.1:8787/api/channel/2 -H "Authorization: Bearer <TOKEN>"
```
#### ffplayout Config
@ -111,7 +111,7 @@ curl -X DELETE http://127.0.0.1:8000/api/channel/2 -H "Authorization: Bearer <TO
**Get Config**
```BASH
curl -X GET http://localhost:8000/api/playout/config/1 -H 'Authorization: <TOKEN>'
curl -X GET http://127.0.0.1:8787/api/playout/config/1 -H 'Authorization: <TOKEN>'
```
Response is a JSON object from the ffplayout.yml
@ -119,7 +119,7 @@ Response is a JSON object from the ffplayout.yml
**Update Config**
```BASH
curl -X PUT http://localhost:8000/api/playout/config/1 -H "Content-Type: application/json" \
curl -X PUT http://127.0.0.1:8787/api/playout/config/1 -H "Content-Type: application/json" \
-d { <CONFIG DATA> } -H 'Authorization: <TOKEN>'
```
@ -130,14 +130,14 @@ Text presets are made for sending text messages to the ffplayout engine, to over
**Get all Presets**
```BASH
curl -X GET http://localhost:8000/api/presets/ -H 'Content-Type: application/json' \
curl -X GET http://127.0.0.1:8787/api/presets/ -H 'Content-Type: application/json' \
-H 'Authorization: <TOKEN>'
```
**Update Preset**
```BASH
curl -X PUT http://localhost:8000/api/presets/1 -H 'Content-Type: application/json' \
curl -X PUT http://127.0.0.1:8787/api/presets/1 -H 'Content-Type: application/json' \
-d '{ "name": "<PRESET NAME>", "text": "<TEXT>", "x": "<X>", "y": "<Y>", "fontsize": 24, \
"line_spacing": 4, "fontcolor": "#ffffff", "box": 1, "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0, "channel_id": 1 }' \
-H 'Authorization: <TOKEN>'
@ -146,7 +146,7 @@ curl -X PUT http://localhost:8000/api/presets/1 -H 'Content-Type: application/js
**Add new Preset**
```BASH
curl -X POST http://localhost:8000/api/presets/ -H 'Content-Type: application/json' \
curl -X POST http://127.0.0.1:8787/api/presets/ -H 'Content-Type: application/json' \
-d '{ "name": "<PRESET NAME>", "text": "TEXT>", "x": "<X>", "y": "<Y>", "fontsize": 24, \
"line_spacing": 4, "fontcolor": "#ffffff", "box": 1, "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0, "channel_id": 1 }' \
-H 'Authorization: <TOKEN>'
@ -155,7 +155,7 @@ curl -X POST http://localhost:8000/api/presets/ -H 'Content-Type: application/js
**Delete Preset**
```BASH
curl -X DELETE http://localhost:8000/api/presets/1 -H 'Content-Type: application/json' \
curl -X DELETE http://127.0.0.1:8787/api/presets/1 -H 'Content-Type: application/json' \
-H 'Authorization: <TOKEN>'
```
@ -170,7 +170,7 @@ here we communicate with the engine for:
**Send Text to ffplayout**
```BASH
curl -X POST http://localhost:8000/api/control/1/text/ \
curl -X POST http://127.0.0.1:8787/api/control/1/text/ \
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>' \
-d '{"text": "Hello from ffplayout", "x": "(w-text_w)/2", "y": "(h-text_h)/2", \
"fontsize": "24", "line_spacing": "4", "fontcolor": "#ffffff", "box": "1", \
@ -184,14 +184,14 @@ curl -X POST http://localhost:8000/api/control/1/text/ \
- reset
```BASH
curl -X POST http://localhost:8000/api/control/1/playout/next/ -H 'Content-Type: application/json'
curl -X POST http://127.0.0.1:8787/api/control/1/playout/next/ -H 'Content-Type: application/json'
-d '{ "command": "reset" }' -H 'Authorization: <TOKEN>'
```
**Get current Clip**
```BASH
curl -X GET http://localhost:8000/api/control/1/media/current
curl -X GET http://127.0.0.1:8787/api/control/1/media/current
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
```
@ -222,13 +222,13 @@ curl -X GET http://localhost:8000/api/control/1/media/current
**Get next Clip**
```BASH
curl -X GET http://localhost:8000/api/control/1/media/next/ -H 'Authorization: <TOKEN>'
curl -X GET http://127.0.0.1:8787/api/control/1/media/next/ -H 'Authorization: <TOKEN>'
```
**Get last Clip**
```BASH
curl -X GET http://localhost:8000/api/control/1/media/last/
curl -X GET http://127.0.0.1:8787/api/control/1/media/last/
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
```
@ -241,7 +241,7 @@ Control ffplayout process, like:
- status
```BASH
curl -X POST http://localhost:8000/api/control/1/process/
curl -X POST http://127.0.0.1:8787/api/control/1/process/
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
-d '{"command": "start"}'
```
@ -251,14 +251,14 @@ curl -X POST http://localhost:8000/api/control/1/process/
**Get playlist**
```BASH
curl -X GET http://localhost:8000/api/playlist/1?date=2022-06-20
curl -X GET http://127.0.0.1:8787/api/playlist/1?date=2022-06-20
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
```
**Save playlist**
```BASH
curl -X POST http://localhost:8000/api/playlist/1/
curl -X POST http://127.0.0.1:8787/api/playlist/1/
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
-- data "{<JSON playlist data>}"
```
@ -268,14 +268,14 @@ curl -X POST http://localhost:8000/api/playlist/1/
A new playlist will be generated and response.
```BASH
curl -X GET http://localhost:8000/api/playlist/1/generate/2022-06-20
curl -X GET http://127.0.0.1:8787/api/playlist/1/generate/2022-06-20
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
```
**Delete Playlist**
```BASH
curl -X DELETE http://localhost:8000/api/playlist/1/2022-06-20
curl -X DELETE http://127.0.0.1:8787/api/playlist/1/2022-06-20
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
```
@ -284,7 +284,7 @@ curl -X DELETE http://localhost:8000/api/playlist/1/2022-06-20
**Read Log Life**
```BASH
curl -X Get http://localhost:8000/api/log/1
curl -X Get http://127.0.0.1:8787/api/log/1
-H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
```
@ -293,34 +293,34 @@ curl -X Get http://localhost:8000/api/log/1
**Get File/Folder List**
```BASH
curl -X POST http://localhost:8000/api/file/1/browse/ -H 'Content-Type: application/json'
curl -X POST http://127.0.0.1:8787/api/file/1/browse/ -H 'Content-Type: application/json'
-d '{ "source": "/" }' -H 'Authorization: <TOKEN>'
```
**Create Folder**
```BASH
curl -X POST http://localhost:8000/api/file/1/create-folder/ -H 'Content-Type: application/json'
curl -X POST http://127.0.0.1:8787/api/file/1/create-folder/ -H 'Content-Type: application/json'
-d '{"source": "<FOLDER PATH>"}' -H 'Authorization: <TOKEN>'
```
**Rename File**
```BASH
curl -X POST http://localhost:8000/api/file/1/rename/ -H 'Content-Type: application/json'
curl -X POST http://127.0.0.1:8787/api/file/1/rename/ -H 'Content-Type: application/json'
-d '{"source": "<SOURCE>", "target": "<TARGET>"}' -H 'Authorization: <TOKEN>'
```
**Remove File/Folder**
```BASH
curl -X POST http://localhost:8000/api/file/1/remove/ -H 'Content-Type: application/json'
curl -X POST http://127.0.0.1:8787/api/file/1/remove/ -H 'Content-Type: application/json'
-d '{"source": "<SOURCE>"}' -H 'Authorization: <TOKEN>'
```
**Upload File**
```BASH
curl -X POST http://localhost:8000/api/file/1/upload/ -H 'Authorization: <TOKEN>'
curl -X POST http://127.0.0.1:8787/api/file/1/upload/ -H 'Authorization: <TOKEN>'
-F "file=@file.mp4"
```

View File

@ -18,9 +18,11 @@ ffpapi -u <USERNAME> -p <PASSWORD> -m <MAIL ADDRESS>
Then run the API thru the systemd service, or like:
```BASH
ffpapi -l 127.0.0.1:8080
ffpapi -l 127.0.0.1:8787
```
If you plan to run ffpapi with systemd set permission from **/usr/share/ffplayout** and content to user **www-data:www-data**.
**For possible endpoints read: [api endpoints](/docs/api.md)**
ffpapi can also serve the browser based frontend, just run in your browser `127.0.0.1:8787`.

View File

@ -38,6 +38,18 @@ async fn validator(req: ServiceRequest, credentials: BearerAuth) -> Result<Servi
Ok(req)
}
fn public_path() -> &'static str {
if Path::new("/usr/share/ffplayout/public/").is_dir() {
return "/usr/share/ffplayout/public/"
}
if Path::new("./public/").is_dir() {
return "./public/"
}
"./ffplayout-frontend/dist"
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let args = Args::parse();
@ -108,7 +120,7 @@ async fn main() -> std::io::Result<()> {
.service(remove)
.service(save_file),
)
.service(Files::new("/", "/usr/share/ffplayout/public/").index_file("index.html"))
.service(Files::new("/", public_path()).index_file("index.html"))
})
.bind((addr, port))?
.run()

View File

@ -8,7 +8,7 @@ pub struct Args {
#[clap(short, long, help = "ask for user credentials")]
pub ask: bool,
#[clap(short, long, help = "Listen on IP:PORT, like: 127.0.0.1:8080")]
#[clap(short, long, help = "Listen on IP:PORT, like: 127.0.0.1:8787")]
pub listen: Option<String>,
#[clap(short, long, help = "Initialize Database")]

View File

@ -3,7 +3,7 @@
/// Run the API thru the systemd service, or like:
///
/// ```BASH
/// ffpapi -l 127.0.0.1:8000
/// ffpapi -l 127.0.0.1:8787
/// ```
///
/// For all endpoints an (Bearer) authentication is required.\
@ -70,7 +70,7 @@ pub struct FileObj {
/// **Login**
///
/// ```BASH
/// curl -X POST http://127.0.0.1:8000/auth/login/ -H "Content-Type: application/json" \
/// curl -X POST http://127.0.0.1:8787/auth/login/ -H "Content-Type: application/json" \
/// -d '{ "username": "<USER>", "password": "<PASS>" }'
/// ```
/// **Response:**
@ -141,7 +141,7 @@ pub async fn login(credentials: web::Json<User>) -> impl Responder {
/// **Get current User**
///
/// ```BASH
/// curl -X GET 'http://localhost:8000/api/user' -H 'Content-Type: application/json' \
/// curl -X GET 'http://127.0.0.1:8787/api/user' -H 'Content-Type: application/json' \
/// -H 'Authorization: Bearer <TOKEN>'
/// ```
#[get("/user")]
@ -159,7 +159,7 @@ async fn get_user(user: web::ReqData<LoginUser>) -> Result<impl Responder, Servi
/// **Update current User**
///
/// ```BASH
/// curl -X PUT http://localhost:8000/api/user/1 -H 'Content-Type: application/json' \
/// curl -X PUT http://127.0.0.1:8787/api/user/1 -H 'Content-Type: application/json' \
/// -d '{"mail": "<MAIL>", "password": "<PASS>"}' -H 'Authorization: <TOKEN>'
/// ```
#[put("/user/{id}")]
@ -202,7 +202,7 @@ async fn update_user(
/// **Add User**
///
/// ```BASH
/// curl -X POST 'http://localhost:8000/api/user/' -H 'Content-Type: application/json' \
/// curl -X POST 'http://127.0.0.1:8787/api/user/' -H 'Content-Type: application/json' \
/// -d '{"mail": "<MAIL>", "username": "<USER>", "password": "<PASS>", "role_id": 1, "channel_id": 1}' \
/// -H 'Authorization: Bearer <TOKEN>'
/// ```
@ -223,7 +223,7 @@ async fn add_user(data: web::Json<User>) -> Result<impl Responder, ServiceError>
/// **Get Settings from Channel**
///
/// ```BASH
/// curl -X GET http://127.0.0.1:8000/api/channel/1 -H "Authorization: Bearer <TOKEN>"
/// curl -X GET http://127.0.0.1:8787/api/channel/1 -H "Authorization: Bearer <TOKEN>"
/// ```
///
/// **Response:**
@ -252,7 +252,7 @@ async fn get_channel(id: web::Path<i64>) -> Result<impl Responder, ServiceError>
/// **Get settings from all Channels**
///
/// ```BASH
/// curl -X GET http://127.0.0.1:8000/api/channels -H "Authorization: Bearer <TOKEN>"
/// curl -X GET http://127.0.0.1:8787/api/channels -H "Authorization: Bearer <TOKEN>"
/// ```
#[get("/channels")]
#[has_any_role("Role::Admin", type = "Role")]
@ -267,7 +267,7 @@ async fn get_all_channels() -> Result<impl Responder, ServiceError> {
/// **Update Channel**
///
/// ```BASH
/// curl -X PATCH http://127.0.0.1:8000/api/channel/1 -H "Content-Type: application/json" \
/// curl -X PATCH http://127.0.0.1:8787/api/channel/1 -H "Content-Type: application/json" \
/// -d '{ "id": 1, "name": "Channel 1", "preview_url": "http://localhost/live/stream.m3u8", \
/// "config_path": "/etc/ffplayout/ffplayout.yml", "extra_extensions": "jpg,jpeg,png", "timezone": "Europe/Berlin"}' \
/// -H "Authorization: Bearer <TOKEN>"
@ -288,7 +288,7 @@ async fn patch_channel(
/// **Create new Channel**
///
/// ```BASH
/// curl -X POST http://127.0.0.1:8000/api/channel/ -H "Content-Type: application/json" \
/// curl -X POST http://127.0.0.1:8787/api/channel/ -H "Content-Type: application/json" \
/// -d '{ "name": "Channel 2", "preview_url": "http://localhost/live/channel2.m3u8", \
/// "config_path": "/etc/ffplayout/channel2.yml", "extra_extensions": "jpg,jpeg,png",
/// "timezone": "Europe/Berlin", "service": "ffplayout@channel2.service" }' \
@ -306,7 +306,7 @@ async fn add_channel(data: web::Json<Channel>) -> Result<impl Responder, Service
/// **Delete Channel**
///
/// ```BASH
/// curl -X DELETE http://127.0.0.1:8000/api/channel/2 -H "Authorization: Bearer <TOKEN>"
/// curl -X DELETE http://127.0.0.1:8787/api/channel/2 -H "Authorization: Bearer <TOKEN>"
/// ```
#[delete("/channel/{id}")]
#[has_any_role("Role::Admin", type = "Role")]
@ -323,7 +323,7 @@ async fn remove_channel(id: web::Path<i64>) -> Result<impl Responder, ServiceErr
/// **Get Config**
///
/// ```BASH
/// curl -X GET http://localhost:8000/api/playout/config/1 -H 'Authorization: <TOKEN>'
/// curl -X GET http://127.0.0.1:8787/api/playout/config/1 -H 'Authorization: <TOKEN>'
/// ```
///
/// Response is a JSON object from the ffplayout.yml
@ -345,7 +345,7 @@ async fn get_playout_config(
/// **Update Config**
///
/// ```BASH
/// curl -X PUT http://localhost:8000/api/playout/config/1 -H "Content-Type: application/json" \
/// curl -X PUT http://127.0.0.1:8787/api/playout/config/1 -H "Content-Type: application/json" \
/// -d { <CONFIG DATA> } -H 'Authorization: <TOKEN>'
/// ```
#[put("/playout/config/{id}")]
@ -378,7 +378,7 @@ async fn update_playout_config(
/// **Get all Presets**
///
/// ```BASH
/// curl -X GET http://localhost:8000/api/presets/ -H 'Content-Type: application/json' \
/// curl -X GET http://127.0.0.1:8787/api/presets/ -H 'Content-Type: application/json' \
/// -H 'Authorization: <TOKEN>'
/// ```
#[get("/presets/{id}")]
@ -394,7 +394,7 @@ async fn get_presets(id: web::Path<i64>) -> Result<impl Responder, ServiceError>
/// **Update Preset**
///
/// ```BASH
/// curl -X PUT http://localhost:8000/api/presets/1 -H 'Content-Type: application/json' \
/// curl -X PUT http://127.0.0.1:8787/api/presets/1 -H 'Content-Type: application/json' \
/// -d '{ "name": "<PRESET NAME>", "text": "<TEXT>", "x": "<X>", "y": "<Y>", "fontsize": 24, \
/// "line_spacing": 4, "fontcolor": "#ffffff", "box": 1, "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0, "channel_id": 1 }' \
/// -H 'Authorization: <TOKEN>'
@ -415,7 +415,7 @@ async fn update_preset(
/// **Add new Preset**
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/presets/ -H 'Content-Type: application/json' \
/// curl -X POST http://127.0.0.1:8787/api/presets/ -H 'Content-Type: application/json' \
/// -d '{ "name": "<PRESET NAME>", "text": "TEXT>", "x": "<X>", "y": "<Y>", "fontsize": 24, \
/// "line_spacing": 4, "fontcolor": "#ffffff", "box": 1, "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0, "channel_id": 1 }' \
/// -H 'Authorization: <TOKEN>'
@ -433,7 +433,7 @@ async fn add_preset(data: web::Json<TextPreset>) -> Result<impl Responder, Servi
/// **Delete Preset**
///
/// ```BASH
/// curl -X DELETE http://localhost:8000/api/presets/1 -H 'Content-Type: application/json' \
/// curl -X DELETE http://127.0.0.1:8787/api/presets/1 -H 'Content-Type: application/json' \
/// -H 'Authorization: <TOKEN>'
/// ```
#[delete("/presets/{id}")]
@ -457,7 +457,7 @@ async fn delete_preset(id: web::Path<i64>) -> Result<impl Responder, ServiceErro
/// **Send Text to ffplayout**
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/control/1/text/ \
/// curl -X POST http://127.0.0.1:8787/api/control/1/text/ \
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>' \
/// -d '{"text": "Hello from ffplayout", "x": "(w-text_w)/2", "y": "(h-text_h)/2", \
/// "fontsize": "24", "line_spacing": "4", "fontcolor": "#ffffff", "box": "1", \
@ -482,7 +482,7 @@ pub async fn send_text_message(
/// - reset
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/control/1/playout/next/ -H 'Content-Type: application/json'
/// curl -X POST http://127.0.0.1:8787/api/control/1/playout/next/ -H 'Content-Type: application/json'
/// -d '{ "command": "reset" }' -H 'Authorization: <TOKEN>'
/// ```
#[post("/control/{id}/playout/")]
@ -500,7 +500,7 @@ pub async fn control_playout(
/// **Get current Clip**
///
/// ```BASH
/// curl -X GET http://localhost:8000/api/control/1/media/current
/// curl -X GET http://127.0.0.1:8787/api/control/1/media/current
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
/// ```
///
@ -539,7 +539,7 @@ pub async fn media_current(id: web::Path<i64>) -> Result<impl Responder, Service
/// **Get next Clip**
///
/// ```BASH
/// curl -X GET http://localhost:8000/api/control/1/media/next/ -H 'Authorization: <TOKEN>'
/// curl -X GET http://127.0.0.1:8787/api/control/1/media/next/ -H 'Authorization: <TOKEN>'
/// ```
#[get("/control/{id}/media/next")]
#[has_any_role("Role::Admin", "Role::User", type = "Role")]
@ -553,7 +553,7 @@ pub async fn media_next(id: web::Path<i64>) -> Result<impl Responder, ServiceErr
/// **Get last Clip**
///
/// ```BASH
/// curl -X GET http://localhost:8000/api/control/1/media/last/
/// curl -X GET http://127.0.0.1:8787/api/control/1/media/last/
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
/// ```
#[get("/control/{id}/media/last")]
@ -574,7 +574,7 @@ pub async fn media_last(id: web::Path<i64>) -> Result<impl Responder, ServiceErr
/// - status
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/control/1/process/
/// curl -X POST http://127.0.0.1:8787/api/control/1/process/
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
/// -d '{"command": "start"}'
/// ```
@ -592,7 +592,7 @@ pub async fn process_control(
/// **Get playlist**
///
/// ```BASH
/// curl -X GET http://localhost:8000/api/playlist/1?date=2022-06-20
/// curl -X GET http://127.0.0.1:8787/api/playlist/1?date=2022-06-20
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
/// ```
#[get("/playlist/{id}")]
@ -610,7 +610,7 @@ pub async fn get_playlist(
/// **Save playlist**
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/playlist/1/
/// curl -X POST http://127.0.0.1:8787/api/playlist/1/
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
/// -- data "{<JSON playlist data>}"
/// ```
@ -631,7 +631,7 @@ pub async fn save_playlist(
/// A new playlist will be generated and response.
///
/// ```BASH
/// curl -X GET http://localhost:8000/api/playlist/1/generate/2022-06-20
/// curl -X GET http://127.0.0.1:8787/api/playlist/1/generate/2022-06-20
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
/// ```
#[get("/playlist/{id}/generate/{date}")]
@ -648,7 +648,7 @@ pub async fn gen_playlist(
/// **Delete Playlist**
///
/// ```BASH
/// curl -X DELETE http://localhost:8000/api/playlist/1/2022-06-20
/// curl -X DELETE http://127.0.0.1:8787/api/playlist/1/2022-06-20
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
/// ```
#[delete("/playlist/{id}/{date}")]
@ -667,7 +667,7 @@ pub async fn del_playlist(
/// **Read Log Life**
///
/// ```BASH
/// curl -X Get http://localhost:8000/api/log/1
/// curl -X Get http://127.0.0.1:8787/api/log/1
/// -H 'Content-Type: application/json' -H 'Authorization: <TOKEN>'
/// ```
#[get("/log/{id}")]
@ -684,7 +684,7 @@ pub async fn get_log(
/// **Get File/Folder List**
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/file/1/browse/ -H 'Content-Type: application/json'
/// curl -X POST http://127.0.0.1:8787/api/file/1/browse/ -H 'Content-Type: application/json'
/// -d '{ "source": "/" }' -H 'Authorization: <TOKEN>'
/// ```
#[post("/file/{id}/browse/")]
@ -702,7 +702,7 @@ pub async fn file_browser(
/// **Create Folder**
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/file/1/create-folder/ -H 'Content-Type: application/json'
/// curl -X POST http://127.0.0.1:8787/api/file/1/create-folder/ -H 'Content-Type: application/json'
/// -d '{"source": "<FOLDER PATH>"}' -H 'Authorization: <TOKEN>'
/// ```
#[post("/file/{id}/create-folder/")]
@ -717,7 +717,7 @@ pub async fn add_dir(
/// **Rename File**
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/file/1/rename/ -H 'Content-Type: application/json'
/// curl -X POST http://127.0.0.1:8787/api/file/1/rename/ -H 'Content-Type: application/json'
/// -d '{"source": "<SOURCE>", "target": "<TARGET>"}' -H 'Authorization: <TOKEN>'
/// ```
#[post("/file/{id}/rename/")]
@ -735,7 +735,7 @@ pub async fn move_rename(
/// **Remove File/Folder**
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/file/1/remove/ -H 'Content-Type: application/json'
/// curl -X POST http://127.0.0.1:8787/api/file/1/remove/ -H 'Content-Type: application/json'
/// -d '{"source": "<SOURCE>"}' -H 'Authorization: <TOKEN>'
/// ```
#[post("/file/{id}/remove/")]
@ -753,7 +753,7 @@ pub async fn remove(
/// **Upload File**
///
/// ```BASH
/// curl -X POST http://localhost:8000/api/file/1/upload/ -H 'Authorization: <TOKEN>'
/// curl -X POST http://127.0.0.1:8787/api/file/1/upload/ -H 'Authorization: <TOKEN>'
/// -F "file=@file.mp4"
/// ```
#[put("/file/{id}/upload/")]

View File

@ -55,7 +55,7 @@ assets = [
["../assets/logo.png", "/usr/share/ffplayout/", "644"],
["../assets/ffplayout.yml", "/usr/share/ffplayout/ffplayout.yml.orig", "644"],
["../README.md", "/usr/share/doc/ffplayout/README", "644"],
["../public.tar.gz", "/usr/share/ffplayout/", "644"],
["../public/**/*", "/usr/share/ffplayout/public/", "644"],
]
maintainer-scripts = "../debian/"
systemd-units = { enable = false, unit-scripts = "../assets" }
@ -76,6 +76,7 @@ assets = [
["../assets/logo.png", "/usr/share/ffplayout/", "644"],
["../assets/ffplayout.yml", "/usr/share/ffplayout/ffplayout.yml.orig", "644"],
["../README.md", "/usr/share/doc/ffplayout/README", "644"],
["../public/**/*", "/usr/share/ffplayout/public/", "644"],
]
# REHL RPM PACKAGE
@ -94,6 +95,7 @@ assets = [
{ source = "../LICENSE", dest = "/usr/share/doc/ffplayout/LICENSE", mode = "644" },
{ source = "../assets/logo.png", dest = "/usr/share/ffplayout/logo.png", mode = "644" },
{ source = "../assets/ffplayout.yml", dest = "/usr/share/ffplayout/ffplayout.yml.orig", mode = "644" },
{ source = "../public/**/*", dest = "/usr/share/ffplayout/public/", mode = "644" },
{ source = "../debian/postinst", dest = "/usr/share/ffplayout/postinst", mode = "755" },
{ source = "../debian/postrm", dest = "/usr/share/ffplayout/postrm", mode = "755" },
]

@ -1 +1 @@
Subproject commit 9832a5e12c4fc604b513a09d3a89c898d477e87d
Subproject commit c02141af54762961cf559248a3c9d42e9d317e0b

View File

@ -26,7 +26,7 @@ for target in "${targets[@]}"; do
cp ./target/${target}/release/ffpapi.exe .
cp ./target/${target}/release/ffplayout.exe .
zip -r "ffplayout-v${version}_${target}.zip" assets docs LICENSE README.md ffplayout.exe ffpapi.exe -x *.db
zip -r "ffplayout-v${version}_${target}.zip" assets docs public LICENSE README.md ffplayout.exe ffpapi.exe -x *.db
rm -f ffplayout.exe ffpapi.exe
elif [[ $target == "x86_64-apple-darwin" ]] || [[ $target == "aarch64-apple-darwin" ]]; then
if [[ -f "ffplayout-v${version}_${target}.tar.gz" ]]; then
@ -36,7 +36,7 @@ for target in "${targets[@]}"; do
cargo build --release --target=$target --bin ffplayout
cp ./target/${target}/release/ffplayout .
tar -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' assets docs LICENSE README.md ffplayout
tar -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' assets docs public LICENSE README.md ffplayout
rm -f ffplayout
else
if [[ -f "ffplayout-v${version}_${target}.tar.gz" ]]; then
@ -47,33 +47,26 @@ for target in "${targets[@]}"; do
cp ./target/${target}/release/ffpapi .
cp ./target/${target}/release/ffplayout .
tar -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' assets docs LICENSE README.md ffplayout ffpapi
tar -czvf "ffplayout-v${version}_${target}.tar.gz" --exclude='*.db' assets docs public LICENSE README.md ffplayout ffpapi
rm -f ffplayout ffpapi
fi
echo ""
done
cd ffplayout-frontend
npm install
npm run build
yes | rm -rf public ../public.tar.gz
mv dist public
tar czf public.tar.gz public
mv public.tar.gz ../
yes | rm -rf public
yes | rm -rf ../public
mv dist ../public
cd ..
cargo deb --target=x86_64-unknown-linux-musl -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}_amd64.deb
cargo deb --target=aarch64-unknown-linux-gnu --variant=arm64 -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}_arm64.deb
# cargo deb --target=armv7-unknown-linux-gnueabihf --variant=armhf -p ffplayout --manifest-path=ffplayout-engine/Cargo.toml -o ffplayout_${version}_armhf.deb
cargo generate-rpm --target=x86_64-unknown-linux-musl -p ffplayout-engine -o ffplayout-${version}-1.x86_64.rpm
cd ffplayout-engine
cargo generate-rpm --target=x86_64-unknown-linux-musl -o ../ffplayout-${version}-1.x86_64.rpm
cd ..