<?php
ini_set('display_errors', 1);
include(__DIR__ . '/../includes/functions.php');

$file_path = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] !== 'off') ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/';

$appApiEndpoint = $file_path . 'config.php' . '?code=betbetbet';




$res = $db->select('app_dns', '*', '', '');

$appImages = []; 
foreach ($res as $row) {
    $appImagesResult = $db->select('app_image', '*', '');
    foreach ($appImagesResult as $imageRow) {
        $appImages[] = $imageRow;
    }
}
$data = [
    "endpoint" => [
        "verifyDevice" => "https://login.purpletv.app/api/verifyDeviceCode",
        "playlist" => "https://login.purpletv.app/api/playlistByDevice",
        "mackey" => "https://login.purpletv.app/api/playlistByMacKey",
        "qr_data" => "https://login.purpletv.app",
        "register" => "https://cloud.purpletv.app/register",
        "login" => "https://cloud.purpletv.app/login",
        "create_playlist" => "https://cloud.purpletv.app/createplaylist",
        "create_subprofile" => "https://cloud.purpletv.app/subprofile",
        "create_history" => "https://cloud.purpletv.app/createhistory",
        "create_fav" => "https://cloud.purpletv.app/createfavorites",
        "update_playlist" => "https://cloud.purpletv.app/updateplaylist",
        "get_subprofile" => "https://cloud.purpletv.app/getsubprofile",
        "list_get" => "https://cloud.purpletv.app/getList",
        "list_m3u_update" => "https://cloud.purpletv.app/m3u",
        "deleteurl" => "https://cloud.purpletv.app/deleteurl",
        "list_xstream_update" => "https://cloud.purpletv.app/xstream",
        "app_api_endpoint" => $appApiEndpoint
    ],
    "flag" => [
        "login_id_pin" => "",
        "login_activate" => "",
        "login_qr" => "",
        "login_code_universal" => "",
        "login_mac_key" => "",
    ],
    "content" => [
        "qr_step" => "1) Open https://form.purpletv.app/ in browser2) Add Six digit code in form'3) Add Xtream or M3u details and 'Submit'4) Screen will Refresh and Show your playlist profile",
        "mackey_step" => "1) Register or Login at https://login.purpletv.app/login2) Navigate To Playlist > Add New Playlist and then My Devices > Add New Device. 3) Enter Device Id and Device Key and Choose your playlist and 'Submit'.",
        "activation_step" => "1) Register or Login at https://login.purpletv.app/login2) Click To 'Add New Device' And 'Add New Playlist'3) Assign Devices To Playlist and 'Submit'4) Enter the 'Device Code' in the box below",
        "ads_txt" => "display your ads heresupport@purplesmarttv.com",
        "legal_msg" => "<h3>Purple Player doesn't sell playlist or subscriptions</h3></br>Purple Player is a General Media Player and it doesn't include any content or playlist",
    ],
    "language" => [
        "defult_language" => "EN",
        "firstime_select_language" => "false",
    ],
    "ads" => [
        "ads_app_id" => "",
        "ads_banner" => "/200463343/300x250_inHouse_banner",
        "ads_banner_mobile" => "/200463343/300x250_inHouse_banner",
        "ads_intrestial" => "",
        "ads_rewarded" => "",
        "ads_native" => "",
        "ads_intrestial_time_delay" => "10",
        "ads_ios_status" => "false",
        "ads_status" => "false",
        "vast_ads" => [
            "live_tv" => [
                "app_vast_ads_s_status" => "false",
                "app_vast_ads_s_full" => "false",
                "app_vast_ads_s" => "https://pubads.g.doubleclick.net/gampad/live/ads?iu=/206696744,22518463368/PurpleTv/purplesmartv_video&description_url=https%3A%2F%2Fpurplesmarttv.com%2F&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",
                "app_vast_ads_h_status" => "true",
                "app_vast_ads_h" => "https://pubads.g.doubleclick.net/gampad/live/ads?iu=/206696744,22518463368/PurpleTv/purplesmartv_video&description_url=https%3A%2F%2Fpurplesmarttv.com%2F&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",
            ],
            "vod" => [
                "app_vast_ads_s_status" => "false",
                "app_vast_ads_s" => "https://pubads.g.doubleclick.net/gampad/live/ads?iu=/206696744,22518463368/PurpleTv/purplesmartv_video&description_url=https%3A%2F%2Fpurplesmarttv.com%2F&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",
                "app_vast_ads_h_status" => "true",
                "app_vast_ads_h" => "https://pubads.g.doubleclick.net/gampad/live/ads?iu=/206696744,22518463368/PurpleTv/purplesmartv_video&description_url=https%3A%2F%2Fpurplesmarttv.com%2F&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",
            ],
            "show" => [
                "app_vast_ads_s_status" => "false",
                "app_vast_ads_s" => "https://pubads.g.doubleclick.net/gampad/live/ads?iu=/206696744,22518463368/PurpleTv/purplesmartv_video&description_url=https%3A%2F%2Fpurplesmarttv.com%2F&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",
                "app_vast_ads_h_status" => "true",
                "app_vast_ads_h" => "https://pubads.g.doubleclick.net/gampad/live/ads?iu=/206696744,22518463368/PurpleTv/purplesmartv_video&description_url=https%3A%2F%2Fpurplesmarttv.com%2F&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",
            ],
            "fallback" => "https://pubads.g.doubleclick.net/gampad/live/ads?iu=/206696744,22518463368/PurpleTv/purplesmartv_video&description_url=https%3A%2F%2Fpurplesmarttv.com%2F&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",
            "fallback_backup" => "https://pubads.g.doubleclick.net/gampad/live/ads?iu=/206696744,22518463368/PurpleTv/purplesmartv_video&description_url=https%3A%2F%2Fpurplesmarttv.com%2F&tfcd=0&npa=0&sz=640x480&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",
        ],
    ],
    "version" => [
        "version_check" => "false",
        "version_code" => "7",
        "version_name" => "7.0",
        "version_download_url" => "https://tinyurl.com/purpleiptv1",
        "version_download_url_apk" => "",
        "version_force_update" => "false",
        "version_update_msg" => "Please Update for looking Glass",
        "version_changelog" => [
        ],
    ],
    "player" => [
        "live_tv" => "Vlc Player",
        "vod" => "Vlc Player",
        "series" => "Exo Player",
        "catch_up" => "Exo Player",
    ],
    "app_announce" => [
    ],
    "maintenance_msg" => [
    ],
    "app_image" => [
    "app_img" => !empty($appImages) && isset($appImages[0]['app_img']) ? $appImages[0]['app_img'] : 'false',        
        "app_video" => "https://uploads.plutio.com/s/RRwJuez8SU1.8iHyOi4KWG77kCOWtNey9uwrlFXPCWXVrnG6q4wXJ5lTqUnP-video--2-.mp4",
        "app_logo" => "https://panel.purpletv.app/uploads/app_images/e99e98ed-f127-42da-9581-a067c8358df4.png",
        "app_mobile_icon" => "https://panel.purpletv.app/uploads/app_images/889f0b63-646e-4185-b482-055bbaaab6e2.png",
        "app_tv_banner" => "https://panel.purpletv.app/uploads/app_images/d402f7fc-6081-4dfa-8220-d74238774eeb.png",
         "splash_image" => isset($appImages[0]['splash_image']) ? $appImages[0]['splash_image'] : 'default_splash_image_url_here',
        "back_image" => isset($appImages[0]['back_image']) ? $appImages[0]['back_image'] : 'default_back_image_url_here',
    ],
    "api_key" => [
        "imdb_api" => "",
        "g_api_key" => "",
        "image_imdb" => "",
        "trakt_api_key" => "",
        "weather_api" => "",
        "ip_stack_key" => "",
        "check_ip" => "https://checkip.justwatch.com",
        "vpn_url" => "https://panel.purpletv.app/api/vpn",
        "vpn" => "true",
        "vpn_username" => "#",
        "vpn_password" => "#",
        "analyt_key" => "181b306d2ea13f466b5e28a70d9df96858790acd",
        "analyt_server" => "http://countly.guidemefast.com",
        "appcenter" => "c5b165ad-397f-4531-b144-2cc56406645f",
    ],
    "weather" => [
        "city_name" => "",
        "city_id" => "",
    ],
    "agreement" => [
        "privacy_policy" => "https://www.iubenda.com/privacy-policy/68919995",
        "terms_condtion" => "",
        "copyright_complaint" => "",
    ],
];




header('Content-Type: application/json');
echo json_encode($data, JSON_PRETTY_PRINT);
