mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-01-19 08:57:55 +00:00
Allow CORS only to design.codeberg.org and fonts.codeberg.org, or on "raw.*.non-org-tld"
This commit is contained in:
parent
c5115c10fd
commit
c06c201b90
1 changed files with 9 additions and 6 deletions
|
@ -20,16 +20,19 @@ $repo = "pages";
|
|||
|
||||
if ($tld === "org") {
|
||||
$subdomain_repo = array(
|
||||
"docs" => array("docs", "pages"),
|
||||
"fonts" => array("codeberg-fonts", "pages"),
|
||||
"get-it-on" => array("get-it-on", "pages"),
|
||||
"design" => array("Codeberg", "Design")
|
||||
// subdomain => array(owner, repo, allowCORS),
|
||||
"docs" => array("docs", "pages", false),
|
||||
"fonts" => array("codeberg-fonts", "pages", true),
|
||||
"get-it-on" => array("get-it-on", "pages", false),
|
||||
"design" => array("Codeberg", "Design", true)
|
||||
);
|
||||
if (array_key_exists($subdomain, $subdomain_repo)) {
|
||||
$owner = $subdomain_repo[$subdomain][0];
|
||||
$repo = $subdomain_repo[$subdomain][1];
|
||||
// Allow CORS requests to static *.codeberg.org pages, for web fonts etc.
|
||||
if ($subdomain_repo[$subdomain][2]) {
|
||||
// Allow CORS requests to specified pages, for web fonts etc.
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
}
|
||||
} else {
|
||||
$owner = strtolower(array_shift($request_url_parts));
|
||||
if (!$owner) {
|
||||
|
|
Loading…
Reference in a new issue