<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ziad Hakim on Medium]]></title>
        <description><![CDATA[Stories by Ziad Hakim on Medium]]></description>
        <link>https://medium.com/@hakim.ziad?source=rss-e2052653a3fe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Tnphl7l_OKIQaMHchU8DNg.jpeg</url>
            <title>Stories by Ziad Hakim on Medium</title>
            <link>https://medium.com/@hakim.ziad?source=rss-e2052653a3fe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:43:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hakim.ziad/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Remove Polylang Plugin and Return to a Single-Language WordPress Site]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@hakim.ziad/how-to-remove-polylang-plugin-and-return-to-a-single-language-wordpress-site-acf059d156fc?source=rss-e2052653a3fe------2"><img src="https://cdn-images-1.medium.com/max/2600/0*uUCNRtQfIh0yCr72" width="3999"></a></p><p class="medium-feed-snippet">If you&#x2019;ve decided to switch back to a single-language WordPress site, here&#x2019;s a simple way to remove Polylang and delete all translated&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@hakim.ziad/how-to-remove-polylang-plugin-and-return-to-a-single-language-wordpress-site-acf059d156fc?source=rss-e2052653a3fe------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@hakim.ziad/how-to-remove-polylang-plugin-and-return-to-a-single-language-wordpress-site-acf059d156fc?source=rss-e2052653a3fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/acf059d156fc</guid>
            <category><![CDATA[wordpress-plugins]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[polylang]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ziad Hakim]]></dc:creator>
            <pubDate>Sun, 07 Jun 2026 21:46:28 GMT</pubDate>
            <atom:updated>2026-06-07T21:46:28.226Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Stop Coding Agents from Using Stale Versions]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@hakim.ziad/how-to-stop-coding-agents-from-using-stale-versions-473dcea7359d?source=rss-e2052653a3fe------2"><img src="https://cdn-images-1.medium.com/max/2600/0*9RQabC8KySb4Bcx3" width="5184"></a></p><p class="medium-feed-snippet">While working on a full-stack app that stores files in AWS S3, I asked my coding agent to help design a setup with three environments&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@hakim.ziad/how-to-stop-coding-agents-from-using-stale-versions-473dcea7359d?source=rss-e2052653a3fe------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@hakim.ziad/how-to-stop-coding-agents-from-using-stale-versions-473dcea7359d?source=rss-e2052653a3fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/473dcea7359d</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Ziad Hakim]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 21:57:06 GMT</pubDate>
            <atom:updated>2026-04-21T21:57:06.913Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How We Safely Embed YouTube Videos in Educational Websites]]></title>
            <link>https://medium.com/@hakim.ziad/how-we-safely-embed-youtube-videos-in-educational-websites-c26e5a9817e5?source=rss-e2052653a3fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/c26e5a9817e5</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[youtube]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[education-technology]]></category>
            <dc:creator><![CDATA[Ziad Hakim]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 22:09:41 GMT</pubDate>
            <atom:updated>2025-09-27T09:42:22.734Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, I’ll show you how I built a React component that embeds YouTube videos without exposing students to distractions.</p><p>I created an educational website for our school, and the teacher wanted to add some YouTube videos. The video explains a complex concept beautifully, engages learners, and fits perfectly into their lesson plan.</p><p><strong>But there’s a problem</strong>: the moment you embed that video, you’ve also embedded every distraction YouTube has to offer.</p><p>Students click ‘Watch on YouTube’ and end up watching unrelated videos. They follow ‘More Videos’ suggestions and suddenly your carefully planned lesson turns into a battle against YouTube’s endless recommendation algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IlH9Dlrq2qSIfbJ-" /><figcaption>Photo by <a href="https://unsplash.com/@hamedtaha?utm_source=medium&amp;utm_medium=referral">حامد طه</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote><strong><em>Important:</em></strong><em> I’m sharing this solution based on my own experience. It’s not an official recommendation, and if you’re not comfortable with React/JavaScript, I suggest you don’t try to implement it on your own. Use this guide at your own risk.</em></blockquote><p>Before we dive into the solution, let’s look at a few common approaches that seem logical but fail in practice.</p><h3>What Doesn’t Work (And Why)</h3><p>❌ <strong>Standard YouTube Embed Parameters</strong></p><pre>&lt;iframe src=&quot;https://www.youtube.com/embed/VIDEO_ID?rel=0&amp;modestbranding=1&quot;&gt;</pre><p><strong>The Problem</strong>: These parameters are suggestions, not commands. YouTube can (and does) override them, especially on mobile devices. The rel=0 parameter was deprecated and no longer works reliably.</p><p>❌ <strong>JavaScript Event Blocking</strong></p><pre>iframe.addEventListener(&#39;click&#39;, (e) =&gt; e.preventDefault());</pre><p><strong>The Problem: </strong>Events inside the iframe don’t bubble up to the parent document. Your JavaScript can’t intercept clicks that happen within YouTube’s player.</p><p>So we decided to use the <strong>YouTube IFrame Player API</strong> to embed the player and listen for play/pause events in our React component. This way, we can react to play, pause, and end events by adding or removing transparent overlays. The overlay prevents users from right-clicking on the video to open it in a new tab or window.</p><h3>The Solution We Decided to Go With</h3><p>After extensive testing, we found that this solution <strong>minimizes</strong> the chances of students clicking on other videos and helps keep them focused on learning.</p><p><strong>Step 1: Use Privacy-Enhanced Embedding with Sandbox</strong></p><pre>const embedUrl = `https://www.youtube-nocookie.com/embed/${videoId}?` +<br>  new URLSearchParams({<br>    rel: &#39;0&#39;,              // No related videos (best effort)<br>    modestbranding: &#39;1&#39;,   // Remove YouTube logo<br>    iv_load_policy: &#39;3&#39;,   // Hide annotations<br>    enablejsapi: &#39;1&#39;,      // Enable JavaScript API<br>    fs: &#39;0&#39;,               // Disable fullscreen (optional)<br>    showinfo: &#39;0&#39;,         // No video info<br>    autoplay: &#39;0&#39;,         // No autoplay<br>    controls: &#39;1&#39;,         // Show controls<br>    disablekb: &#39;1&#39;,        // Disable keyboard shortcuts<br>    origin: window.location.origin<br>  });</pre><p>Key Points:</p><ul><li>Use youtube-nocookie.com for privacy-enhanced mode</li><li>Set origin parameter for security</li><li>Disable potentially problematic features</li></ul><p><strong>Step 2: Apply Sandbox Security (The Real Hero)</strong></p><pre>&lt;iframe<br>  src={embedUrl}<br>  sandbox=&quot;allow-scripts allow-same-origin&quot;<br>  allow=&quot;accelerometer; encrypted-media; gyroscope&quot;<br>&gt;</pre><p><strong>This is the magic ingredient.</strong> The sandbox attribute without allow-popups prevents ANY new windows from opening, regardless of how students try to access them.</p><p><strong>What the sandbox does:</strong><br>✅ Clicking <em>“Watch on YouTube”</em> or “More videos” → Nothing happens<br>❌ Right-click → <em>“Open in new tab”</em> → Not blocked.</p><p>So, in the next step, we’ll add transparent overlays to prevent this from happening.”</p><p><strong>Step 3: Add Strategic Overlays for Extra Protection</strong></p><p>While sandbox provides the primary security, you can add invisible overlays to block right-click access to problematic areas:</p><pre>{/* --- Always-on overlays --- */}<br>{/* 1. Block &quot;Copy Link&quot; and Title on the top (always on) */}<br>&lt;div<br>    style={{<br>      position: &quot;absolute&quot;,<br>      top: 0,<br>      left: 0,<br>      right: 0,<br>      height: &quot;60px&quot;,<br>      zIndex: 5,<br>      backgroundColor: &quot;transparent&quot;,<br>      pointerEvents: &quot;auto&quot;,<br>    }}<br>    onContextMenu={preventAction}<br>    onClick={preventAction}<br>    title=&quot;Educational content - external links disabled&quot;<br>  /&gt;<br>  {/* 2. Block &quot;YouTube&quot; - Small bottom right area (always on) */}<br>  &lt;div<br>    style={{<br>      position: &quot;absolute&quot;,<br>      right: 0,<br>      bottom: 0,<br>      width: &quot;10%&quot;,<br>      height: &quot;36px&quot;,<br>      zIndex: 5,<br>      backgroundColor: &quot;transparent&quot;,<br>      pointerEvents: &quot;auto&quot;,<br>    }}<br>    onContextMenu={preventAction}<br>    onClick={preventAction}<br>    title=&quot;Educational content - external links disabled&quot;<br>  /&gt;<br>    <br>  {/* --- Conditional overlays --- */}<br>  {/* 3. Before start: Block &quot;Watch on YouTube&quot; - Small bottom left area (remove on play) */}<br>  {playerState === -1 || playerState === 5 ? (<br>    &lt;div<br>      style={{<br>        position: &quot;absolute&quot;,<br>        left: 0,<br>        bottom: 0,<br>        width: &quot;25%&quot;,<br>        height: &quot;50px&quot;,<br>        zIndex: 6,<br>        backgroundColor: &quot;transparent&quot;,<br>        pointerEvents: &quot;auto&quot;,<br>      }}<br>      onContextMenu={preventAction}<br>      onClick={preventAction}<br>      title=&quot;Educational content - external links disabled&quot;<br>    /&gt;<br>  ) : null<br>  {/* 4. onPause: Block &quot;More Videos&quot; - Main overlay area when paused (only onPause) */}<br>  {playerState === 2 ? (<br>    &lt;div<br>      style={{<br>        position: &quot;absolute&quot;,<br>        bottom: &quot;15%&quot;,<br>        left: 0,<br>        right: 0,<br>        height: &quot;30%&quot;,<br>        zIndex: 6,<br>        backgroundColor: &quot;transparent&quot;,<br>        pointerEvents: &quot;auto&quot;,<br>      }}<br>      onContextMenu={preventAction}<br>      onClick={preventAction}<br>      title=&quot;Educational content - external links disabled&quot;<br>    /&gt;<br>  ) : null<br>  {/* 5. onEnd: Block other Videos - overlay area when the video end (remove if not ended) */}<br>  {playerState === 0 ? (<br>    &lt;div<br>      style={{<br>        position: &quot;absolute&quot;,<br>        bottom: &quot;13%&quot;,<br>        left: 0,<br>        right: 0,<br>        height: &quot;87%&quot;,<br>        zIndex: 7,<br>        backgroundColor: &quot;transparent&quot;,<br>        pointerEvents: &quot;auto&quot;,<br>      }}<br>      onContextMenu={preventAction}<br>      onClick={preventAction}<br>      title=&quot;Educational content - external links disabled&quot;<br>    /&gt;<br>  ) : null}</pre><blockquote><strong>Note: </strong>You can easily customize the overlay and loading spinner styles by editing the inline styles or replacing them with your own CSS classes to better match your application’s design.</blockquote><p>Here’s a React component that puts it all together:</p><pre>// components/SecureYouTubePlayer.js<br>/**<br> * SecureYouTubePlayer Props:<br> * @param {string} videoId - YouTube video ID or URL (required)<br> * @param {string} [title] - Video title for accessibility (optional)<br> * @param {string} [width] - Iframe width (default: &#39;100%&#39;)<br> * @param {string} [height] - Iframe height (default: &#39;400&#39;)<br> * @param {function} [onPlay] - Callback when video starts playing (optional)<br> * @param {function} [exposePlayerControls] - Receives { pause, isPlaying } for parent control (optional)<br> */<br>import React, { useEffect, useRef, useState } from &quot;react&quot;;<br><br>/**<br> * SecureYouTubePlayer: Uses YouTube IFrame API to detect play events and calls onPlay (e.g., to stop audio).<br> * Also overlays top/bottom to block logo, share, and more videos, similar to SafeYouTubePlayer.<br> */<br>const SecureYouTubePlayer = ({<br>  videoId,<br>  title,<br>  width = &quot;100%&quot;,<br>  height = &quot;400&quot;,<br>  onPlay,<br>  exposePlayerControls,<br>}) =&gt; {<br>  const playerRef = useRef(null);<br>  const iframeRef = useRef(null);<br>  const [isLoading, setIsLoading] = useState(true);<br>  const [ytApiReady, setYtApiReady] = useState(false);<br>  const [youTubePlayerObject, setYouTubePlayerObject] = useState(null);<br>  // Track player state: -1=unstarted, 0=ended, 1=playing, 2=paused, 3=buffering, 5=video cued<br>  const [youTubePlayerState, setYouTubePlayerState] = useState(-1);<br><br>  // Extract video ID from full YouTube URL if needed<br>  const extractVideoId = (url) =&gt; {<br>    if (typeof url !== &quot;string&quot;) return url;<br>    const regex = /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([^&amp;\n?#]+)/;<br>    const match = url.match(regex);<br>    return match ? match[1] : url;<br>  };<br>  const safeVideoId = extractVideoId(videoId);<br><br>  // YouTube embed URL with security parameters<br>  const embedUrl = `https://www.youtube-nocookie.com/embed/${safeVideoId}?` +<br>    new URLSearchParams({<br>      rel: &quot;0&quot;,<br>      modestbranding: &quot;1&quot;,<br>      iv_load_policy: &quot;3&quot;,<br>      enablejsapi: &quot;1&quot;, // Enable JS API<br>      fs: &quot;0&quot;,<br>      showinfo: &quot;0&quot;,<br>      autoplay: &quot;0&quot;,<br>      controls: &quot;1&quot;,<br>      disablekb: &quot;1&quot;,<br>      origin: window.location.origin,<br>    });<br><br>  // Load YouTube IFrame API if not present<br>  useEffect(() =&gt; {<br>    if (window.YT &amp;&amp; window.YT.Player) {<br>      setYtApiReady(true);<br>      return;<br>    }<br>    const tag = document.createElement(&quot;script&quot;);<br>    tag.src = &quot;https://www.youtube.com/iframe_api&quot;;<br>    document.body.appendChild(tag);<br>    window.onYouTubeIframeAPIReady = () =&gt; setYtApiReady(true);<br>    return () =&gt; {<br>      window.onYouTubeIframeAPIReady = undefined;<br>    };<br>  }, []);<br><br>  // Create YT Player instance and listen for play events<br>  useEffect(() =&gt; {<br>    if (!ytApiReady || !iframeRef.current) return;<br>    if (youTubePlayerObject) {<br>      youTubePlayerObject.destroy();<br>    }<br>    // eslint-disable-next-line no-undef<br>    const player = new window.YT.Player(iframeRef.current, {<br>      events: {<br>        onReady: () =&gt; setIsLoading(false),<br>        onStateChange: (event) =&gt; {<br>          setYouTubePlayerState(event.data);<br>          // 1 = playing, 2 = paused, 0 = ended<br>          if (event.data === 1 &amp;&amp; typeof onPlay === &quot;function&quot;) {<br>            onPlay();<br>          }<br>        },<br>      },<br>    });<br>    setYouTubePlayerObject(player);<br>    // Expose pause and isPlaying methods to parent<br>    if (typeof exposePlayerControls === &quot;function&quot;) {<br>      exposePlayerControls({<br>        pause: () =&gt; player.pauseVideo &amp;&amp; player.pauseVideo(),<br>        isPlaying: () =&gt; player.getPlayerState &amp;&amp; player.getPlayerState() === 1,<br>      });<br>    }<br>    return () =&gt; {<br>      player.destroy();<br>      if (typeof exposePlayerControls === &quot;function&quot;) {<br>        exposePlayerControls(null);<br>      }<br>    };<br>    // eslint-disable-next-line react-hooks/exhaustive-deps<br>  }, [ytApiReady, safeVideoId]);<br><br>  // Prevent context menu and unwanted interactions<br>  const preventAction = (e) =&gt; {<br>    e.preventDefault();<br>    e.stopPropagation();<br>  };<br><br>  return (<br>    &lt;div<br>      ref={playerRef}<br>      className=&quot;secure-youtube-container&quot;<br>      style={{<br>        position: &quot;relative&quot;,<br>        width: &quot;100%&quot;,<br>        backgroundColor: &quot;#000&quot;,<br>        borderRadius: &quot;8px&quot;,<br>        overflow: &quot;hidden&quot;,<br>        boxShadow: &quot;0 4px 8px rgba(0,0,0,0.1)&quot;,<br>      }}<br>    &gt;<br>      {/* Loading indicator */}<br>      {isLoading &amp;&amp; (<br>        &lt;div<br>          style={{<br>            position: &quot;absolute&quot;,<br>            top: 0,<br>            left: 0,<br>            right: 0,<br>            bottom: 0,<br>            display: &quot;flex&quot;,<br>            alignItems: &quot;center&quot;,<br>            justifyContent: &quot;center&quot;,<br>            backgroundColor: &quot;#f0f0f0&quot;,<br>            zIndex: 10,<br>          }}<br>        &gt;<br>          &lt;div style={{ textAlign: &quot;center&quot; }}&gt;<br>            &lt;div<br>              style={{<br>                width: &quot;40px&quot;,<br>                height: &quot;40px&quot;,<br>                border: &quot;4px solid #f3f3f3&quot;,<br>                borderTop: &quot;4px solid #3498db&quot;,<br>                borderRadius: &quot;50%&quot;,<br>                animation: &quot;spin 1s linear infinite&quot;,<br>                margin: &quot;0 auto 10px&quot;,<br>              }}<br>            /&gt;<br>            &lt;p&gt;Loading educational video...&lt;/p&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      )}<br><br>      {/* --- Always-on overlays --- */}<br>      {/* 1. Block &quot;Copy Link&quot; and Title on the top (always on) */}<br>      &lt;div<br>        style={{<br>          position: &quot;absolute&quot;,<br>          top: 0,<br>          left: 0,<br>          right: 0,<br>          height: &quot;60px&quot;,<br>          zIndex: 5,<br>          backgroundColor: &quot;transparent&quot;,<br>          pointerEvents: &quot;auto&quot;,<br>        }}<br>        onContextMenu={preventAction}<br>        onClick={preventAction}<br>        title=&quot;Educational content - external links disabled&quot;<br>      /&gt;<br>      {/* 2. Block &quot;YouTube&quot; - Small bottom right area (always on) */}<br>      &lt;div<br>        style={{<br>          position: &quot;absolute&quot;,<br>          right: 0,<br>          bottom: 0,<br>          width: &quot;10%&quot;,<br>          height: &quot;36px&quot;,<br>          zIndex: 5,<br>          backgroundColor: &quot;transparent&quot;,<br>          pointerEvents: &quot;auto&quot;,<br>        }}<br>        onContextMenu={preventAction}<br>        onClick={preventAction}<br>        title=&quot;Educational content - external links disabled&quot;<br>      /&gt;<br><br>      {/* --- Conditional overlays --- */}<br>      {/* 3. Before start: Block &quot;Watch on YouTube&quot; - Small bottom left area (remove on play) */}<br>  {youTubePlayerState === -1 || youTubePlayerState === 5 ? (<br>        &lt;div<br>          style={{<br>            position: &quot;absolute&quot;,<br>            left: 0,<br>            bottom: 0,<br>            width: &quot;25%&quot;,<br>            height: &quot;50px&quot;,<br>            zIndex: 6,<br>            backgroundColor: &quot;transparent&quot;,<br>            pointerEvents: &quot;auto&quot;,<br>          }}<br>          onContextMenu={preventAction}<br>          onClick={preventAction}<br>          title=&quot;Educational content - external links disabled&quot;<br>        /&gt;<br>      ) : null}<br><br>      {/* 4. onPause: Block &quot;More Videos&quot; - Main overlay area when paused (only onPause) */}<br>  {youTubePlayerState === 2 ? (<br>        &lt;div<br>          style={{<br>            position: &quot;absolute&quot;,<br>            bottom: &quot;15%&quot;,<br>            left: 0,<br>            right: 0,<br>            height: &quot;30%&quot;,<br>            zIndex: 6,<br>            backgroundColor: &quot;transparent&quot;,<br>            pointerEvents: &quot;auto&quot;,<br>          }}<br>          onContextMenu={preventAction}<br>          onClick={preventAction}<br>          title=&quot;Educational content - external links disabled&quot;<br>        /&gt;<br>      ) : null}<br><br>      {/* 5. onEnd: Block other Videos - overlay area when the video end (remove if not ended) */}<br>  {youTubePlayerState === 0 ? (<br>        &lt;div<br>          style={{<br>            position: &quot;absolute&quot;,<br>            bottom: &quot;13%&quot;,<br>            left: 0,<br>            right: 0,<br>            height: &quot;87%&quot;,<br>            zIndex: 7,<br>            backgroundColor: &quot;transparent&quot;,<br>            pointerEvents: &quot;auto&quot;,<br>          }}<br>          onContextMenu={preventAction}<br>          onClick={preventAction}<br>          title=&quot;Educational content - external links disabled&quot;<br>        /&gt;<br>      ) : null}<br><br>      {/* YouTube iframe with API */}<br>      &lt;iframe<br>        ref={iframeRef}<br>        width={width}<br>        height={height}<br>        src={embedUrl}<br>        title={title || &quot;Educational Video&quot;}<br>        frameBorder=&quot;0&quot;<br>        allow=&quot;accelerometer; encrypted-media; gyroscope&quot;<br>        sandbox=&quot;allow-scripts allow-same-origin&quot;<br>        style={{<br>          borderRadius: &quot;8px&quot;,<br>          display: &quot;block&quot;,<br>        }}<br>        onLoad={() =&gt; setIsLoading(false)}<br>        onError={() =&gt; setIsLoading(false)}<br>      /&gt;<br><br>      {/* CSS Animation */}<br>      &lt;style jsx&gt;{`<br>        @keyframes spin {<br>          0% { transform: rotate(0deg); }<br>          100% { transform: rotate(360deg); }<br>        }<br>      `}&lt;/style&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default SecureYouTubePlayer;</pre><h3>How to use it in your Next.js app</h3><p>First save SecureYouTubePlayer.js and then use it in your pages:</p><pre>import React, { useRef } from &#39;react&#39;;<br>import SecureYouTubePlayer from &#39;./SecureYouTubePlayer&#39;;<br><br>function Example() {<br>  const playerRef = useRef();<br><br>  // Example: Pause video if another media starts<br>  function handleOtherMediaPlay() {<br>    if (playerRef.current &amp;&amp; playerRef.current.pause) {<br>      playerRef.current.pause();<br>    }<br>  }<br><br>  return (<br>    &lt;SecureYouTubePlayer<br>      videoId=&quot;O-wK1gva250&quot; // Example YouTube video ID<br>      exposePlayerControls={instance =&gt; { playerRef.current = instance; }}<br>      onPlay={handleOtherMediaPlay}<br>    /&gt;<br>  );<br>}</pre><blockquote><strong>Note</strong>: This component is intended for client-side use only. It relies on React hooks and the browser window object, and will not work during server-side rendering.</blockquote><h3>Core Functionality:</h3><ul><li>✅ <strong>Sandbox security</strong> — Primary protection mechanism</li><li>✅ <strong>Strategic overlays</strong> — Block Copy Link and More Videos areas</li><li>✅ <strong>Privacy-enhanced embedding</strong> — Uses youtube-nocookie.com</li></ul><p>Our solution isn’t perfect, but it keeps students focused and makes YouTube a safer tool for learning. If you’ve found a better way, please share it — together we can make online learning a little easier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c26e5a9817e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Out of Disk Space on a Linux vServer with Plesk Tools: My Experience and Solutions]]></title>
            <link>https://medium.com/@hakim.ziad/running-out-of-disk-space-on-a-linux-vserver-with-plesk-tools-my-experience-and-solutions-65c8fc58a72d?source=rss-e2052653a3fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/65c8fc58a72d</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[disk-space]]></category>
            <category><![CDATA[vps]]></category>
            <category><![CDATA[backup-manager]]></category>
            <category><![CDATA[plesk]]></category>
            <dc:creator><![CDATA[Ziad Hakim]]></dc:creator>
            <pubDate>Mon, 02 Sep 2024 09:35:48 GMT</pubDate>
            <atom:updated>2025-06-13T11:13:38.685Z</atom:updated>
            <content:encoded><![CDATA[<p>I want to share my experience of running out of disk space on my Ubuntu vServer, which I manage using the Plesk Obsidian administration tool.</p><p>When I first set up my cloud server, I opted for a vServer (VPS) with 40GB of storage from Ionos and used Nextcloud as the software to sync my files. It was a straightforward solution for my needs. However, after a few months, I ran out of space and needed to find a way to free up some disk space.</p><h4>Cleaning Up Plesk Temporary Files</h4><p>The first solution I found was cleaning up temporary Plesk files on my Linux server. Here’s how I did it:</p><ol><li>Open the Plesk Repair Kit by navigating to the following URL (replace hostname with your server’s IP address or hostname):<br><a href="https://yourserveraddress.com:8443/repair/">https://yourserveraddress.com:8443/repair/</a></li><li>Enter your Plesk Administrator credentials (username and password).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GKZfUqYXVsX9oCZ1MmHoQA.jpeg" /></figure><p>3. Click the “Free Up Disk Space” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8HFpYuPKtC_catfbqF8jA.jpeg" /></figure><p>You can also perform this task via the command-line interface if you prefer. However, this method only freed up about 300 MB of space for me.</p><h4>Deleting Old Backups</h4><p>The next step I took was to delete old backups:</p><ol><li>Log in to Plesk at (replace hostname with your server’s IP address or hostname):<br><a href="https://yourserveraddress.com:8443/">https://yourserveraddress.com:8443</a></li><li>Navigate to: <strong>Tools &amp; Settings &gt; Backup Manager</strong>.</li><li>Select all old backups and click the “Remove” button.</li><li>Click on “Settings.”</li><li>Under “Maximum number of full backup files to store (including both scheduled and manual backups),” I entered “1” (you can adjust this based on your needs).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ikDWJnTdtMPLU-9xY0R9Sg.jpeg" /></figure><p>6. Click the “Apply” button.</p><p>By following these steps, I was able to free up a significant amount of space on my server.</p><h4>Delete Plesk backup files via SSH</h4><p>go to the backup directory (/var/lib/psa/dumps) and use the rm command to remove the specific backup files</p><p>Login to your server via ssh</p><pre>ssh &lt;your-server-ip&gt;<br><br># 1. Remove backup files<br>cd /var/lib/psa/dumps<br># Identify the backup files to delete or delete old backups (for example older than 30 days)<br>find -name &#39;backup*&#39; -type f -ctime +30 -exec rm -rf {} +<br><br># 2. Remove backup logfiles:<br>cd /var/log/plesk/PMM/<br>find -name &#39;backup*&#39; -type f -ctime +30 -exec rm -rf {} +</pre><p><strong>Important Considerations</strong>:</p><ul><li><strong>Backup Management:</strong> Plesk’s Backup Manager is the recommended way to manage backups.</li><li><strong>Data Loss:</strong> Deleting backup files will permanently remove the data stored in them. Ensure you are deleting backups that are no longer needed.</li></ul><blockquote>Note: I used ChatGPT to help refine and correct my English in this article. I wanted to ensure it’s as clear and readable as possible for all readers.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65c8fc58a72d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upgrading to Nextcloud: Migrating from ownCloud with PHP 8 Compatibility Issues]]></title>
            <link>https://medium.com/@hakim.ziad/upgrading-to-nextcloud-migrating-from-owncloud-with-php-8-compatibility-issues-231109e0858d?source=rss-e2052653a3fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/231109e0858d</guid>
            <category><![CDATA[owncloud]]></category>
            <category><![CDATA[web-hosting]]></category>
            <category><![CDATA[nextcloud]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[php-8]]></category>
            <dc:creator><![CDATA[Ziad Hakim]]></dc:creator>
            <pubDate>Mon, 09 Jan 2023 22:44:14 GMT</pubDate>
            <atom:updated>2023-01-09T22:44:14.415Z</atom:updated>
            <content:encoded><![CDATA[<p>The employees at my customer’s company are using ownCloud version 10.8, but they can no longer access their files because the web hosting provider has turned off support for PHP 7.4, the version that ownCloud requires. The only solution is to switch to Nextcloud, which supports both PHP 7.4 and 8.</p><p>However, because the software version of ownCloud running on the production server is not the latest one, this transition can only be made if the server is running PHP 7.4.</p><blockquote>ownCloud PHP 8 Compatibility Issues exist in the current Version 10.11 the time I am writing this post.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lAboZ3lQkiVuEOZO" /><figcaption>Photo by <a href="https://unsplash.com/@vinhan?utm_source=medium&amp;utm_medium=referral">An Tran</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote><strong>Important:</strong> I am sharing my solution with you based on my own experience and information. If you are not familiar with the technical terms or steps involved, I recommend that you do not attempt to use this solution. I cannot be held responsible for any damage or loss of data that may occur as a result of following these steps.</blockquote><h4>Description of Solution Steps:</h4><ol><li>Create a new ownCloud docker instance with the same version as the production server (10.8).</li><li>Define the OWNCLOUD_VOLUME_FILES directory, which should be the same as on the original server (where the data directory is located).</li><li>Migrate the data from the production server to the new server.</li><li>Perform a manual upgrade of ownCloud from version 10.8 to 10.11 on the new server.</li><li>Migrate from ownCloud to Nextcloud, updating from version 10.11 to the latest version (25.0.x).</li><li>Migrate the updated data back to the production server.</li></ol><h4>Current Server Setup</h4><ul><li>Production Server run with PHP 8.1</li><li>ownCloud installation location: /var/www/owncloud/</li><li>Apache Document Root: /var/www/owncloud/</li><li>The HTTP user: www-data</li><li>Data Directory Location: /mnt/owncloud/data</li><li>ownCloud installed version: 10.8.0</li><li>ownCloud current latest version: 10.11</li><li>Nextcloud current latest version: 25.0.2</li><li>Docker and Docker-Compose are installed on a local computer</li></ul><blockquote><strong>Important!</strong> Make a full Back up of your existing ownCloud Production Server before you make any change. For more information see <a href="https://doc.owncloud.com/server/10.11/admin_manual/maintenance/backup_and_restore/backup.html">Backing up ownCloud</a></blockquote><p>So let’s go through the steps!</p><h3>Step 1: ownCloud Installation with Docker</h3><p>In this Example, I am running docker on a local Apple ARM M1 CPU computer and using <a href="https://docs.docker.com/compose/">Docker Compose</a> to start the containers.</p><blockquote>Note: This article assumes that you are already familiar with Docker and Docker-Compose. If not, there are many tutorials and articles for this on the internet</blockquote><p>Create a new project directory with 2 files docker-compose.yml and .env</p><p><strong>The environment configuration file .env:</strong></p><pre>OWNCLOUD_VERSION=10.8.0<br>OWNCLOUD_DOMAIN=localhost<br>OWNCLOUD_TRUSTED_DOMAINS=localhost<br>ADMIN_USERNAME=user1<br>ADMIN_PASSWORD=password<br>HTTP_PORT=80<br>OWNCLOUD_VOLUME_FILES=/mnt/owncloud/data</pre><p><strong>The docker-compose.yml file:</strong></p><pre>version: &quot;3&quot;<br><br>services:<br>  db:<br>    image: mysql:5.7<br>    volumes:<br>      - db_data:/var/lib/mysql<br>    restart: always<br>    environment:<br>      MYSQL_ROOT_PASSWORD: password<br>      MYSQL_DATABASE: owncloud_db<br>      MYSQL_USER: owncloud<br>      MYSQL_PASSWORD: password<br>    platform: linux/x86_64<br>    command: [&quot;--max-allowed-packet=128M&quot;, &quot;--innodb-log-file-size=64M&quot;]<br><br>  phpmyadmin:<br>    image: phpmyadmin<br>    depends_on:<br>      - db<br>    restart: always<br>    ports:<br>      - &#39;8088:80&#39;<br>    environment:<br>      PMA_HOST: db<br>      MYSQL_ROOT_PASSWORD: password<br>      UPLOAD_LIMIT: 300M<br><br>  owncloud:<br>    image: owncloud/server:${OWNCLOUD_VERSION}<br>    container_name: owncloud_server<br>    restart: always<br>    ports:<br>      - ${HTTP_PORT}:8080<br>    depends_on:<br>      - db<br>    environment:<br>      - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}<br>      - OWNCLOUD_TRUSTED_DOMAINS=${OWNCLOUD_TRUSTED_DOMAINS}<br>      - OWNCLOUD_DB_TYPE=mysql<br>      - OWNCLOUD_DB_NAME=owncloud_db<br>      - OWNCLOUD_DB_USERNAME=owncloud<br>      - OWNCLOUD_DB_PASSWORD=password<br>      - OWNCLOUD_DB_HOST=db<br>      - OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}<br>      - OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}<br>      - OWNCLOUD_MYSQL_UTF8MB4=true<br>      - OWNCLOUD_REDIS_ENABLED=false<br>      - OWNCLOUD_VOLUME_FILES=${OWNCLOUD_VOLUME_FILES}<br>    volumes:<br>      - $PWD/owncloud/config:/mnt/data<br>      - $PWD/owncloud/data:/mnt/owncloud/data<br>      #- /Volumes/owncloud/data:/mnt/owncloud/data<br>volumes:<br>  db_data: {}</pre><p>We create 3 containers:</p><ul><li>Database Container.</li><li>phpMyAdmin container to mange the database.</li><li>ownCloud server.</li><li>We define the OWNCLOUD_VOLUME_FILES directory, the same as on the original server where the data directory is located (as described in <strong>Step 2)</strong>.</li></ul><blockquote>Note: You can choose your own database name, usernames and passwords when you create <strong>docker-compose.yml </strong>and<strong> .env </strong>files</blockquote><h4>Start the containers</h4><pre>docker-compose up -d</pre><p>Wait till the containers are started then</p><h4>Enable Maintenance Mode</h4><p>You must run occ commands as the HTTP user, in this example on Ubuntu Linux www-data</p><pre>docker exec --user www-data owncloud_server occ maintenance:mode --on</pre><h3>Step 3: Migrate the data from the production server</h3><p>transfer the database and the data to the new server</p><h4>Transfer the Database</h4><p>In order to migrate the database from the production server to the database container, you can either use phpMyAdmin or log in to the database container and use SQL commands. Specifically, you will need to export the database from the production server and then import it into the database container.</p><h4>Transfer the Data and Configure the New Server</h4><p>Copy the data directory from the production server and mount it on the new server. This will allow you to access the data and configure the new server with the necessary settings.</p><p>Stop the containers:</p><pre>docker-compose down</pre><p>change docker-compose.yml owncloud volumes to point to the mounted data directory ( in my case: /Volumes/owncloud/data):</p><pre>owncloud:<br>  volumes:<br>      - $PWD/owncloud/config:/mnt/data<br>      # - $PWD/owncloud/data:/mnt/owncloud/data<br>      - /Volumes/owncloud/data:/mnt/owncloud/data</pre><p>Update the config.php file if required</p><p>Start the containers:</p><pre>docker-compose up -d</pre><p>Turn maintenance mode off</p><pre>docker exec --user www-data owncloud_server occ maintenance:mode --off</pre><p>Check if you can access ownCloud instance on the docker container with <a href="http://localhost/">http://localhost</a></p><h3>Step 4: Upgrading ownCloud on Docker</h3><p>Put ownCloud into maintenance mode and Shutdown the containers</p><pre>docker exec --user www-data owncloud_server occ maintenance:mode --on<br>docker-compose down</pre><p>Update the version number of ownCloud in your .env file.</p><pre>OWNCLOUD_VERSION=10.11</pre><p>Start the Containers</p><pre>docker-compose up -d</pre><p>Wait 4 or 5 Minutes till ownCloud available again, then turn maintenance mode off</p><pre>docker exec --user www-data owncloud_server occ maintenance:mode --off</pre><p>Check if ownCloud is now running version 10.11</p><h3>Step 5: Migrate from ownCloud to Nextcloud</h3><p>First set ownCloud in the maintenance mode, login to the ownCloud container</p><pre>docker exec --user www-data owncloud_server occ maintenance:mode --on<br>docker exec -it owncloud_server bash</pre><p>Download and unpack the latest <a href="https://nextcloud.com/install/">Nextcloud</a> Server release.</p><pre>mkdir -p /tmp/oc &amp;&amp; cd /tmp/oc<br>wget https://download.nextcloud.com/server/releases/latest.tar.bz2<br>wget https://download.nextcloud.com/server/releases/latest.tar.bz2.md5<br><br># Check package integrity using MD5<br>md5sum -c latest.tar.bz2.md5 &lt; latest.tar.bz2<br><br>tar -xjf latest.tar.bz2<br><br># move your current ownCloud directory<br>mv /var/www/owncloud /tmp/oc/owncloud_old<br><br>cp -r nextcloud /var/www/<br>cd /var/www<br><br># Rename<br>mv nextcloud owncloud<br><br># Copy the config/config.php file from your old ownCloud directory to your new Nextcloud directory.<br>rm owncloud/config/config.php<br>cp /tmp/oc/owncloud_old/config/config.php owncloud/config/<br><br># check config.php<br><br># Adjust file ownership and permissions<br>chown -R www-data:root owncloud<br>find owncloud/ -type d -exec chmod 750 {} \;<br>find owncloud/ -type f -exec chmod 750 {} \;<br><br># clean up<br>rm -fr /tmp/oc</pre><blockquote>Note: If you are using 3rd party application, or have additional apps folders, see the full Steps on the product <a href="https://docs.nextcloud.com/server/latest/admin_manual/maintenance/migrating_owncloud.html">documentation</a> pages</blockquote><p>Now launch the upgrade</p><pre>docker exec --user www-data owncloud_server occ upgrade</pre><p>when finished, login to the container and perform following commands:</p><pre>docker exec --user www-data -it owncloud_server bash<br><br>occ maintenance:mode --off<br>occ db:convert-filecache-bigint<br>occ db:add-missing-columns<br>occ db:add-missing-indices<br>occ db:add-missing-primary-keys<br><br># exist the container<br>exit</pre><p>Check of Nextcloud is now running properly.</p><h3>Step 6: Migrate Back to the Production Server</h3><p>First enable Maintenance Mode.</p><h4>Transfer the Database</h4><p>In order to transfer the database back from the docker database container to the production server, you can either use phpMyAdmin or log in to the database container and use SQL commands. Specifically, you will need to export the database from the database container and then import it into the production server.</p><h4>Transfer Data and Configure the Production Server</h4><p>You will need to do the following:</p><ol><li>Log in to the production server.</li><li>Move the ownCloud directory to a temporary location on the server.</li><li>Transfer the data from the ownCloud container to the production server.</li></ol><p>This process will allow you to access and configure the data on the production server.</p><blockquote>In the given command, “root” refers to the user who is logged in to the server, and “production_server_address” is the domain name or IP address of the server. This information is necessary to access and transfer data from the production server.</blockquote><pre>docker exec -it owncloud_server bash<br>rsync -avt /var/www/owncloud root@production_server_address:/var/www/owncloud</pre><p>To complete the migration process on the production server, you will need to do the following:</p><ol><li>Log in to the production server.</li><li>Check and update the config.php file located at /var/www/owncloud/config/config.php if necessary.</li><li>Verify all database-related information.</li><li>Check the data directory datadirectory.</li><li>Update the trusted domains.</li><li>Disable maintenance mode.</li><li>Adjust file ownership and permissions for all files that have been copied to the production server.</li></ol><p>This process will ensure that the production server is properly configured and ready for use.</p><p>Example on how to update Trusted Domains in <em>config.php</em> file and turn maintenance off. (owncloud.example.com is just an example domain):</p><pre># config.php an example for trusted_domain<br>&#39;trusted_domains&#39; =&gt;<br>  array (<br>    0 =&gt; &#39;localhost&#39;,<br>    1 =&gt; &#39;owncloud.example.com&#39;,<br>  ),<br>&#39;maintenance&#39; =&gt; false,</pre><p>To adjust file ownership and permissions</p><pre>cd /var/www/<br>chown -R www-data:root owncloud<br>find owncloud/ -type d -exec chmod 750 {} \;<br>find owncloud/ -type f -exec chmod 750 {} \;</pre><p>If you can log in to your Nextcloud production servers, the migration was successful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=231109e0858d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>