appwrite/app/controllers/web/console.php

44 lines
1.3 KiB
PHP
Raw Normal View History

2019-05-09 06:54:39 +00:00
<?php
2023-05-01 15:43:32 +00:00
use Appwrite\Utopia\Request;
2022-05-26 13:23:49 +00:00
use Appwrite\Utopia\Response;
2020-06-28 17:31:21 +00:00
use Utopia\App;
2019-05-09 06:54:39 +00:00
2022-11-22 21:14:38 +00:00
App::init()
->groups(['web'])
->inject('request')
->inject('response')
->action(function (Request $request, Response $response) {
$response
->addHeader('X-Frame-Options', 'SAMEORIGIN') // Avoid console and homepage from showing in iframes
->addHeader('X-XSS-Protection', '1; mode=block; report=/v1/xss?url=' . \urlencode($request->getURI()))
->addHeader('X-UA-Compatible', 'IE=Edge') // Deny IE browsers from going into quirks mode
;
});
2024-07-17 17:24:52 +00:00
App::get('/')
->alias('auth/*')
2022-10-31 08:53:36 +00:00
->alias('/invite')
->alias('/login')
2024-02-23 11:13:22 +00:00
->alias('/mfa')
2023-07-10 21:20:24 +00:00
->alias('/card/*')
2022-10-31 08:53:36 +00:00
->alias('/recover')
->alias('/register/*')
2022-10-11 14:36:39 +00:00
->groups(['web'])
2019-05-09 06:54:39 +00:00
->label('permission', 'public')
->label('scope', 'home')
2023-05-01 15:43:32 +00:00
->inject('request')
Database layer (#3338) * database response model * database collection config * new database scopes * database service update * database execption codes * remove read write permission from database model * updating tests and fixing some bugs * server side tests are now passing * databases api * tests for database endpoint * composer update * fix error * formatting * formatting fixes * get database test * more updates to events and usage * more usage updates * fix delete type * fix test * delete database * more fixes * databaseId in attributes and indexes * more fixes * fix issues * fix index subquery * fix console scope and index query * updating tests as required * fix phpcs errors and warnings * updates to review suggestions * UI progress * ui updates and cleaning up * fix type * rework database events * update tests * update types * event generation fixed * events config updated * updating context to support multiple * realtime updates * fix ids * update context * validator updates * fix naming conflict * fix tests * fix lint errors * fix wprler and realtime tests * fix webhooks test * fix event validator and other tests * formatting fixes * removing leftover var_dumps * remove leftover comment * update usage params * usage metrics updates * update database usage * fix usage * specs update * updates to usage * fix UI and usage * fix lints * internal id fixes * fixes for internal Id * renaming services and related files * rename tests * rename doc link * rename readme * fix test name * tests: fixes for 0.15.x sync Co-authored-by: Torsten Dittmann <torsten.dittmann@googlemail.com>
2022-06-22 10:51:49 +00:00
->inject('response')
->action(function (Request $request, Response $response) {
2024-07-17 17:24:52 +00:00
$url = parse_url($request->getURI());
$target = "/console{$url['path']}";
$params = $request->getParams();
if (!empty($params)) {
$target .= "?" . \http_build_query($params);
2023-05-01 15:43:32 +00:00
}
2024-07-17 17:24:52 +00:00
if ($url['fragment'] ?? false) {
$target .= "#{$url['fragment']}";
}
$response->redirect($target);
2022-10-31 08:53:36 +00:00
});