This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/answer-website.git
The following commit(s) were added to refs/heads/main by this push:
new 61b6ae2b5 fix: optimize the number of github stars
61b6ae2b5 is described below
commit 61b6ae2b58e92d9740f397303aae6c1012f85480
Author: shuai <[email protected]>
AuthorDate: Mon Feb 17 17:16:39 2025 +0800
fix: optimize the number of github stars
---
Dockerfile | 2 --
nginx.conf | 12 ------------
src/components/HomePageHeader/index.tsx | 27 +--------------------------
src/theme/Heading/index.tsx | 1 -
src/theme/Layout/index.tsx | 8 --------
5 files changed, 1 insertion(+), 49 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 2479b4fc1..28597fe51 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,5 @@
FROM nginx:alpine
-COPY nginx.conf /etc/nginx/conf.d/default.conf
-
COPY ./build /usr/share/nginx/html
EXPOSE 80
diff --git a/nginx.conf b/nginx.conf
deleted file mode 100644
index 7efb32c15..000000000
--- a/nginx.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-server {
- listen 80;
- server_name localhost;
-
- location / {
- root /usr/share/nginx/html;
- index index.html index.htm;
- try_files $uri $uri/ /index.html;
-
- add_header Content-Security-Policy "default-src 'self' data: blob:
'unsafe-inline' https://www.apachecon.com/ https://www.communityovercode.org/
https://analytics.apache.org/ https://img.shields.io/
https://api-js.mixpanel.com/;";
- }
-}
diff --git a/src/components/HomePageHeader/index.tsx
b/src/components/HomePageHeader/index.tsx
index 48ed3412a..bb11a15af 100644
--- a/src/components/HomePageHeader/index.tsx
+++ b/src/components/HomePageHeader/index.tsx
@@ -39,31 +39,6 @@ const HomeHead: FC = () => {
const { i18n: { currentLocale } } = useDocusaurusContext();
- useEffect(() => {
- fetch('https://img.shields.io/github/stars/apache/answer')
- .then((response) => response.text())
- .then((data) => {
- const num = data.match(/<text .*>(.*?)<\/text>/)[1];
- if (num) {
- setStars(num);
- }
- });
- let i = 0;
- const timer = setInterval(() => {
- setSloganClss('sloganOut');
- setTimeout(() => {
- setSlogan(list[i]);
- setSloganClss('sloganIn');
- }, 300);
- i++;
- if (i === list.length) {
- i = 0;
- }
- }, 4500);
- () => {
- clearInterval(timer)
- }
- }, []);
function numWord($num) {
if ($num >= 1000 && $num < 1000000) {
@@ -139,7 +114,7 @@ const HomeHead: FC = () => {
>
<Icon name="github" size="24px" className="me-2" />
{` Star `}
- {stars !== 0 ? numWord(stars) : ''}
+ 13.9k
</Button>
</div>
</Col>
diff --git a/src/theme/Heading/index.tsx b/src/theme/Heading/index.tsx
index 1384e0238..b17cd12ec 100644
--- a/src/theme/Heading/index.tsx
+++ b/src/theme/Heading/index.tsx
@@ -49,7 +49,6 @@ export default function Heading({as: As, id, ...props}:
Props): JSX.Element {
props.className,
)}
id={id}>
- <meta http-equiv="Content-Security-Policy" content="default-src 'self'
data: blob: 'unsafe-inline' https://www.apachecon.com/
https://www.communityovercode.org/ https://analytics.apache.org/
https://api-js.mixpanel.com/track/; connect-src
https://api-js.mixpanel.com/track/;" />
{props.children}
<Link
className="hash-link"
diff --git a/src/theme/Layout/index.tsx b/src/theme/Layout/index.tsx
index ad7de5c10..ffa65a02c 100644
--- a/src/theme/Layout/index.tsx
+++ b/src/theme/Layout/index.tsx
@@ -22,7 +22,6 @@ import Footer from '@theme/Footer';
import LayoutProvider from '@theme/Layout/Provider';
import ErrorPageContent from '@theme/ErrorPageContent';
import type {Props} from '@theme/Layout';
-import mixpanel from 'mixpanel-browser';
import BrowserLanguage from './BrowserLanguage';
import styles from './styles.module.css';
@@ -41,13 +40,6 @@ export default function Layout(props: Props): JSX.Element {
useKeyboardNavigation();
- useEffect(() => {
- mixpanel.init('84c6c96fab326b95afbbd54aadda641b');
- }, [])
-
- useEffect(() => {
- mixpanel.track_pageview();
- }, [location]);
return (
<LayoutProvider>