Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
85feb005
authored
Aug 10, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: data config set scripts
parent
b7b222fd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
client/data/config.json
+2
-1
client/src/pages/_app.tsx
+8
-5
client/src/types/index.d.ts
+1
-1
No files found.
client/data/config.json
View file @
85feb005
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
"show_git"
:
true
,
"show_git"
:
true
,
"systemTitle"
:
"FastGPT"
,
"systemTitle"
:
"FastGPT"
,
"authorText"
:
"Made by FastGPT Team."
,
"authorText"
:
"Made by FastGPT Team."
,
"gitLoginKey"
:
""
"gitLoginKey"
:
""
,
"scripts"
:
[]
},
},
"SystemParams"
:
{
"SystemParams"
:
{
"gitLoginSecret"
:
""
,
"gitLoginSecret"
:
""
,
...
...
client/src/pages/_app.tsx
View file @
85feb005
...
@@ -15,6 +15,7 @@ import { useRouter } from 'next/router';
...
@@ -15,6 +15,7 @@ import { useRouter } from 'next/router';
import
'nprogress/nprogress.css'
;
import
'nprogress/nprogress.css'
;
import
'@/styles/reset.scss'
;
import
'@/styles/reset.scss'
;
import
{
FeConfigsType
}
from
'@/types'
;
//Binding events.
//Binding events.
Router
.
events
.
on
(
'routeChangeStart'
,
()
=>
NProgress
.
start
());
Router
.
events
.
on
(
'routeChangeStart'
,
()
=>
NProgress
.
start
());
...
@@ -36,16 +37,16 @@ function App({ Component, pageProps }: AppProps) {
...
@@ -36,16 +37,16 @@ function App({ Component, pageProps }: AppProps) {
const
router
=
useRouter
();
const
router
=
useRouter
();
const
{
i18n
}
=
useTranslation
();
const
{
i18n
}
=
useTranslation
();
const
[
scripts
,
setScripts
]
=
useState
<
FeConfigsType
[
'scripts'
]
>
([]);
const
[
googleClientVerKey
,
setGoogleVerKey
]
=
useState
<
string
>
();
const
[
googleClientVerKey
,
setGoogleVerKey
]
=
useState
<
string
>
();
const
[
baiduTongjiUrl
,
setBaiduTongjiUrl
]
=
useState
<
string
>
();
useEffect
(()
=>
{
useEffect
(()
=>
{
(
async
()
=>
{
(
async
()
=>
{
const
{
const
{
feConfigs
:
{
googleClientVerKey
,
baiduTongjiUrl
}
feConfigs
:
{
scripts
,
googleClientVerKey
}
}
=
await
clientInitData
();
}
=
await
clientInitData
();
setScripts
(
scripts
||
[]);
setGoogleVerKey
(
googleClientVerKey
);
setGoogleVerKey
(
googleClientVerKey
);
setBaiduTongjiUrl
(
baiduTongjiUrl
);
})();
})();
},
[]);
},
[]);
...
@@ -68,12 +69,14 @@ function App({ Component, pageProps }: AppProps) {
...
@@ -68,12 +69,14 @@ function App({ Component, pageProps }: AppProps) {
<
Script
src=
"/js/qrcode.min.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/qrcode.min.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/pdf.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/pdf.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/html2pdf.bundle.min.js"
strategy=
"lazyOnload"
></
Script
>
<
Script
src=
"/js/html2pdf.bundle.min.js"
strategy=
"lazyOnload"
></
Script
>
{
baiduTongjiUrl
&&
<
Script
src=
{
baiduTongjiUrl
}
strategy=
"lazyOnload"
></
Script
>
}
{
scripts
?.
map
((
item
,
i
)
=>
(
<
Script
key=
{
i
}
strategy=
"lazyOnload"
{
...
item
}
></
Script
>
))
}
{
googleClientVerKey
&&
(
{
googleClientVerKey
&&
(
<>
<>
<
Script
<
Script
src=
{
`https://www.recaptcha.net/recaptcha/api.js?render=${googleClientVerKey}`
}
src=
{
`https://www.recaptcha.net/recaptcha/api.js?render=${googleClientVerKey}`
}
strategy=
"
afterInteractive
"
strategy=
"
lazyOnload
"
></
Script
>
></
Script
>
</>
</>
)
}
)
}
...
...
client/src/types/index.d.ts
View file @
85feb005
...
@@ -23,8 +23,8 @@ export type FeConfigsType = {
...
@@ -23,8 +23,8 @@ export type FeConfigsType = {
authorText
?:
string
;
authorText
?:
string
;
beianText
?:
string
;
beianText
?:
string
;
googleClientVerKey
?:
string
;
googleClientVerKey
?:
string
;
baiduTongjiUrl
?:
string
;
gitLoginKey
?:
string
;
gitLoginKey
?:
string
;
scripts
?:
{
[
key
:
string
]:
string
}[];
};
};
export
type
SystemEnvType
=
{
export
type
SystemEnvType
=
{
googleServiceVerKey
?:
string
;
googleServiceVerKey
?:
string
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment