MacWarrior / clipbucket-v5

Open source video hosting with PHP
Other
69 stars 45 forks source link

YouTube-like URL format #349

Open sphynkx opened 6 months ago

sphynkx commented 6 months ago

As for old CB, for CBv5 also could configure youtube-like URLs (like https://domain.tld/watch?v=XXXXXXX ). Here is some modifications.

  1. In webserver config (here is sample for Nginx) add some rewrites:

    location / {
          if (!-e $request_filename){
              rewrite ^(.*)$ /$1_video.php;
             }
          try_files $uri $uri/ @rewrite;
    }
    
    location @rewrite {
          rewrite ^/(.*)$ /index.php;
    }
    
    location /embed {
          rewrite ^/embed?(.*) /player/embed_player.php?$1$query_string;
    }
  2. Modify includes/functions_video.php:415
    <        $link = BASEURL . '/watch_video.php?v=' . $vdetails['videokey'] . $plist;
    >        $link = BASEURL . '/watch?v=' . $vdetails['videokey'] . $plist;
  3. Modify includes/classes/video.class.php:1805
    <        $embed_code .= 'src="' . BASEURL . '/player/embed_player.php?vid=' . $vdetails['videokey'];
    >        $embed_code .= 'src="' . BASEURL . '/player/embed?vid=' . $vdetails['videokey'];
  4. Optionally also it could add creation date under titles of videos. Need to modify styles/cb_28/layout/watch_video.html:26 - aftrer the line <h1>{display_clean($video.title)}</h1> add line <h4>{date('d.m.Y', strtotime($video.datecreated))}</h4> Proposition: Make the Youtube-like URL-format as option in site configuration.