Skip to content

Commit

Permalink
migrated to Licenses Directory and transfered licenseUrl to json
Browse files Browse the repository at this point in the history
  • Loading branch information
tellmeY18 committed Oct 10, 2024
1 parent 4f32cd6 commit bc1a589
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 58 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,68 +1,14 @@
import React, { useState, useEffect } from "react";
import Card from "../CAREUI/display/Card";
import Card from "../../CAREUI/display/Card";
import dayjs from "dayjs";
import { CopyToClipboard } from "react-copy-to-clipboard";
import axios from "axios";

const licenseUrls: { [key: string]: string } = {
MIT: "https://opensource.org/licenses/MIT",
"GPL-3.0": "https://www.gnu.org/licenses/gpl-3.0.en.html",
"GPL-3.0-or-later": "https://www.gnu.org/licenses/gpl-3.0.en.html",
"Apache-2.0": "https://www.apache.org/licenses/LICENSE-2.0",
ISC: "https://opensource.org/licenses/ISC",
"0BSD": "https://opensource.org/licenses/0BSD",
"OFL-1.1": "https://opensource.org/licenses/OFL-1.1",
"BSD-3-Clause": "https://opensource.org/licenses/BSD-3-Clause",
"BSD-2-Clause": "https://opensource.org/licenses/BSD-2-Clause",
"LGPL-2.1": "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html",
"LGPL-3.0": "https://www.gnu.org/licenses/lgpl-3.0.en.html",
"AGPL-3.0": "https://www.gnu.org/licenses/agpl-3.0.en.html",
"MPL-2.0": "https://www.mozilla.org/en-US/MPL/2.0/",
"EPL-2.0": "https://www.eclipse.org/legal/epl-2.0/",
"CC-BY-4.0": "https://creativecommons.org/licenses/by/4.0/",
Unlicense: "https://unlicense.org/",
"BlueOak-1.0.0": "https://blueoakcouncil.org/license/1.0.0",
"GPL-2.0": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html",
"GPL-2.0-or-later":
"https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html",
"LGPL-2.0": "https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html",
"LGPL-2.0-or-later":
"https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html",
"AGPL-1.0": "https://www.gnu.org/licenses/agpl-1.0.html",
"AGPL-1.0-or-later": "https://www.gnu.org/licenses/agpl-1.0.html",
"AGPL-2.0": "https://www.gnu.org/licenses/agpl-2.0.html",
"AGPL-2.0-or-later": "https://www.gnu.org/licenses/agpl-2.0.html",
"AGPL-3.0-or-later": "https://www.gnu.org/licenses/agpl-3.0.en.html",
"MPL-1.1": "https://www.mozilla.org/MPL/MPL-1.1.html",
"MPL-1.0": "https://www.mozilla.org/MPL/MPL-1.0.html",
"EPL-1.0": "https://www.eclipse.org/legal/epl-v10.html",
"CC-BY-SA-4.0": "https://creativecommons.org/licenses/by-sa/4.0/",
"CC-BY-NC-4.0": "https://creativecommons.org/licenses/by-nc/4.0/",
"CC-BY-ND-4.0": "https://creativecommons.org/licenses/by-nd/4.0/",
"CC-BY-NC-SA-4.0": "https://creativecommons.org/licenses/by-nc-sa/4.0/",
"CC-BY-NC-ND-4.0": "https://creativecommons.org/licenses/by-nc-nd/4.0/",
"CC0-1.0": "https://creativecommons.org/publicdomain/zero/1.0/",
"Artistic-2.0": "https://opensource.org/licenses/Artistic-2.0",
"EUPL-1.2": "https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12",
"EUPL-1.1": "https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-11",
"EUPL-1.0": "https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-10",
Zlib: "https://opensource.org/licenses/Zlib",
"BSL-1.0": "https://opensource.org/licenses/BSL-1.0",
"Apache-1.1": "https://opensource.org/licenses/Apache-1.1",
"Apache-1.0": "https://opensource.org/licenses/Apache-1.0",
"AFL-3.0": "https://opensource.org/licenses/AFL-3.0",
"AFL-2.1": "https://opensource.org/licenses/AFL-2.1",
"AFL-2.0": "https://opensource.org/licenses/AFL-2.0",
"AFL-1.2": "https://opensource.org/licenses/AFL-1.2",
"AFL-1.1": "https://opensource.org/licenses/AFL-1.1",
"AFL-1.0": "https://opensource.org/licenses/AFL-1.0",
};
import licenseUrls from "./licenseUrls.json";

const getLicenseUrl = (licenseId: string | undefined): string | null => {
if (!licenseId) return null;
return licenseUrls[licenseId] || null;
return licenseUrls[licenseId as keyof typeof licenseUrls] || null;
};

interface CycloneDXExternalRef {
url?: string;
type?: string;
Expand Down
51 changes: 51 additions & 0 deletions src/Components/Licenses/licenseUrls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"MIT": "https://opensource.org/licenses/MIT",
"GPL-3.0": "https://www.gnu.org/licenses/gpl-3.0.en.html",
"GPL-3.0-or-later": "https://www.gnu.org/licenses/gpl-3.0.en.html",
"Apache-2.0": "https://www.apache.org/licenses/LICENSE-2.0",
"ISC": "https://opensource.org/licenses/ISC",
"0BSD": "https://opensource.org/licenses/0BSD",
"OFL-1.1": "https://opensource.org/licenses/OFL-1.1",
"BSD-3-Clause": "https://opensource.org/licenses/BSD-3-Clause",
"BSD-2-Clause": "https://opensource.org/licenses/BSD-2-Clause",
"LGPL-2.1": "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html",
"LGPL-3.0": "https://www.gnu.org/licenses/lgpl-3.0.en.html",
"AGPL-3.0": "https://www.gnu.org/licenses/agpl-3.0.en.html",
"MPL-2.0": "https://www.mozilla.org/en-US/MPL/2.0/",
"EPL-2.0": "https://www.eclipse.org/legal/epl-2.0/",
"CC-BY-4.0": "https://creativecommons.org/licenses/by/4.0/",
"Unlicense": "https://unlicense.org/",
"BlueOak-1.0.0": "https://blueoakcouncil.org/license/1.0.0",
"GPL-2.0": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html",
"GPL-2.0-or-later": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html",
"LGPL-2.0": "https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html",
"LGPL-2.0-or-later": "https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html",
"AGPL-1.0": "https://www.gnu.org/licenses/agpl-1.0.html",
"AGPL-1.0-or-later": "https://www.gnu.org/licenses/agpl-1.0.html",
"AGPL-2.0": "https://www.gnu.org/licenses/agpl-2.0.html",
"AGPL-2.0-or-later": "https://www.gnu.org/licenses/agpl-2.0.html",
"AGPL-3.0-or-later": "https://www.gnu.org/licenses/agpl-3.0.en.html",
"MPL-1.1": "https://www.mozilla.org/MPL/MPL-1.1.html",
"MPL-1.0": "https://www.mozilla.org/MPL/MPL-1.0.html",
"EPL-1.0": "https://www.eclipse.org/legal/epl-v10.html",
"CC-BY-SA-4.0": "https://creativecommons.org/licenses/by-sa/4.0/",
"CC-BY-NC-4.0": "https://creativecommons.org/licenses/by-nc/4.0/",
"CC-BY-ND-4.0": "https://creativecommons.org/licenses/by-nd/4.0/",
"CC-BY-NC-SA-4.0": "https://creativecommons.org/licenses/by-nc-sa/4.0/",
"CC-BY-NC-ND-4.0": "https://creativecommons.org/licenses/by-nc-nd/4.0/",
"CC0-1.0": "https://creativecommons.org/publicdomain/zero/1.0/",
"Artistic-2.0": "https://opensource.org/licenses/Artistic-2.0",
"EUPL-1.2": "https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12",
"EUPL-1.1": "https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-11",
"EUPL-1.0": "https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-10",
"Zlib": "https://opensource.org/licenses/Zlib",
"BSL-1.0": "https://opensource.org/licenses/BSL-1.0",
"Apache-1.1": "https://opensource.org/licenses/Apache-1.1",
"Apache-1.0": "https://opensource.org/licenses/Apache-1.0",
"AFL-3.0": "https://opensource.org/licenses/AFL-3.0",
"AFL-2.1": "https://opensource.org/licenses/AFL-2.1",
"AFL-2.0": "https://opensource.org/licenses/AFL-2.0",
"AFL-1.2": "https://opensource.org/licenses/AFL-1.2",
"AFL-1.1": "https://opensource.org/licenses/AFL-1.1",
"AFL-1.0": "https://opensource.org/licenses/AFL-1.0"
}
2 changes: 1 addition & 1 deletion src/Routers/SessionRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Login, ResetPassword } from "../Components/Auth";
import { useRoutes } from "raviger";
import SessionExpired from "../Components/ErrorPages/SessionExpired";
import InvalidReset from "../Components/ErrorPages/InvalidReset";
import LicensesPage from "../Components/LicensesPage";
import LicensesPage from "../Components/Licenses/LicensesPage";

const routes = {
"/": () => <Login />,
Expand Down

0 comments on commit bc1a589

Please sign in to comment.