feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
This commit is contained in:
88
modules/system/classes/SystemController.php
Normal file
88
modules/system/classes/SystemController.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php namespace System\Classes;
|
||||
|
||||
use Lang;
|
||||
use Config;
|
||||
use Response;
|
||||
use Exception;
|
||||
use SystemException;
|
||||
use ApplicationException;
|
||||
use Illuminate\Routing\Controller as ControllerBase;
|
||||
|
||||
/**
|
||||
* The is the master controller for system related routing.
|
||||
* It is currently only responsible for serving up the asset combiner contents.
|
||||
*
|
||||
* @see System\Classes\CombineAssets Asset combiner class
|
||||
* @package winter\wn-system-module
|
||||
* @author Alexey Bobkov, Samuel Georges, Luke Towers
|
||||
*/
|
||||
class SystemController extends ControllerBase
|
||||
{
|
||||
/**
|
||||
* Combines JavaScript and StyleSheet assets.
|
||||
* @param string $name Combined file code
|
||||
* @return Response Combined content.
|
||||
*/
|
||||
public function combine($name)
|
||||
{
|
||||
try {
|
||||
if (!strpos($name, '-')) {
|
||||
return Response::make('/* '.e(Lang::get('system::lang.combiner.not_found', ['name' => $name])).' */', 404);
|
||||
}
|
||||
|
||||
$parts = explode('-', $name);
|
||||
|
||||
$cacheId = $parts[0];
|
||||
|
||||
$combiner = CombineAssets::instance();
|
||||
|
||||
return $combiner->getContents($cacheId);
|
||||
} catch (Exception $ex) {
|
||||
return Response::make('/* '.e($ex->getMessage()).' */', 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes an image using the provided configuration
|
||||
* and returns a redirect to the resized image
|
||||
*
|
||||
* @param string $identifier The identifier used to retrieve the image configuration
|
||||
* @param string $encodedUrl The double-encoded URL of the resized image, see https://github.com/octobercms/october/issues/3592#issuecomment-671017380
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function resizer(string $identifier, string $encodedUrl)
|
||||
{
|
||||
$resizedUrl = ImageResizer::getValidResizedUrl($identifier, $encodedUrl);
|
||||
if (empty($resizedUrl)) {
|
||||
return response('Invalid identifier or redirect URL', 400);
|
||||
}
|
||||
|
||||
// Attempt to process the resize
|
||||
try {
|
||||
$resizer = ImageResizer::fromIdentifier($identifier);
|
||||
$resizer->resize();
|
||||
} catch (SystemException $ex) {
|
||||
// If the resizing failed with a SystemException, it was most
|
||||
// likely because it is in progress or has already finished
|
||||
// although it could also be because the cache system used to store
|
||||
// configuration data is broken
|
||||
if (Config::get('cache.default', 'file') === 'array') {
|
||||
throw new Exception('Image resizing requires a persistent cache driver, "array" is not supported. Try changing config/cache.php -> default to a persistent cache driver.');
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
// If it failed for any other reason, restore the config so that
|
||||
// the resizer route will continue to work until it succeeds
|
||||
if (!empty($resizer)) {
|
||||
$resizer->storeConfig();
|
||||
}
|
||||
|
||||
// Rethrow the exception
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
// Redirect permanently as a resizer URL can only ever target the resized URL
|
||||
// embedded and signed within it, and crawlers should index the resized URL
|
||||
// rather than the temporary resizer URL
|
||||
return redirect()->to($resizedUrl, 301);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user