From 5f40b8a0bcc45de33a37d05b4a656111c0903ac8 Mon Sep 17 00:00:00 2001 From: Sonia Appasamy Date: Tue, 28 Nov 2023 13:15:19 -0500 Subject: [PATCH] scripts/check_license_headers: enforce license on ts/tsx files Enforcing inclusion of our OSS license at the top of .ts and .tsx files. Also updates any relevant files in the repo that were previously missing the license comment. An additional `@license` comment is added to client/web/src/index.tsx to preserve the license in generated Javascript. Updates #10261 Signed-off-by: Sonia Appasamy --- client/web/src/api.ts | 3 +++ client/web/src/components/acl-tag.tsx | 3 +++ client/web/src/components/app.tsx | 3 +++ client/web/src/components/exit-node-selector.tsx | 3 +++ client/web/src/components/login-toggle.tsx | 3 +++ client/web/src/components/update-available.tsx | 3 +++ .../web/src/components/views/device-details-view.tsx | 3 +++ client/web/src/components/views/home-view.tsx | 3 +++ client/web/src/components/views/login-view.tsx | 3 +++ client/web/src/components/views/ssh-view.tsx | 3 +++ client/web/src/components/views/updating-view.tsx | 3 +++ client/web/src/hooks/auth.ts | 3 +++ client/web/src/hooks/exit-nodes.ts | 3 +++ client/web/src/hooks/node-data.ts | 3 +++ client/web/src/hooks/self-update.ts | 3 +++ client/web/src/index.tsx | 10 ++++++++++ client/web/src/ui/badge.tsx | 3 +++ client/web/src/ui/collapsible.tsx | 3 +++ client/web/src/ui/input.tsx | 3 +++ client/web/src/ui/popover.tsx | 3 +++ client/web/src/ui/profile-pic.tsx | 3 +++ client/web/src/ui/search-input.tsx | 3 +++ client/web/src/ui/spinner.tsx | 3 +++ client/web/src/ui/toggle.tsx | 3 +++ cmd/tsconnect/src/lib/ssh.ts | 3 +++ scripts/check_license_headers.sh | 2 +- 26 files changed, 83 insertions(+), 1 deletion(-) diff --git a/client/web/src/api.ts b/client/web/src/api.ts index 3d41605dc..b6c0c4415 100644 --- a/client/web/src/api.ts +++ b/client/web/src/api.ts @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + let csrfToken: string let synoToken: string | undefined // required for synology API requests let unraidCsrfToken: string | undefined // required for unraid POST requests (#8062) diff --git a/client/web/src/components/acl-tag.tsx b/client/web/src/components/acl-tag.tsx index 94522befe..cb34375ed 100644 --- a/client/web/src/components/acl-tag.tsx +++ b/client/web/src/components/acl-tag.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React from "react" import Badge from "src/ui/badge" diff --git a/client/web/src/components/app.tsx b/client/web/src/components/app.tsx index 232bd4a6c..bfdbeea46 100644 --- a/client/web/src/components/app.tsx +++ b/client/web/src/components/app.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React, { useEffect } from "react" import { ReactComponent as TailscaleIcon } from "src/assets/icons/tailscale-icon.svg" diff --git a/client/web/src/components/exit-node-selector.tsx b/client/web/src/components/exit-node-selector.tsx index 0e64f80f1..8083e0660 100644 --- a/client/web/src/components/exit-node-selector.tsx +++ b/client/web/src/components/exit-node-selector.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React, { useCallback, useMemo, useRef, useState } from "react" import { ReactComponent as Check } from "src/assets/icons/check.svg" diff --git a/client/web/src/components/login-toggle.tsx b/client/web/src/components/login-toggle.tsx index bb291268e..4575ab753 100644 --- a/client/web/src/components/login-toggle.tsx +++ b/client/web/src/components/login-toggle.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React, { useCallback, useEffect, useState } from "react" import { ReactComponent as ChevronDown } from "src/assets/icons/chevron-down.svg" diff --git a/client/web/src/components/update-available.tsx b/client/web/src/components/update-available.tsx index 18474d866..6c8d83f4b 100644 --- a/client/web/src/components/update-available.tsx +++ b/client/web/src/components/update-available.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import React from "react" import { VersionInfo } from "src/hooks/self-update" import { Link } from "wouter" diff --git a/client/web/src/components/views/device-details-view.tsx b/client/web/src/components/views/device-details-view.tsx index d792372fe..95fc97c93 100644 --- a/client/web/src/components/views/device-details-view.tsx +++ b/client/web/src/components/views/device-details-view.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React from "react" import { apiFetch } from "src/api" diff --git a/client/web/src/components/views/home-view.tsx b/client/web/src/components/views/home-view.tsx index 2e8c73210..3b349ce92 100644 --- a/client/web/src/components/views/home-view.tsx +++ b/client/web/src/components/views/home-view.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React from "react" import { ReactComponent as ArrowRight } from "src/assets/icons/arrow-right.svg" diff --git a/client/web/src/components/views/login-view.tsx b/client/web/src/components/views/login-view.tsx index 498ff6c61..eb25f8739 100644 --- a/client/web/src/components/views/login-view.tsx +++ b/client/web/src/components/views/login-view.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import React, { useCallback, useState } from "react" import { apiFetch } from "src/api" import { ReactComponent as TailscaleIcon } from "src/assets/icons/tailscale-icon.svg" diff --git a/client/web/src/components/views/ssh-view.tsx b/client/web/src/components/views/ssh-view.tsx index e3d1a03f2..e36c7c4d6 100644 --- a/client/web/src/components/views/ssh-view.tsx +++ b/client/web/src/components/views/ssh-view.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import React from "react" import { PrefsUpdate } from "src/hooks/node-data" import Toggle from "src/ui/toggle" diff --git a/client/web/src/components/views/updating-view.tsx b/client/web/src/components/views/updating-view.tsx index 660eb725c..dc1d692a7 100644 --- a/client/web/src/components/views/updating-view.tsx +++ b/client/web/src/components/views/updating-view.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import React from "react" import { ReactComponent as CheckCircleIcon } from "src/assets/icons/check-circle.svg" import { ReactComponent as XCircleIcon } from "src/assets/icons/x-circle.svg" diff --git a/client/web/src/hooks/auth.ts b/client/web/src/hooks/auth.ts index 0f30f18f3..1b51dc1ab 100644 --- a/client/web/src/hooks/auth.ts +++ b/client/web/src/hooks/auth.ts @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import { useCallback, useEffect, useState } from "react" import { apiFetch, setSynoToken } from "src/api" diff --git a/client/web/src/hooks/exit-nodes.ts b/client/web/src/hooks/exit-nodes.ts index 68133331e..f4e0e6405 100644 --- a/client/web/src/hooks/exit-nodes.ts +++ b/client/web/src/hooks/exit-nodes.ts @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import { useEffect, useMemo, useState } from "react" import { apiFetch } from "src/api" diff --git a/client/web/src/hooks/node-data.ts b/client/web/src/hooks/node-data.ts index 470ef1fbe..93bb8a5e9 100644 --- a/client/web/src/hooks/node-data.ts +++ b/client/web/src/hooks/node-data.ts @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import { useCallback, useEffect, useState } from "react" import { apiFetch, setUnraidCsrfToken } from "src/api" import { ExitNode } from "src/hooks/exit-nodes" diff --git a/client/web/src/hooks/self-update.ts b/client/web/src/hooks/self-update.ts index 8c12a3709..19c322ba0 100644 --- a/client/web/src/hooks/self-update.ts +++ b/client/web/src/hooks/self-update.ts @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import { useCallback, useEffect, useState } from "react" import { apiFetch } from "src/api" diff --git a/client/web/src/index.tsx b/client/web/src/index.tsx index 6840d2488..ef5a65a44 100644 --- a/client/web/src/index.tsx +++ b/client/web/src/index.tsx @@ -1,3 +1,13 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + +// Preserved js license comment for web client app. +/** + * @license + * Copyright (c) Tailscale Inc & AUTHORS + * SPDX-License-Identifier: BSD-3-Clause + */ + import React from "react" import { createRoot } from "react-dom/client" import App from "src/components/app" diff --git a/client/web/src/ui/badge.tsx b/client/web/src/ui/badge.tsx index ca211822c..c0caa6403 100644 --- a/client/web/src/ui/badge.tsx +++ b/client/web/src/ui/badge.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React, { HTMLAttributes } from "react" diff --git a/client/web/src/ui/collapsible.tsx b/client/web/src/ui/collapsible.tsx index 51faa9aad..e954ce008 100644 --- a/client/web/src/ui/collapsible.tsx +++ b/client/web/src/ui/collapsible.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import * as Primitive from "@radix-ui/react-collapsible" import React, { useState } from "react" import { ReactComponent as ChevronDown } from "src/assets/icons/chevron-down.svg" diff --git a/client/web/src/ui/input.tsx b/client/web/src/ui/input.tsx index 2cba2251e..756e0fc2e 100644 --- a/client/web/src/ui/input.tsx +++ b/client/web/src/ui/input.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React, { InputHTMLAttributes } from "react" diff --git a/client/web/src/ui/popover.tsx b/client/web/src/ui/popover.tsx index 7f483c266..588a4d472 100644 --- a/client/web/src/ui/popover.tsx +++ b/client/web/src/ui/popover.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import * as PopoverPrimitive from "@radix-ui/react-popover" import cx from "classnames" import React, { ReactNode } from "react" diff --git a/client/web/src/ui/profile-pic.tsx b/client/web/src/ui/profile-pic.tsx index 8f9c23cdf..343fb29b4 100644 --- a/client/web/src/ui/profile-pic.tsx +++ b/client/web/src/ui/profile-pic.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React from "react" diff --git a/client/web/src/ui/search-input.tsx b/client/web/src/ui/search-input.tsx index cd51d9269..4d919e07d 100644 --- a/client/web/src/ui/search-input.tsx +++ b/client/web/src/ui/search-input.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React, { forwardRef, InputHTMLAttributes } from "react" import { ReactComponent as Search } from "src/assets/icons/search.svg" diff --git a/client/web/src/ui/spinner.tsx b/client/web/src/ui/spinner.tsx index 989d56b23..51f6e887b 100644 --- a/client/web/src/ui/spinner.tsx +++ b/client/web/src/ui/spinner.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React, { HTMLAttributes } from "react" diff --git a/client/web/src/ui/toggle.tsx b/client/web/src/ui/toggle.tsx index 312d963bb..492283005 100644 --- a/client/web/src/ui/toggle.tsx +++ b/client/web/src/ui/toggle.tsx @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import cx from "classnames" import React, { ChangeEvent } from "react" diff --git a/cmd/tsconnect/src/lib/ssh.ts b/cmd/tsconnect/src/lib/ssh.ts index afbcdb895..9c6f71aee 100644 --- a/cmd/tsconnect/src/lib/ssh.ts +++ b/cmd/tsconnect/src/lib/ssh.ts @@ -1,3 +1,6 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + import { Terminal, ITerminalOptions } from "xterm" import { FitAddon } from "xterm-addon-fit" import { WebLinksAddon } from "xterm-addon-web-links" diff --git a/scripts/check_license_headers.sh b/scripts/check_license_headers.sh index 89a243b63..9a5ae02f5 100755 --- a/scripts/check_license_headers.sh +++ b/scripts/check_license_headers.sh @@ -26,7 +26,7 @@ if [ $# != 1 ]; then fi fail=0 -for file in $(find $1 -name '*.go' -not -path '*/.git/*'); do +for file in $(find $1 \( -name '*.go' -or -name '*.tsx' -or -name '*.ts' -not -name '*.config.ts' \) -not -path '*/.git/*' -not -path '*/node_modules/*'); do case $file in $1/tempfork/*) # Skip, tempfork of third-party code