Giter Site home page Giter Site logo

Comments (8)

davidmpurdy avatar davidmpurdy commented on August 15, 2024 1

That doesn't cause any issues for the block that I can see (this past week got busy and I haven't done much to get an actual PR ready anyway).

My only question is whether it's worth creating the base URL in its own function so it wouldn't have to be changed in PHP and JS in the future if it changed again? Maybe even including the account ID so the two places we interface with the API just need to be aware of endpoint/authentication/payload? Or maybe that's over-thinking it since it's not likely to change often if at all.

Edit: Also, I like the approach to automatically getting the account ID if it's needed. Realizing there's a slight edge case where I don't believe uploading a new video via the block would trigger the update, and since we're generating the iframe locally, is it conceivable that if someone was just uploading (not browsing) they might not trigger the update for a while? I don't know if it matters since the zone endpoint still works, just thinking if we did get the base URL from a function, that could be used to trigger the update.

Apologies if any of this is half-baked - I'm still in the midst of some big work deadlines so I haven't thought through this as carefully as I normally would.

from cloudflare-stream-wordpress.

B-Interactive avatar B-Interactive commented on August 15, 2024 1

Thanks @davidmpurdy , that's a good point regarding the base URL, and it would actually benefit solutions for the variable sub-domains, or even Cloudflare URL options (videodelivery.net, cloudflarestream.com) which may be a part of that solution too.

I'll take another look at it and see about eliminating redundancy on the current doubling up of those request functions too.

from cloudflare-stream-wordpress.

davidmpurdy avatar davidmpurdy commented on August 15, 2024 1

Minor bug with trying to upgrade to the account ID when it doesn't exist.

Fixed with #13

from cloudflare-stream-wordpress.

davidmpurdy avatar davidmpurdy commented on August 15, 2024

I don't think I fully understand how zones are supposed to relate to Stream structurally (if at all). Using zones feels a little strange to me since my understanding is that they're a level down, structurally (Stream is at the account level, zones are at the domain level, right?).

It is easier to get working though (I checked and it seems to work with any of the zone IDs in the account with Stream). I think you're right that's a Cloudflare question - I'd be interested to hear if that's an intentional architecture decision or maybe an accident of implementation.

from cloudflare-stream-wordpress.

B-Interactive avatar B-Interactive commented on August 15, 2024

I think you're right @davidmpurdy, it would seem zones aren't supposed to really come into play with Stream.

My implementation using zones was originally at least, taking advantage of what now appears to be an anomaly with that end-point.

Given the official recommendation seems to be to use /accounts (for Stream), and currently this plugin does not try to take advantage of the data available with /zones, I will commence switching it over to /accounts.

Cloudflare have said they will look into including an API call that can retrieve the account specific subdomain, so that's something to keep an eye out for.

from cloudflare-stream-wordpress.

B-Interactive avatar B-Interactive commented on August 15, 2024

I've pushed a branch with this update, but I want to run it by you @davidmpurdy first, to make sure this isn't going to impact your current efforts with the blocks. Please let me know!

If the plugin is already set up with Zone ID and API token, this update will automatically pull and save the Account ID, so no intervention should be needed by the user. This action is prompted by either of these two things:

  1. An admin accesses the plugin's settings page (regardless of whether Save Settings is hit).
  2. A Cloudflare Stream API call is made.

In both scenarios, the Account ID is only fetched, if it isn't already in the local database. It is using add_option(), so it will not update an existing Account ID, only an absent one.

from cloudflare-stream-wordpress.

B-Interactive avatar B-Interactive commented on August 15, 2024

Completed with 8aec255.

from cloudflare-stream-wordpress.

B-Interactive avatar B-Interactive commented on August 15, 2024

Thanks for picking that up, and providing the patch!

from cloudflare-stream-wordpress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.