[DigitalPoint] App for Cloudflare®

[DigitalPoint] App for Cloudflare® 1.8.2

No permission to download
What exactly does that addon not do that you are trying to do?
It optimizes all images which stored in XenForo to lower size and do not loss quality.

So, in my case it went crazy once I installed your addon. The latest attachment id uploaded to R2 is id #1157917 while the addon is optimizing fake ids because when I look for those attachment ids none of them exist (in fact, it says the latest attachment is #118977:
Screenshot 2023-04-14 at 8.06.36 PM.webp
 
It optimizes all images which stored in XenForo to lower size and do not loss quality.

So, in my case it went crazy once I installed your addon. The latest attachment id uploaded to R2 is id #1157917 while the addon is optimizing fake ids because when I look for those attachment ids none of them exist (in fact, it says the latest attachment is #118977:
View attachment 284628
Sounds like a question for the author of that addon. I don’t know anything about it myself. If that addon isn’t using XenForo’s abstracted file system, it’s not going to work properly in all likelihood. Basically if the addon is assuming files are in the local filesystem and not using XenForo’s filesystem which handles that, it’s going to be an issue.

But again, I don’t know anything about that addon or how it works or what it’s trying to do or if it’s doing whatever it does “properly” (by using XenForo’s abstracted filesystem).

If you have a question specific to the Cloudflare addon, I should be able to help.
 
So I didn't particularly want to completely rebuild what Cloudflare already has, so it's not a full-blown interface for DMARC management, but I did incorporate what seems to be the most important part (the table of unapproved DMARC sources). The chart is nice fluff, but it doesn't really do a whole lot for you as far as as tracking things down. Maybe I'll revisit it when it's out of beta, but for now the addon will give you unapproved DMARC sources for the last 14 days (for whatever reason, Cloudflare's reporting engine seems to get inaccurate if you go with 30 days (looks like they are sampling the data rather than using the exact data on the 30 day report). And if someone wants more than that, there's a deep link direct into your dashboard to get at the other stuff.
Since it hasn't been in place for 30 days yet, the data may be doing some odd things. I do find the email volume numbers useful for tracking also.

1681520138503.webp
 
Eager to see WordPress version :)
There's a few screenshots in this thread:

 
  • Like
Reactions: ivp
I can't manage to connect using R2, any ideas?
My config:
Code:
[r2]
type = s3
provider = Cloudflare
env_auth = false
secret_access_key = 332e76XXXXXXXXX3eabf8
endpoint = https://aa585780XXXXXX56.r2.cloudflarestorage.com/internal-data-xfmg
acl = private
access_key_id = bdXXXca4
region = auto
However when I run rclone lsf r2: to get the list of buckets I get the following error:
Code:
[root@server ~]# 
2023/04/15 19:41:13 ERROR : : error listing: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your secret access key and signing method.
    status code: 403, request id: , host id:
2023/04/15 19:41:13 Failed to lsf with 2 errors: last error was: error in ListJSON: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your secret access key and signing method.
    status code: 403, request id: , host id:
I'm pretty sure both key and secret key are OK.
Any ideas? @MattW @Mouth how did you manage to connect to R2?
 
I can't manage to connect using R2, any ideas?
My config:
Code:
[r2]
type = s3
provider = Cloudflare
env_auth = false
secret_access_key = 332e76XXXXXXXXX3eabf8
endpoint = https://aa585780XXXXXX56.r2.cloudflarestorage.com/internal-data-xfmg
acl = private
access_key_id = bdXXXca4
region = auto
However when I run rclone lsf r2: to get the list of buckets I get the following error:
Code:
[root@server ~]#
2023/04/15 19:41:13 ERROR : : error listing: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your secret access key and signing method.
    status code: 403, request id: , host id:
2023/04/15 19:41:13 Failed to lsf with 2 errors: last error was: error in ListJSON: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your secret access key and signing method.
    status code: 403, request id: , host id:
I'm pretty sure both key and secret key are OK.
Any ideas? @MattW @Mouth how did you manage to connect to R2?
From the error, I would double check your credentials... the error is saying the secret access key is incorrect, so that would be a good place to start double checking (make sure you don't have a stray invisible character in it like a space or something too.
 
digitalpoint updated [DigitalPoint] App for Cloudflare® with a new update entry:

DMARC mangement and some minor things

  • Consolidated buttons for new firewall rules into a menu
  • Consolidated buttons for new cache rules into a menu
  • Stop click propagation when clicking on link to Cloudflare in stats block header (prevents block from hiding/showing when you are just trying to go to Cloudflare dashboard)
  • Viewing statistics block on main admin page requires admin permission viewAnalytics (not the permission for managing cloudflare) and block is hidden if the user doesn't have the necessary...

Read the rest of this update entry...
 

[DigitalPoint] App for Cloudflare® 1.6.1​

Server error log
  • XF\PrintableException: Template admin:index error: Cloudflare zone not found: domain.com
  • src/addons/DigitalPoint/Cloudflare/Traits/XF.php:161

Stack trace​

#0 src/addons/DigitalPoint/Cloudflare/Repository/Cloudflare.php(825): DigitalPoint\Cloudflare\Repository\Cloudflare->printableException(Object(XF\Phrase))
#1 src/addons/DigitalPoint/Cloudflare/Repository/Cloudflare.php(33): DigitalPoint\Cloudflare\Repository\CloudflareAbstract->getZoneId('domain.com', true)
#2 src/addons/DigitalPoint/Cloudflare/Template/Callback/Cloudflare.php(45): DigitalPoint\Cloudflare\Repository\CloudflareAbstract->getDashBase()
#3 src/XF/Template/Templater.php(1696): DigitalPoint\Cloudflare\Template\Callback\Cloudflare::getStats('', Array, Object(SV\AdvancedBbCodesPack\XF\Template\Templater))
#4 internal_data/code_cache/templates/l1/s0/admin/index.php(212): XF\Template\Templater->callback('DigitalPoint\\Cl...', 'getStats', '', Array)
#5 src/XF/Template/Templater.php(1652): XF\Template\Templater->{closure}(Object(SV\AdvancedBbCodesPack\XF\Template\Templater), Array, NULL)
#6 src/addons/MaZ/AUN/XF/Template/Templater.php(39): XF\Template\Templater->renderTemplate('index', Array, true, NULL)
#7 src/XF/Template/Template.php(24): MaZ\AUN\XF\Template\Templater->renderTemplate('admin:index', Array)
#8 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#9 src/XF/Mvc/Dispatcher.php(460): XF\Mvc\Renderer\Html->renderView('XF:Index', 'admin:index', Array)
#10 src/XF/Mvc/Dispatcher.php(442): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#11 src/XF/Mvc/Dispatcher.php(402): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(60): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#13 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
#14 src/XF.php(524): XF\App->run()
#15 admin.php(13): XF::runApp('XF\\Admin\\App')
#16 {main}

Request state​

array(4) {
["url"] => string(10) "/admin.php"
["referrer"] => string(44) "https://domain.com/admin.php?tools/rebuild"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}


I got the following error, does anyone have the same problem?
 
Do you have an API token set? And if so, is it an API token for a domain you have in Cloudflare that matches your site’s domain?
 
Thanks for the wonderful addon - actually a life and time saver!

Is there a way to migrate attachments stored in AWS S3 from a xenForo 1.4 forum to xenForo 2.0 and Cloudflare R2? Thanks!
 
Thanks for the wonderful addon - actually a life and time saver!

Is there a way to migrate attachments stored in AWS S3 from a xenForo 1.4 forum to xenForo 2.0 and Cloudflare R2? Thanks!
I believe the rclone tool lets you move data between different cloud storage providers.

 
Would be terrific to have R2 related statistics within the ACP Cloudflare Stats section ( /admin.php )
Bring the /admin.php?cloudflare/r2 figures ( objects, size, class A/B Ops ) into the day/week/month/year tabs.
 
Couple small bugs with v1.6.1:

1. DMARK Management: Unapproved DMARC Sources also includes Approved Sources in list
Hmmm... it appears to be working okay for my zones, but I do see something that might affect it, but I don't have a way to test it since it's working for me. If you go to the DigitalPoint\Cloudflare\Api\Advanced.php file, inside the getGraphQLDmarcSources method, change this:

PHP:
'date_gt' => $dateFrom->format('Y-m-d'),
'date_leq' => $currentDate->format('Y-m-d'),

to this (effectively adding that one line at the end):
PHP:
'date_gt' => $dateFrom->format('Y-m-d'),
'date_leq' => $currentDate->format('Y-m-d'),
'sourceOrgSlug_neq' => '',

...does that fix it for you in your setup?

2. DMARK Management: The DMARK Management link back to Cloudflare's page adds "www." to your domain name making the link invalid (i.e. https://dash.cloudflare.com/YOURCLOUDFLAREID/www.yoursite.com/email/dmarc-management should be https://dash.cloudflare.com/YOURCLOUDFLAREID/yoursite.com/email/dmarc-management
That's fixed for next version (it was using the site's hostname for the deeplink rather than the intended matching zone... it correctly found the right zone from your Cloudflare account, but then used the hostname that was matching it vs. the zone that matched).


Would be terrific to have R2 related statistics within the ACP Cloudflare Stats section ( /admin.php )
Going to say "no" to that one right out of the gate. The reason is two-fold:
  1. It's a lot of underlying API queries to get the info that it displays on the R2 page. Specifically, it's 3 API calls to get the totals for the Cloudflare account, and then an additional 4 API calls for each bucket you have (so for a site that has the Resource Manager bucket enabled as well as the other two, you are looking at 15 API calls to get the info needed that it presents on the R2 page). I had to do some trickery by doing all 15 of those requests in parallel to get it all in a reasonable amount of time. So just purely on principle, it's probably not a great idea to be doing 15 Cloudflare API calls every time any admin is just on the main admin index page. It ends up being a ton of API calls being done where most of the time the user triggering them isn't even interested in that info (like maybe they just logged into the admin and landed on the index). The stats it's giving already is a little simpler because the data for all 6 charts is able to be done in a single API call.
  2. The other (maybe bigger, depending on the site) issue is that the API calls for R2 info are all billable operations (most are class B, but a couple are class A). So probably not a great idea to add 15 billable R2 operations anytime an admin lands on the admin index page because now we are talking about potentially actual cost to show it.

Bring the /admin.php?cloudflare/r2 figures ( objects, size, class A/B Ops ) into the day/week/month/year tabs.
That might be more realistic since you are keeping those billable operations at once per day rather than every time page view of the admin index page. It probably makes sense to keep it to actual events in the course of a 24 hour period. Cumulative numbers don't work with XenForo's statistics because it's designed to only handle daily numbers for each statistic (stats that were "totals" would generate crazy/wrong charts if you flipped to weekly or monthly grouping because the "total" for each day would be added to the totals from other days in the week/month, so things would be counted multiple times. It's why you don't see things like "total threads" or "total users" in there.

So for things like "objects" and "size", you would have to limit it to just that 24 hour period, but then what are you looking for exactly? Objects created in the last 24 hours? Objects deleted in the last 24 hours? You wouldn't be able to do net new objects (created minus deleted) because the xf_stats_daily table only handles unsigned values (greater than or equal to 0), so you would end up with problems if you had a day where more objects were deleted than created.
 
...does that fix it for you in your setup?

Adding that line of code did not make a difference for me. I even went to Cloudflare and toggled the approved source back to unapproved and approved again, still no change in list shown in XF.

One other small bug...the floating bubble on the chart has the pass/fail labels backwords

1681761298236.webp
 
Last edited:
Adding that line of code did not make a difference for me. I even went to Cloudflare and toggled the approved source back to unapproved and approved again, still no change in list shown in XF.
Are you seeing them differentiated in the Cloudflare dashboard? As far as I can tell, I'm using the same query that the dashboard is using and it's showing exactly the same as the Cloudflare dashboard for me.

One other small bug...the floating bubble on the chart has the pass/fail labels backwords

View attachment 284766
Ya, I already fixed that for the next version.
 
Are you seeing them differentiated in the Cloudflare dashboard? As far as I can tell, I'm using the same query that the dashboard is using and it's showing exactly the same as the Cloudflare dashboard for me.
Yes.

Showing on Cloudflare...

cf-approved.webp

cf-unapproved.webp

Versus showing in XenForo...

xf-app-unapproved.webp
 
I figured out what's going on... Cloudflare is doing things slightly differently on different domains for some reason. I noticed it when comparing two of my own domains and was able to track it down and fix it for any zone (hopefully). The sorting is worked out as well. So will be part of the next release.
 
Top Bottom