Delete scripts directory
This commit is contained in:
parent
d5c932d71a
commit
883f0ed580
|
@ -1 +0,0 @@
|
||||||
proxychains.conf
|
|
|
@ -1,34 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Set the pipefail option.
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# Get the Vercel API endpoints.
|
|
||||||
GET_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v6/deployments"
|
|
||||||
DELETE_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v13/deployments"
|
|
||||||
|
|
||||||
# Create a list of deployments.
|
|
||||||
deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID&teamId=$VERCEL_ORG_ID" -H "Authorization: Bearer $VERCEL_TOKEN ")
|
|
||||||
#deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID" -H "Authorization: Bearer $VERCEL_TOKEN ")
|
|
||||||
|
|
||||||
# Filter the deployments list by meta.base_hash === meta tag.
|
|
||||||
filtered_deployments=$(echo -E $deployments | jq --arg META_TAG "$META_TAG" '[.deployments[] | select(.meta.base_hash | type == "string" and contains($META_TAG)) | .uid] | join(",")')
|
|
||||||
filtered_deployments="${filtered_deployments//\"/}" # Remove double quotes
|
|
||||||
|
|
||||||
# Clears the values from filtered_deployments
|
|
||||||
IFS=',' read -ra values <<<"$filtered_deployments"
|
|
||||||
|
|
||||||
echo "META_TAG ${META_TAG}"
|
|
||||||
echo "Filtered deployments ${filtered_deployments}"
|
|
||||||
|
|
||||||
# Iterate over the filtered deployments list.
|
|
||||||
for uid in "${values[@]}"; do
|
|
||||||
echo "Deleting ${uid}"
|
|
||||||
|
|
||||||
delete_url="${DELETE_DEPLOYMENTS_ENDPOINT}/${uid}?teamId=${VERCEL_ORG_ID}"
|
|
||||||
echo $delete_url
|
|
||||||
|
|
||||||
# Make DELETE a request to the /v13/deployments/{id} endpoint.
|
|
||||||
curl -X DELETE $delete_url -H "Authorization: Bearer $VERCEL_TOKEN"
|
|
||||||
|
|
||||||
echo "Deleted!"
|
|
||||||
done
|
|
|
@ -1,98 +0,0 @@
|
||||||
import fetch from "node-fetch";
|
|
||||||
import fs from "fs/promises";
|
|
||||||
|
|
||||||
const RAW_FILE_URL = "https://raw.githubusercontent.com/";
|
|
||||||
const MIRRORF_FILE_URL = "http://raw.fgit.ml/";
|
|
||||||
|
|
||||||
const RAW_CN_URL = "PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh.json";
|
|
||||||
const CN_URL = MIRRORF_FILE_URL + RAW_CN_URL;
|
|
||||||
const RAW_TW_URL = "PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh-TW.json";
|
|
||||||
const TW_URL = MIRRORF_FILE_URL + RAW_TW_URL;
|
|
||||||
const RAW_EN_URL = "f/awesome-chatgpt-prompts/main/prompts.csv";
|
|
||||||
const EN_URL = MIRRORF_FILE_URL + RAW_EN_URL;
|
|
||||||
const FILE = "./public/prompts.json";
|
|
||||||
|
|
||||||
const ignoreWords = ["涩涩", "魅魔", "澀澀"];
|
|
||||||
|
|
||||||
const timeoutPromise = (timeout) => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
reject(new Error("Request timeout"));
|
|
||||||
}, timeout);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
async function fetchCN() {
|
|
||||||
console.log("[Fetch] fetching cn prompts...");
|
|
||||||
try {
|
|
||||||
const response = await Promise.race([fetch(CN_URL), timeoutPromise(5000)]);
|
|
||||||
const raw = await response.json();
|
|
||||||
return raw
|
|
||||||
.map((v) => [v.act, v.prompt])
|
|
||||||
.filter(
|
|
||||||
(v) =>
|
|
||||||
v[0] &&
|
|
||||||
v[1] &&
|
|
||||||
ignoreWords.every((w) => !v[0].includes(w) && !v[1].includes(w)),
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("[Fetch] failed to fetch cn prompts", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchTW() {
|
|
||||||
console.log("[Fetch] fetching tw prompts...");
|
|
||||||
try {
|
|
||||||
const response = await Promise.race([fetch(TW_URL), timeoutPromise(5000)]);
|
|
||||||
const raw = await response.json();
|
|
||||||
return raw
|
|
||||||
.map((v) => [v.act, v.prompt])
|
|
||||||
.filter(
|
|
||||||
(v) =>
|
|
||||||
v[0] &&
|
|
||||||
v[1] &&
|
|
||||||
ignoreWords.every((w) => !v[0].includes(w) && !v[1].includes(w)),
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("[Fetch] failed to fetch tw prompts", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchEN() {
|
|
||||||
console.log("[Fetch] fetching en prompts...");
|
|
||||||
try {
|
|
||||||
// const raw = await (await fetch(EN_URL)).text();
|
|
||||||
const response = await Promise.race([fetch(EN_URL), timeoutPromise(5000)]);
|
|
||||||
const raw = await response.text();
|
|
||||||
return raw
|
|
||||||
.split("\n")
|
|
||||||
.slice(1)
|
|
||||||
.map((v) =>
|
|
||||||
v
|
|
||||||
.split('","')
|
|
||||||
.map((v) => v.replace(/^"|"$/g, "").replaceAll('""', '"'))
|
|
||||||
.filter((v) => v[0] && v[1]),
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("[Fetch] failed to fetch en prompts", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
Promise.all([fetchCN(), fetchTW(), fetchEN()])
|
|
||||||
.then(([cn, tw, en]) => {
|
|
||||||
fs.writeFile(FILE, JSON.stringify({ cn, tw, en }));
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
console.error("[Fetch] failed to fetch prompts");
|
|
||||||
fs.writeFile(FILE, JSON.stringify({ cn: [], tw: [], en: [] }));
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
console.log("[Fetch] saved to " + FILE);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
|
@ -1,6 +0,0 @@
|
||||||
dir="$(dirname "$0")"
|
|
||||||
config=$dir/proxychains.conf
|
|
||||||
host_ip=$(grep nameserver /etc/resolv.conf | sed 's/nameserver //')
|
|
||||||
echo "proxying to $host_ip"
|
|
||||||
cp $dir/proxychains.template.conf $config
|
|
||||||
sed -i "\$s/.*/http $host_ip 7890/" $config
|
|
|
@ -1,12 +0,0 @@
|
||||||
strict_chain
|
|
||||||
proxy_dns
|
|
||||||
|
|
||||||
remote_dns_subnet 224
|
|
||||||
|
|
||||||
tcp_read_time_out 15000
|
|
||||||
tcp_connect_time_out 8000
|
|
||||||
|
|
||||||
localnet 127.0.0.0/255.0.0.0
|
|
||||||
|
|
||||||
[ProxyList]
|
|
||||||
socks4 127.0.0.1 9050
|
|
|
@ -1,68 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Check if running on a supported system
|
|
||||||
case "$(uname -s)" in
|
|
||||||
Linux)
|
|
||||||
if [[ -f "/etc/lsb-release" ]]; then
|
|
||||||
. /etc/lsb-release
|
|
||||||
if [[ "$DISTRIB_ID" != "Ubuntu" ]]; then
|
|
||||||
echo "This script only works on Ubuntu, not $DISTRIB_ID."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [[ !"$(cat /etc/*-release | grep '^ID=')" =~ ^(ID=\"ubuntu\")|(ID=\"centos\")|(ID=\"arch\")|(ID=\"debian\")$ ]]; then
|
|
||||||
echo "Unsupported Linux distribution."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
Darwin)
|
|
||||||
echo "Running on MacOS."
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported operating system."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Check if needed dependencies are installed and install if necessary
|
|
||||||
if ! command -v node >/dev/null || ! command -v git >/dev/null || ! command -v yarn >/dev/null; then
|
|
||||||
case "$(uname -s)" in
|
|
||||||
Linux)
|
|
||||||
if [[ "$(cat /etc/*-release | grep '^ID=')" = "ID=ubuntu" ]]; then
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get -y install nodejs git yarn
|
|
||||||
elif [[ "$(cat /etc/*-release | grep '^ID=')" = "ID=debian" ]]; then
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get -y install nodejs git yarn
|
|
||||||
elif [[ "$(cat /etc/*-release | grep '^ID=')" = "ID=centos" ]]; then
|
|
||||||
sudo yum -y install epel-release
|
|
||||||
sudo yum -y install nodejs git yarn
|
|
||||||
elif [[ "$(cat /etc/*-release | grep '^ID=')" = "ID=arch" ]]; then
|
|
||||||
sudo pacman -Syu -y
|
|
||||||
sudo pacman -S -y nodejs git yarn
|
|
||||||
else
|
|
||||||
echo "Unsupported Linux distribution"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
Darwin)
|
|
||||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
|
||||||
brew install node git yarn
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clone the repository and install dependencies
|
|
||||||
git clone https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web
|
|
||||||
cd ChatGPT-Next-Web
|
|
||||||
yarn install
|
|
||||||
|
|
||||||
# Prompt user for environment variables
|
|
||||||
read -p "Enter OPENAI_API_KEY: " OPENAI_API_KEY
|
|
||||||
read -p "Enter CODE: " CODE
|
|
||||||
read -p "Enter PORT: " PORT
|
|
||||||
|
|
||||||
# Build and run the project using the environment variables
|
|
||||||
OPENAI_API_KEY=$OPENAI_API_KEY CODE=$CODE PORT=$PORT yarn build
|
|
||||||
OPENAI_API_KEY=$OPENAI_API_KEY CODE=$CODE PORT=$PORT yarn start
|
|
Loading…
Reference in New Issue