diff --git a/assets/ffpapi.service b/assets/ffpapi.service index 507e5918..ddf8218c 100644 --- a/assets/ffpapi.service +++ b/assets/ffpapi.service @@ -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 diff --git a/debian/postinst b/debian/postinst index 1bdeacba..0e99cc00 100644 --- a/debian/postinst +++ b/debian/postinst @@ -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" diff --git a/docs/api.md b/docs/api.md index 0c9d32de..896922ae 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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": "", "password": "" }' ``` **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 ' ``` **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": "", "password": ""}' -H 'Authorization: ' ``` **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": "", "username": "", "password": "", "role_id": 1, "channel_id": 1}' \ -H 'Authorization: Bearer ' ``` @@ -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 " +curl -X GET http://127.0.0.1:8787/api/channel/1 -H "Authorization: Bearer " ``` **Response:** @@ -78,13 +78,13 @@ curl -X GET http://127.0.0.1:8000/api/channel/1 -H "Authorization: Bearer " +curl -X GET http://127.0.0.1:8787/api/channels -H "Authorization: Bearer " ``` **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 " @@ -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 " +curl -X DELETE http://127.0.0.1:8787/api/channel/2 -H "Authorization: Bearer " ``` #### ffplayout Config @@ -111,7 +111,7 @@ curl -X DELETE http://127.0.0.1:8000/api/channel/2 -H "Authorization: Bearer ' +curl -X GET http://127.0.0.1:8787/api/playout/config/1 -H 'Authorization: ' ``` 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 { } -H 'Authorization: ' ``` @@ -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: ' ``` **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": "", "text": "", "x": "", "y": "", "fontsize": 24, \ "line_spacing": 4, "fontcolor": "#ffffff", "box": 1, "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0, "channel_id": 1 }' \ -H 'Authorization: ' @@ -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": "", "text": "TEXT>", "x": "", "y": "", "fontsize": 24, \ "line_spacing": 4, "fontcolor": "#ffffff", "box": 1, "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0, "channel_id": 1 }' \ -H 'Authorization: ' @@ -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: ' ``` @@ -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: ' \ -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: ' ``` **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: ' ``` @@ -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: ' +curl -X GET http://127.0.0.1:8787/api/control/1/media/next/ -H 'Authorization: ' ``` **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: ' ``` @@ -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: ' -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: ' ``` **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: ' -- 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: ' ``` **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: ' ``` @@ -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: ' ``` @@ -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: ' ``` **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": ""}' -H 'Authorization: ' ``` **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": "", "target": ""}' -H 'Authorization: ' ``` **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": ""}' -H 'Authorization: ' ``` **Upload File** ```BASH -curl -X POST http://localhost:8000/api/file/1/upload/ -H 'Authorization: ' +curl -X POST http://127.0.0.1:8787/api/file/1/upload/ -H 'Authorization: ' -F "file=@file.mp4" ``` diff --git a/ffplayout-api/README.md b/ffplayout-api/README.md index 83c2eecc..cf3c215b 100644 --- a/ffplayout-api/README.md +++ b/ffplayout-api/README.md @@ -18,9 +18,11 @@ ffpapi -u -p -m 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`. diff --git a/ffplayout-api/src/main.rs b/ffplayout-api/src/main.rs index f4104f8e..7e910f38 100644 --- a/ffplayout-api/src/main.rs +++ b/ffplayout-api/src/main.rs @@ -38,6 +38,18 @@ async fn validator(req: ServiceRequest, credentials: BearerAuth) -> Result &'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() diff --git a/ffplayout-api/src/utils/args_parse.rs b/ffplayout-api/src/utils/args_parse.rs index 0b3a70f2..246da8b9 100644 --- a/ffplayout-api/src/utils/args_parse.rs +++ b/ffplayout-api/src/utils/args_parse.rs @@ -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, #[clap(short, long, help = "Initialize Database")] diff --git a/ffplayout-api/src/utils/routes.rs b/ffplayout-api/src/utils/routes.rs index 6f96ebd7..d1e7975e 100644 --- a/ffplayout-api/src/utils/routes.rs +++ b/ffplayout-api/src/utils/routes.rs @@ -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": "", "password": "" }' /// ``` /// **Response:** @@ -141,7 +141,7 @@ pub async fn login(credentials: web::Json) -> 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 ' /// ``` #[get("/user")] @@ -159,7 +159,7 @@ async fn get_user(user: web::ReqData) -> Result", "password": ""}' -H 'Authorization: ' /// ``` #[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": "", "username": "", "password": "", "role_id": 1, "channel_id": 1}' \ /// -H 'Authorization: Bearer ' /// ``` @@ -223,7 +223,7 @@ async fn add_user(data: web::Json) -> Result /// **Get Settings from Channel** /// /// ```BASH -/// curl -X GET http://127.0.0.1:8000/api/channel/1 -H "Authorization: Bearer " +/// curl -X GET http://127.0.0.1:8787/api/channel/1 -H "Authorization: Bearer " /// ``` /// /// **Response:** @@ -252,7 +252,7 @@ async fn get_channel(id: web::Path) -> Result /// **Get settings from all Channels** /// /// ```BASH -/// curl -X GET http://127.0.0.1:8000/api/channels -H "Authorization: Bearer " +/// curl -X GET http://127.0.0.1:8787/api/channels -H "Authorization: Bearer " /// ``` #[get("/channels")] #[has_any_role("Role::Admin", type = "Role")] @@ -267,7 +267,7 @@ async fn get_all_channels() -> Result { /// **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 " @@ -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) -> Result" +/// curl -X DELETE http://127.0.0.1:8787/api/channel/2 -H "Authorization: Bearer " /// ``` #[delete("/channel/{id}")] #[has_any_role("Role::Admin", type = "Role")] @@ -323,7 +323,7 @@ async fn remove_channel(id: web::Path) -> Result' +/// curl -X GET http://127.0.0.1:8787/api/playout/config/1 -H 'Authorization: ' /// ``` /// /// 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 { } -H 'Authorization: ' /// ``` #[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: ' /// ``` #[get("/presets/{id}")] @@ -394,7 +394,7 @@ async fn get_presets(id: web::Path) -> Result /// **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": "", "text": "", "x": "", "y": "", "fontsize": 24, \ /// "line_spacing": 4, "fontcolor": "#ffffff", "box": 1, "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0, "channel_id": 1 }' \ /// -H 'Authorization: ' @@ -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": "", "text": "TEXT>", "x": "", "y": "", "fontsize": 24, \ /// "line_spacing": 4, "fontcolor": "#ffffff", "box": 1, "boxcolor": "#000000", "boxborderw": 4, "alpha": 1.0, "channel_id": 1 }' \ /// -H 'Authorization: ' @@ -433,7 +433,7 @@ async fn add_preset(data: web::Json) -> Result' /// ``` #[delete("/presets/{id}")] @@ -457,7 +457,7 @@ async fn delete_preset(id: web::Path) -> Result' \ /// -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: ' /// ``` #[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: ' /// ``` /// @@ -539,7 +539,7 @@ pub async fn media_current(id: web::Path) -> Result' +/// curl -X GET http://127.0.0.1:8787/api/control/1/media/next/ -H 'Authorization: ' /// ``` #[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) -> Result' /// ``` #[get("/control/{id}/media/last")] @@ -574,7 +574,7 @@ pub async fn media_last(id: web::Path) -> Result' /// -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: ' /// ``` #[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: ' /// -- 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: ' /// ``` #[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: ' /// ``` #[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: ' /// ``` #[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: ' /// ``` #[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": ""}' -H 'Authorization: ' /// ``` #[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": "", "target": ""}' -H 'Authorization: ' /// ``` #[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": ""}' -H 'Authorization: ' /// ``` #[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: ' +/// curl -X POST http://127.0.0.1:8787/api/file/1/upload/ -H 'Authorization: ' /// -F "file=@file.mp4" /// ``` #[put("/file/{id}/upload/")] diff --git a/ffplayout-engine/Cargo.toml b/ffplayout-engine/Cargo.toml index 0f1af9dc..b2eb4f5c 100644 --- a/ffplayout-engine/Cargo.toml +++ b/ffplayout-engine/Cargo.toml @@ -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" }, ] diff --git a/ffplayout-frontend b/ffplayout-frontend index 9832a5e1..c02141af 160000 --- a/ffplayout-frontend +++ b/ffplayout-frontend @@ -1 +1 @@ -Subproject commit 9832a5e12c4fc604b513a09d3a89c898d477e87d +Subproject commit c02141af54762961cf559248a3c9d42e9d317e0b diff --git a/scripts/build_all.sh b/scripts/build_all.sh index edd206e7..725376b1 100755 --- a/scripts/build_all.sh +++ b/scripts/build_all.sh @@ -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 ..