Skip to content

Commit

Permalink
Merge branch 'craft-4' of https://github.com/verbb/social-poster into…
Browse files Browse the repository at this point in the history
… craft-5

# Conflicts:
#	CHANGELOG.md
#	composer.json
  • Loading branch information
engram-design committed May 29, 2024
2 parents 6be5121 + 80cf9ff commit 3374f4c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@
- Update `elementChip()` references.
- Fix an error when uninstalling.

## 4.0.11 - 2024-05-29

### Changed
- Update English translations.

## 4.0.10 - 2024-04-29

### Added
- Add support for `headlessMode` redirect URIs.

### Changed
- Update English translations.

## 4.0.9 - 2024-04-05

### Added
Expand Down
4 changes: 4 additions & 0 deletions src/SocialPoster.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ private function _registerCpRoutes(): void
$event->rules['social-poster/accounts/new'] = 'social-poster/accounts/edit';
$event->rules['social-poster/accounts/<handle:{handle}>'] = 'social-poster/accounts/edit';
$event->rules['social-poster/settings'] = 'social-poster/plugin/settings';

if (Craft::$app->getConfig()->getGeneral()->headlessMode || !Craft::$app->getConfig()->getGeneral()->cpTrigger) {
$event->rules['social-poster/auth/callback'] = 'social-poster/auth/callback';
}
});
}

Expand Down
6 changes: 5 additions & 1 deletion src/base/OAuthAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public function getRedirectUri(): ?string
{
$siteId = Craft::$app->getSites()->getCurrentSite()->id ?? Craft::$app->getSites()->getPrimarySite()->id;

// We should always use the primary site for the redirect
// Check for Headless Mode and use the Action URL, or when `cpTrigger` is empty to signify split front/back-end
if (Craft::$app->getConfig()->getGeneral()->headlessMode || !Craft::$app->getConfig()->getGeneral()->cpTrigger) {
return UrlHelper::cpUrl('social-poster/auth/callback', null, null, $siteId);
}

return UrlHelper::siteUrl('social-poster/auth/callback', null, null, $siteId);
}

Expand Down

0 comments on commit 3374f4c

Please sign in to comment.