Skip to content

Setup OGProxy for use in NodeBB

Moved Let's Build It
  • result with latest code @phenomlab :

    image.png

    My css :

    *----------------------------------------------------------------------------*/
    /*------------------        nodebb-plugin-OGPROXY       ----------------------*/
    /*----------------------------------------------------------------------------*/
    
    /* Desktop */
    
    /* Iframe */
    .card img.card-favicon {
        max-width: 21px;
        max-height: 21px;
        margin-right: 10px;
    }
    h4.card-site-title {
        color: var(--bs-body-color);
        text-transform: capitalize;
    }
    .card.card-preview {
        margin: 20px 0 20px 0;
        width: 50%;
    }
    [component="chat/message"] .card.card-preview {
        margin: 20px 0 20px 0;
        width: 30%;
    }
    .card.card-preview img:not(.card-favicon) {
        object-fit: cover;
        width: 100%;
        max-height: 15rem;
        border-top-left-radius: 0.375rem;
        border-top-right-radius: 0.375rem;
    }
      .card.card-preview .img-fluid {
        max-width: 100% !important;
      }
      .card-preview p.card-text {
        font-size: 80%;
        color: var(--bs-body-color);
        
      }
      .card-preview h5.card-title {
        font-weight: 600;
        font-size: 120%;
        color: var(--bs-body-color);
    }
    
    /* Effect hover Iframe */
    .card-image-container {
        max-width: 100%;
        max-height: 250px;
        overflow: hidden;
        border-top-left-radius: 0.375rem !important;
        border-top-right-radius: 0.375rem !important;
    }
    #card-image {
        -webkit-transition: all 0.8s ease;
        -moz-transition: all 0.8s ease;
        transition: all 0.8s ease;
    }
    #card-image:hover {
        transform: scale(1.5,1.5);
      }
      
    .card.card-wrapper {
        background: none;
        width: 450px;
    }
    
    /* Smartphone */
    @media (max-width: 1010px) {
        [component="chat/message"] .card.card-preview {
        margin: 20px 0 20px 0;
        width: 100%;
        }
        
        .card.card-preview {
        margin: 20px 0 20px 0;
        width: 100%;
    }
    }
    

    maybe you should put the css code in github

  • Thanks. I’ve just seen another bug on mobile because I didn’t add the mobile class. I’ll do it tomorrow and update the code

  • @phenomlab

    fixed 🙂

    with this code (add no border and change width) :

    .card.card-wrapper {
        background: none;
        border: none;
        /* width: 450px; */
        width: 100%;
    }
    

    All the code fixed for Desktop & Smartphone and adding Effect hover Iframe :

    /*----------------------------------------------------------------------------*/
    /*------------------        nodebb-plugin-OGPROXY       ----------------------*/
    /*----------------------------------------------------------------------------*/
    
    /* Desktop */
    
    .card img.card-favicon {
        max-width: 21px;
        max-height: 21px;
        margin-right: 10px;
    }
    h4.card-site-title {
        color: var(--bs-body-color);
        text-transform: capitalize;
    }
    .card.card-preview {
        margin: 20px 0 20px 0;
        width: 50%;
    }
    .card.card-wrapper {
        background: none;
        border: none;
        /* width: 450px; */
        width: 100%;
    }
    [component="chat/message"] .card.card-preview {
        margin: 20px 0 20px 0;
        width: 30%;
    }
    .card.card-preview img:not(.card-favicon) {
        object-fit: cover;
        width: 100%;
        max-height: 15rem;
        border-top-left-radius: 0.375rem;
        border-top-right-radius: 0.375rem;
    }
      .card.card-preview .img-fluid {
        max-width: 100% !important;
      }
      .card-preview p.card-text {
        font-size: 80%;
        color: var(--bs-body-color);
      }
      .card-preview h5.card-title {
        font-weight: 600;
        font-size: 120%;
        color: var(--bs-body-color);
    }
    
    /* Effect hover Iframe */
    .card-image-container {
        max-width: 100%;
        max-height: 250px;
        overflow: hidden;
        border-top-left-radius: 0.375rem !important;
        border-top-right-radius: 0.375rem !important;
    }
    #card-image {
        -webkit-transition: all 0.8s ease;
        -moz-transition: all 0.8s ease;
        transition: all 0.8s ease;
    }
    #card-image:hover {
        transform: scale(1.5,1.5);
      }
    
    /* Smartphone */
    @media (max-width: 1010px) {
        [component="chat/message"] .card.card-preview {
        margin: 20px 0 20px 0;
        width: 100%;
        }
        
        .card.card-preview {
        margin: 20px 0 20px 0;
        width: 100%;
    }
    }
    
  • Found another bug where mentions are converted into preview links in chat where they shouldn’t be (thanks @DownPW for reporting).

    https://github.com/phenomlab/ogproxy/blob/main/function.js

  • i confused. what i have to do add or delete 🙂

  • @cagatay see below

    https://github.com/phenomlab/ogproxy/blob/03d5ff125611361700d785bd82a6ab16fcd68bfc/function.js#L7

    It’s basically this line - replace what you already have in your JS functions with this one.

  • @phenomlab i think did it 🙂

  • phenomlabundefined phenomlab referenced this topic on
  • hi @phenomlab , what would be the difference between running this on server side (as link-preview plugin) or on client side (as ogproxy) in layman’s terms?

  • @crazycells In laymen terms, it means that there is zero load on the server because all rendering of website previews is handled client side. This makes it more performant on budget hosts because the processing is handled by the visiting web browser.

    All sessions are also cached meaning it has superior speed.

  • @phenomlab are they cached for each user separately?

    additionally, this is also handling youtube videos etc, right?

  • @crazycells said in Setup OGProxy for use in NodeBB:

    are they cached for each user separately?

    No. It’s a shared cache

    @crazycells said in Setup OGProxy for use in NodeBB:

    additionally, this is also handling youtube videos etc, right?

    No. This is handled by nodebb-plugin-ns-embed


  • 1 Votes
    26 Posts
    1k Views

    Yes ogproxy too is functionnal on dev

  • 15 Votes
    27 Posts
    1k Views

    For anyone else coming here and is struggling to get pm2 to work with Umami (as I did - it started, but never seemed to work after a reboot which is pretty useless), you can use the below. Obviously, change the parts noted inside the [brackets]. Follow the below instructions:

    Instructions

    Open a terminal and create a new systemd service file:

    sudo nano /etc/systemd/system/umami.service

    Add the following content to the file:

    [Unit] Description=Umami Analytics Server After=network.target [Service] Type=simple User=[umami user] WorkingDirectory=[path to umami] ExecStart=/usr/local/bin/node [path to umami]/node_modules/.bin/next start Restart=on-failure [Install] WantedBy=multi-user.target

    Replace [umami user] with the username of the user that should run the Umami service, and [path to umami] with the actual path to your Umami installation.

    Save the file and exit the editor.

    Reload the systemd manager configuration:

    sudo systemctl daemon-reload

    Enable the Umami service to start on boot:

    sudo systemctl enable umami.service

    Start the Umami service:

    sudo systemctl start umami.service

    You can check the status of the service with:

    sudo systemctl status umami.service

    This systemd service file will ensure that Umami starts automatically when the system boots, and it will restart the service if it fails. Remember to adjust the WorkingDirectory and ExecStart paths according to where Umami is installed on your system, and ensure that Node.js is installed and accessible at /usr/bin/node (or adjust the path to Node.js as necessary).

  • 15 Votes
    51 Posts
    3k Views

    Oh yes, that’s what’s super cool, I learn something every day. Afterwards I start from so low in JS

  • 19 Votes
    35 Posts
    2k Views

    @DownPW said in Threaded chat support for NodeBB:

    Better like this : add shadow and border-left on self answer

    Of course - you style to your own requirements and taste 🙂 I’ll commit that CSS we discussed yesterday also

  • 50 Votes
    146 Posts
    18k Views

    Updated git for above change

    https://github.com/phenomlab/nodebb-harmony-threading/commit/14a4e277521d83d219065ffb14154fd5f5cfac69

  • 20 Votes
    28 Posts
    811 Views

    thanks Mark.

  • node vs nodejs confusion?

    Solved Configure
    2
    1 Votes
    2 Posts
    144 Views

    @eeeee have a look at the below

    https://docs.nodebb.org/installing/os/ubuntu/

    curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash - sudo apt-get install -y nodejs

    You’ll notice that we are in fact “installing” NodeJS but never actually have a need to reference it. Here’s the nodejs --version command on my dev system

    6eb1482e-0c9b-454d-aa84-199bcc845702-image.png

    More detail here

    https://askubuntu.com/questions/1030622/why-do-i-see-different-versions-of-node-and-nodejs

  • 11 Votes
    14 Posts
    601 Views

    @dave1904 excellent news. Thanks for the feedback