1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Http/Controllers/SubdomainController.php

60 lines
1.3 KiB
PHP
Raw Normal View History

2021-03-22 21:09:42 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2021-03-22 21:09:42 +01:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2021-03-22 21:09:42 +01:00
*/
namespace App\Http\Controllers;
use App\Libraries\MultiDB;
class SubdomainController extends BaseController
{
2021-04-28 05:12:51 +02:00
private $protected = [
'www',
'app',
'ninja',
'sentry',
2022-01-02 08:07:01 +01:00
'sentry2',
2021-04-28 05:12:51 +02:00
'staging',
'pdf',
'demo',
'docs',
'client_domain',
'custom_domain',
2021-07-25 13:51:41 +02:00
'preview',
'invoiceninja',
2021-08-18 23:41:34 +02:00
'cname',
2021-09-24 00:50:50 +02:00
'sandbox',
2021-10-01 00:55:35 +02:00
'stage',
2021-11-07 11:23:44 +01:00
'html',
2022-03-31 23:49:37 +02:00
'lb',
2022-05-15 03:08:05 +02:00
'shopify',
2022-06-14 14:18:20 +02:00
'beta',
2022-10-14 06:39:39 +02:00
'prometh'
2021-04-28 05:12:51 +02:00
];
2021-03-22 21:09:42 +01:00
public function __construct()
{
}
/**
* Display a listing of the resource.
*
* @return void
*/
public function index()
{
if (in_array(request()->input('subdomain'), $this->protected) || MultiDB::findAndSetDbByDomain(['subdomain' => request()->input('subdomain')])) {
return response()->json(['message' => 'Domain not available'], 401);
}
2021-03-22 21:09:42 +01:00
return response()->json(['message' => 'Domain available'], 200);
}
}