add OVERRIDE_URL
This commit is contained in:
parent
3965a312a5
commit
2d2a4a4c07
3 changed files with 15 additions and 5 deletions
|
@ -34,6 +34,8 @@ POSTGRES_DB=url
|
||||||
# surrealdb
|
# surrealdb
|
||||||
DB_USER=root
|
DB_USER=root
|
||||||
DB_PASSWORD=root
|
DB_PASSWORD=root
|
||||||
|
|
||||||
|
OVERRIDE_URL=s.nexv.dev
|
||||||
```
|
```
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
|
@ -46,14 +46,17 @@ export default function CreateCard() {
|
||||||
|
|
||||||
const handleCopyUrl = () => {
|
const handleCopyUrl = () => {
|
||||||
if (state && state.url) {
|
if (state && state.url) {
|
||||||
|
let url = undefined;
|
||||||
const currentSiteName = window.location.hostname;
|
const currentSiteName = window.location.hostname;
|
||||||
|
|
||||||
let url = undefined;
|
if (state.url.includes("https://")) {
|
||||||
if (currentSiteName === "localhost" || currentSiteName === "0.0.0.0") {
|
url = state.url;
|
||||||
const currentPort = window.location.port;
|
|
||||||
url = `http://${currentSiteName}:${currentPort}/${state.url.toString()}`;
|
|
||||||
} else {
|
} else {
|
||||||
url = `https://${currentSiteName}/${state.url.toString()}`;
|
if (currentSiteName === "localhost" || currentSiteName === "0.0.0.0") {
|
||||||
|
url = `http://${currentSiteName}:${window.location.port}/${state.url.toString()}`;
|
||||||
|
} else {
|
||||||
|
url = `https://${currentSiteName}/${state.url.toString()}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
navigator.clipboard.writeText(url)
|
navigator.clipboard.writeText(url)
|
||||||
|
|
|
@ -64,8 +64,13 @@ export async function querydb(prevState: any, formData: FormData) {
|
||||||
|
|
||||||
url = url[0].id;
|
url = url[0].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(url);
|
console.log(url);
|
||||||
|
|
||||||
|
if (process.env.OVERRIDE_URL !== undefined) {
|
||||||
|
url = `https://${process.env.OVERRIDE_URL}/${url.toString()}`;
|
||||||
|
}
|
||||||
|
|
||||||
return { url: url };
|
return { url: url };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue