[DigitalPoint] App for Cloudflare®

[DigitalPoint] App for Cloudflare® 1.9.1.1

No permission to download
There's an internal option that stores your Cloudflare Account ID (can see it on the debug options page if you have debugging enabled).

The error you see would be because the account ID isn't set (it's important that it's set).

Normally it's all automatic, but there is a mechanism where the addon would erase the value that is set there. Specifically, if an API request is made and Cloudflare returns a 10000 error (which is an authentication error... meaning your API token credentials are not correct). The intent is that it will pick up the correct account ID once the issue resolves itself (the token has permissions to work with it).

If you set secondary restrictions on your token (for example only certain IPs can use it), you really should remove that restriction... because if your server ever makes a request from an IP you didn't whitelist, the API request will fail because you told Cloudflare to only allow the token to be used from a specific IP. It will cause nothing but problems... additionally, IP restrictions can't be used with presigned URLs unless you are whitelisting the IPs of your users (which obviously can't realistically be the case).

If it's only an issue with whatever "future post" thing you are doing, maybe somehow it's doing those from a different IP than the server normally uses (like maybe it's being pushed to a cron job that runs elsewhere). But again... save yourself future headaches and disable IP restrictions on token usage if you put one in place.
 
digitalpoint updated [DigitalPoint] App for Cloudflare® with a new update entry:

Adds R2 streaming & geo-location functionality

First of all, this is a big(ish) update...

Large R2 attachments should see the download start much faster for end users (rather than downloading it fully on the server before sending it to user, it's done with streams now). Honestly not sure why I didn't do it that way to begin with, but thanks to @Chris D for pointing out my stupidity oversight. It's still going to be more performant to be using presigned URLs, so the streaming change is only if you aren't using...

Read the rest of this update entry...
 
Tried to install in XF 2.2.latest and got this error:

Server error log
  • XF\Db\InvalidQueryException: Batch install error: xf_session_activity: MySQL query error [1163]: The used table type doesn't support BLOB/TEXT columns
  • src/XF/Db/AbstractStatement.php:230
  • Generated by: [removed]
  • Jan 28, 2025 at 2:25 PM

Stack trace

Code:
ALTER TABLE `xf_session_activity`
ADD `ip_geo` BLOB DEFAULT NULL
------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1163, '42000')
#1 src/XF/Db/Mysqli/Statement.php(78): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1163, '42000')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/Schema/AbstractDdl.php(158): XF\Db\AbstractAdapter->query('ALTER TABLE `xf...')
#4 src/XF/Db/SchemaManager.php(154): XF\Db\Schema\AbstractDdl->apply()
#5 src/addons/DigitalPoint/Cloudflare/Setup.php(32): XF\Db\SchemaManager->alterTable('xf_session_acti...', Object(Closure))
#6 src/XF/AddOn/StepRunnerUpgradeTrait.php(124): DigitalPoint\Cloudflare\Setup->upgrade1090010Step1(Array)
#7 src/XF/AddOn/StepRunnerUpgradeTrait.php(73): DigitalPoint\Cloudflare\Setup->upgradeStepRunner(1090010, 1, Array, NULL)
#8 src/XF/Job/AddOnInstallBatch.php(299): DigitalPoint\Cloudflare\Setup->upgrade(Array)
#9 src/XF/Job/AddOnInstallBatch.php(91): XF\Job\AddOnInstallBatch->stepAction(Object(XF\Timer))
#10 src/XF/Job/Manager.php(260): XF\Job\AddOnInstallBatch->run(8)
#11 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#12 src/XF/Job/Manager.php(118): XF\Job\Manager->runJobEntry(Array, 8)
#13 src/XF/Admin/Controller/Tools.php(122): XF\Job\Manager->runByIds(Array, 8)
#14 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#15 src/XF/Mvc/Dispatcher.php(258): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\XF\Admin\Controller\Tools), NULL)
#16 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\XF\Admin\Controller\Tools), NULL)
#17 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#18 src/XF/App.php(2513): XF\Mvc\Dispatcher->run()
#19 src/XF.php(524): XF\App->run()
#20 admin.php(13): XF::runApp('XF\\Admin\\App')
#21 {main}

Request state

Code:
array(4) {
  ["url"] => string(24) "/admin.php?tools/run-job"
  ["referrer"] => string(46) "https://flightinfo.com/admin.php?tools/run-job"
  ["_GET"] => array(1) {
    ["tools/run-job"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["_xfRedirect"] => string(83) "https://flightinfo.com/admin.php?add-ons/install-from-archive-complete&batch_id=264"
    ["_xfToken"] => string(8) "********"
    ["only_ids"] => string(6) "287037"
  }
}
 
Tried to install in XF 2.2.latest and got this error:

Server error log
  • XF\Db\InvalidQueryException: Batch install error: xf_session_activity: MySQL query error [1163]: The used table type doesn't support BLOB/TEXT columns
  • src/XF/Db/AbstractStatement.php:230
  • Generated by: [removed]
  • Jan 28, 2025 at 2:25 PM

Stack trace

Code:
ALTER TABLE `xf_session_activity`
ADD `ip_geo` BLOB DEFAULT NULL
------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1163, '42000')
#1 src/XF/Db/Mysqli/Statement.php(78): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1163, '42000')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/Schema/AbstractDdl.php(158): XF\Db\AbstractAdapter->query('ALTER TABLE `xf...')
#4 src/XF/Db/SchemaManager.php(154): XF\Db\Schema\AbstractDdl->apply()
#5 src/addons/DigitalPoint/Cloudflare/Setup.php(32): XF\Db\SchemaManager->alterTable('xf_session_acti...', Object(Closure))
#6 src/XF/AddOn/StepRunnerUpgradeTrait.php(124): DigitalPoint\Cloudflare\Setup->upgrade1090010Step1(Array)
#7 src/XF/AddOn/StepRunnerUpgradeTrait.php(73): DigitalPoint\Cloudflare\Setup->upgradeStepRunner(1090010, 1, Array, NULL)
#8 src/XF/Job/AddOnInstallBatch.php(299): DigitalPoint\Cloudflare\Setup->upgrade(Array)
#9 src/XF/Job/AddOnInstallBatch.php(91): XF\Job\AddOnInstallBatch->stepAction(Object(XF\Timer))
#10 src/XF/Job/Manager.php(260): XF\Job\AddOnInstallBatch->run(8)
#11 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#12 src/XF/Job/Manager.php(118): XF\Job\Manager->runJobEntry(Array, 8)
#13 src/XF/Admin/Controller/Tools.php(122): XF\Job\Manager->runByIds(Array, 8)
#14 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#15 src/XF/Mvc/Dispatcher.php(258): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\XF\Admin\Controller\Tools), NULL)
#16 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(DigitalPoint\Analytics\XF\Admin\Controller\Tools), NULL)
#17 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#18 src/XF/App.php(2513): XF\Mvc\Dispatcher->run()
#19 src/XF.php(524): XF\App->run()
#20 admin.php(13): XF::runApp('XF\\Admin\\App')
#21 {main}

Request state

Code:
array(4) {
  ["url"] => string(24) "/admin.php?tools/run-job"
  ["referrer"] => string(46) "https://flightinfo.com/admin.php?tools/run-job"
  ["_GET"] => array(1) {
    ["tools/run-job"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["_xfRedirect"] => string(83) "https://flightinfo.com/admin.php?add-ons/install-from-archive-complete&batch_id=264"
    ["_xfToken"] => string(8) "********"
    ["only_ids"] => string(6) "287037"
  }
}
FML... I forgot people still use MEMORY tables. Hold off on update. Going to have to push out a new version. Boo...
 
Flags, awesome. Great work. I'm trying to get them to work. So I updated the add on.
Enabled this;
1738092848831.webp
Also enabled the group permission "view country..."

But I don't see it. Do I need to purge cache or wait for it to come magically? :P

Thanks.
 
Flags, awesome. Great work. I'm trying to get them to work. So I updated the add on.
Enabled this;
View attachment 318154
Also enabled the group permission "view country..."

But I don't see it. Do I need to purge cache or wait for it to come magically? :P

Thanks.
It's not retroactive... it's picking up the geo data from HTTP requests, so historical HTTP requests (and those headers) aren't there any longer. If someone was technical enough, they could backfill with something else that does geo-location lookup for IPs (like MaxMind database), but for this addon/function it's only moving forward since it's HTTP request based.
 
Umm, it's not okay am I right?

View attachment 318156
It's reliant on your browser/operating system supporting unicode country flags. Do you have a different device (like a phone) to see if it's device specific? It creates a geo.less template that is compiled, so it's also possible you need to rebuild template/master data if it didn't get compiled by XenForo for whatever reason.
 
Ooh. The setting also adds location data on visitors page. How long is this data retained? Tons of bots are going to add a lot of data to the database!
 
Any guide for that?
You can do it from the CLI: php cmd.php xf:rebuild-master-data

Besides that, I honestly don't even know... but I'm sure there must be a way via XF admin. Maybe someone else knows?

Ooh. The setting also adds location data on visitors page. How long is this data retained? Tons of bots are going to add a lot of data to the database!
Only as long as the session_activity table has the record of session activity. It adds a special column to that table just to temporarily store the geo data (that works a little different than the other stuff which happens when an IP is logged to the xf_ip table). Generally speaking, the session activity records are short-lived.
 
Is it okay?

CSS:
span.country:before {
    content: ' / ';
}

.message-cell--user .country {
    position: absolute;
    z-index: 1;
    top: 0;
    right: 15px;
    font-size: 32px;
}

<xf:foreach loop="{{ ['AC', 'CP', 'DG', 'EA', 'EU', 'EZ', 'FX', 'IC', 'SU', 'TA', 'UK', 'UN', 'AD','AE','AF','AG','AI','AL','AM','AO','AQ','AR','AS','AT','AU','AW','AX','AZ','BA','BB','BD','BE','BF','BG','BH','BI','BJ','BL','BM','BN','BO','BQ','BR','BS','BT','BV','BW','BY','BZ','CA','CC','CD','CF','CG','CH','CI','CK','CL','CM','CN','CO','CR','CU','CV','CW','CX','CY','CZ','DE','DJ','DK','DM','DO','DZ','EC','EE','EG','EH','ER','ES','ET','FI','FJ','FK','FM','FO','FR','GA','GB','GD','GE','GF','GG','GH','GI','GL','GM','GN','GP','GQ','GR','GS','GT','GU','GW','GY','HK','HM','HN','HR','HT','HU','ID','IE','IL','IM','IN','IO','IQ','IR','IS','IT','JE','JM','JO','JP','KE','KG','KH','KI','KM','KN','KP','KR','KW','KY','KZ','LA','LB','LC','LI','LK','LR','LS','LT','LU','LV','LY','MA','MC','MD','ME','MF','MG','MH','MK','ML','MM','MN','MO','MP','MQ','MR','MS','MT','MU','MV','MW','MX','MY','MZ','NA','NC','NE','NF','NG','NI','NL','NO','NP','NR','NU','NZ','OM','PA','PE','PF','PG','PH','PK','PL','PM','PN','PR','PS','PT','PW','PY','QA','RE','RO','RS','RU','RW','SA','SB','SC','SD','SE','SG','SH','SI','SJ','SK','SL','SM','SN','SO','SR','SS','ST','SV','SX','SY','SZ','TC','TD','TF','TG','TH','TJ','TK','TL','TM','TN','TO','TR','TT','TV','TW','TZ','UA','UG','UM','US','UY','UZ','VA','VC','VE','VG','VI','VN','VU','WF','WS','YE','YT','ZA','ZM','ZW'] }}" value="$code">
    .country.{$code|to_lower}:after {
        content: " {$code|iso_to_unicode|to_upper}";
    }
</xf:foreach>
 
Back
Top Bottom