-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ac761f1
Showing
16 changed files
with
2,959 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
[*.md] | ||
indent_size = 2 | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.gitattributes export-ignore | ||
.github export-ignore | ||
.gitignore export-ignore | ||
.gitmodules export-ignore | ||
js/*/src export-ignore | ||
js/*/Gulfile.js | ||
js/*/package.json | ||
js/*/yarn.lock | ||
|
||
js/*/dist/*.js -diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
js/*/node_modules | ||
vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Flagrow | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Custom HTML Error Pages by  [Flagrow](https://discuss.flarum.org/d/1832-flagrow-extension-developer-group), a project of [Gravure](https://gravure.io/) | ||
|
||
[](https://github.com/flagrow/html-errors/blob/master/LICENSE.md) [](https://packagist.org/packages/flagrow/html-errors) [](https://packagist.org/packages/flagrow/html-errors) [](https://www.patreon.com/flagrow) [](https://flagrow.io/join-discord) | ||
|
||
This extension allows you to customize the Flarum error pages. | ||
By default these pages have very boring HTML content with no styling and no link in beta7. | ||
Now you can change them to something that better reflects your website! | ||
|
||
## Installation | ||
|
||
Use [Bazaar](https://discuss.flarum.org/d/5151-flagrow-bazaar-the-extension-marketplace) or install manually: | ||
|
||
```bash | ||
composer require flagrow/html-errors | ||
``` | ||
|
||
## Updating | ||
|
||
```bash | ||
composer update flagrow/html-errors | ||
php flarum migrate | ||
php flarum cache:clear | ||
``` | ||
|
||
## Configuration | ||
|
||
Open the extension options to configure the custom HTML. | ||
Leaving a field empty will show the default Flarum error page. | ||
|
||
The custom error pages are only applied when browsing the forum front-end. | ||
Any error response under /api or /admin is unaffected. | ||
|
||
You can handle additional error codes by entering the values manually in the `settings` table of the database. | ||
|
||
## Support our work | ||
|
||
We prefer to keep our work available to everyone. | ||
In order to do so we rely on voluntary contributions on [Patreon](https://www.patreon.com/flagrow). | ||
|
||
## Security | ||
|
||
If you discover a security vulnerability within Custom HTML Error Pages, please send an email to the Gravure team at [email protected]. All security vulnerabilities will be promptly addressed. | ||
|
||
Please include as many details as possible. You can use `php flarum info` to get the PHP, Flarum and extension versions installed. | ||
|
||
## Links | ||
|
||
- [Flarum Discuss post](https://discuss.flarum.org/d/10784-custom-html-error-pages) | ||
- [Source code on GitHub](https://github.com/flagrow/html-errors) | ||
- [Report an issue](https://github.com/flagrow/html-errors/issues) | ||
- [Download via Packagist](https://packagist.org/packages/flagrow/html-errors) | ||
|
||
An extension by [Flagrow](https://flagrow.io/), a project of [Gravure](https://gravure.io/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Flagrow\HtmlErrors; | ||
|
||
use Illuminate\Contracts\Events\Dispatcher; | ||
|
||
return function (Dispatcher $events) { | ||
$events->subscribe(Listeners\Assets::class); | ||
$events->subscribe(Listeners\Middlewares::class); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "flagrow/html-errors", | ||
"description": "Add custom HTML error pages", | ||
"keywords": [ | ||
"extension", | ||
"flarum", | ||
"error", | ||
"page", | ||
"html" | ||
], | ||
"type": "flarum-extension", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Clark Winkelmann", | ||
"email": "[email protected]", | ||
"homepage": "https://clarkwinkelmann.com/" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://github.com/flagrow/html-errors/issues", | ||
"source": "https://github.com/flagrow/html-errors" | ||
}, | ||
"require": { | ||
"flarum/core": "^0.1.0-beta.7" | ||
}, | ||
"extra": { | ||
"flarum-extension": { | ||
"title": "Flagrow HTML Errors", | ||
"icon": { | ||
"name": "exclamation-circle", | ||
"backgroundColor": "#f4f4f4", | ||
"color": "#5f4bb6" | ||
} | ||
}, | ||
"flagrow": { | ||
"discuss": "https://discuss.flarum.org/d/10784-custom-html-error-pages" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Flagrow\\HtmlErrors\\": "src/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const gulp = require('flarum-gulp'); | ||
|
||
gulp({ | ||
modules: { | ||
'flagrow/html-errors': 'src/**/*.js' | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
'use strict'; | ||
|
||
System.register('flagrow/html-errors/components/ErrorSettingsModal', ['flarum/app', 'flarum/components/SettingsModal'], function (_export, _context) { | ||
"use strict"; | ||
|
||
var app, SettingsModal, settingsPrefix, translationPrefix, ErrorSettingsModal; | ||
return { | ||
setters: [function (_flarumApp) { | ||
app = _flarumApp.default; | ||
}, function (_flarumComponentsSettingsModal) { | ||
SettingsModal = _flarumComponentsSettingsModal.default; | ||
}], | ||
execute: function () { | ||
settingsPrefix = 'flagrow-html-errors.'; | ||
translationPrefix = 'flagrow-html-errors.admin.settings.'; | ||
|
||
ErrorSettingsModal = function (_SettingsModal) { | ||
babelHelpers.inherits(ErrorSettingsModal, _SettingsModal); | ||
|
||
function ErrorSettingsModal() { | ||
babelHelpers.classCallCheck(this, ErrorSettingsModal); | ||
return babelHelpers.possibleConstructorReturn(this, (ErrorSettingsModal.__proto__ || Object.getPrototypeOf(ErrorSettingsModal)).apply(this, arguments)); | ||
} | ||
|
||
babelHelpers.createClass(ErrorSettingsModal, [{ | ||
key: 'title', | ||
value: function title() { | ||
return app.translator.trans(translationPrefix + 'title'); | ||
} | ||
}, { | ||
key: 'className', | ||
value: function className() { | ||
return 'Modal--large'; | ||
} | ||
}, { | ||
key: 'form', | ||
value: function form() { | ||
var _this2 = this; | ||
|
||
return [403, 404, 500, 503].map(function (error) { | ||
return m('.Form-group', [m('label', app.translator.trans(translationPrefix + 'error.' + error)), m('textarea.FormControl', { | ||
bidi: _this2.setting(settingsPrefix + 'custom' + error + 'ErrorHtml'), | ||
placeholder: app.translator.trans(translationPrefix + 'placeholder.empty_for_default') | ||
})]); | ||
}); | ||
} | ||
}]); | ||
return ErrorSettingsModal; | ||
}(SettingsModal); | ||
|
||
_export('default', ErrorSettingsModal); | ||
} | ||
}; | ||
});; | ||
'use strict'; | ||
|
||
System.register('flagrow/html-errors/main', ['flarum/extend', 'flarum/app', 'flagrow/html-errors/components/ErrorSettingsModal'], function (_export, _context) { | ||
"use strict"; | ||
|
||
var extend, app, ErrorSettingsModal; | ||
return { | ||
setters: [function (_flarumExtend) { | ||
extend = _flarumExtend.extend; | ||
}, function (_flarumApp) { | ||
app = _flarumApp.default; | ||
}, function (_flagrowHtmlErrorsComponentsErrorSettingsModal) { | ||
ErrorSettingsModal = _flagrowHtmlErrorsComponentsErrorSettingsModal.default; | ||
}], | ||
execute: function () { | ||
|
||
app.initializers.add('flagrow-html-errors', function (app) { | ||
app.extensionSettings['flagrow-html-errors'] = function () { | ||
return app.modal.show(new ErrorSettingsModal()); | ||
}; | ||
}); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"private": true, | ||
"devDependencies": { | ||
"gulp": "^3.8.11", | ||
"flarum-gulp": "^0.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import app from 'flarum/app'; | ||
import SettingsModal from 'flarum/components/SettingsModal'; | ||
|
||
const settingsPrefix = 'flagrow-html-errors.'; | ||
const translationPrefix = 'flagrow-html-errors.admin.settings.'; | ||
|
||
export default class ErrorSettingsModal extends SettingsModal { | ||
title() { | ||
return app.translator.trans(translationPrefix + 'title'); | ||
} | ||
|
||
className() { | ||
return 'Modal--large'; | ||
} | ||
|
||
form() { | ||
return [403, 404, 500, 503].map( | ||
error => m('.Form-group', [ | ||
m('label', app.translator.trans(translationPrefix + 'error.' + error)), | ||
m('textarea.FormControl', { | ||
bidi: this.setting(settingsPrefix + 'custom' + error + 'ErrorHtml'), | ||
placeholder: app.translator.trans(translationPrefix + 'placeholder.empty_for_default'), | ||
}), | ||
]) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {extend} from 'flarum/extend'; | ||
import app from 'flarum/app'; | ||
import ErrorSettingsModal from 'flagrow/html-errors/components/ErrorSettingsModal'; | ||
|
||
app.initializers.add('flagrow-html-errors', app => { | ||
app.extensionSettings['flagrow-html-errors'] = () => app.modal.show(new ErrorSettingsModal()); | ||
}); |
Oops, something went wrong.