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") {
|
if ($tld === "org") {
|
||||||
$subdomain_repo = array(
|
$subdomain_repo = array(
|
||||||
"docs" => array("docs", "pages"),
|
// subdomain => array(owner, repo, allowCORS),
|
||||||
"fonts" => array("codeberg-fonts", "pages"),
|
"docs" => array("docs", "pages", false),
|
||||||
"get-it-on" => array("get-it-on", "pages"),
|
"fonts" => array("codeberg-fonts", "pages", true),
|
||||||
"design" => array("Codeberg", "Design")
|
"get-it-on" => array("get-it-on", "pages", false),
|
||||||
|
"design" => array("Codeberg", "Design", true)
|
||||||
);
|
);
|
||||||
if (array_key_exists($subdomain, $subdomain_repo)) {
|
if (array_key_exists($subdomain, $subdomain_repo)) {
|
||||||
$owner = $subdomain_repo[$subdomain][0];
|
$owner = $subdomain_repo[$subdomain][0];
|
||||||
$repo = $subdomain_repo[$subdomain][1];
|
$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: *");
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$owner = strtolower(array_shift($request_url_parts));
|
$owner = strtolower(array_shift($request_url_parts));
|
||||||
if (!$owner) {
|
if (!$owner) {
|
||||||
|
|
Loading…
Reference in a new issue