Moved submodules and every stuff into seperate folders neatly #4

This commit is contained in:
mrfry 2020-10-01 14:16:19 +02:00
parent 7e44ca30f1
commit ae91801fbd
51 changed files with 0 additions and 799 deletions

54
scripts/make.sh Executable file
View file

@ -0,0 +1,54 @@
#!/bin/bash
git pull
git submodule update --init --recursive
echo "Installing node modules for server"
npm install
echo "Making qmining page"
pushd modules/qmining/qmining-page/
npm install
npm run export
popd
ln -sf "$PWD/modules/qmining/qmining-page/out" "$PWD/modules/qmining/public"
echo "Making data editor page"
pushd modules/dataEditor/qmining-data-editor/
npm install
npm run export
popd
ln -sf "$PWD/modules/dataEditor/qmining-data-editor/out" "$PWD/modules/dataEditor/public"
echo "mkdir-ing/touching :3"
# TODO: make server create these itself
mkdir stats
touch nolog
#JSONS
echo '{}' > stats/stats
echo '{}' > stats/vstats
echo '{}' > stats/idstats
echo '{}' > stats/idvstats
touch qminingPublic/version
touch qminingPublic/motd
echo "wgetting data.json from frylabs..."
wget "http://qmining.frylabs.net/data.json" -O ./qminingPublic/data.json
if [ "$?" -ne "0" ]; then
echo "Failed to wget data.json, please create it yourself!"
echo "Now starting with empty data!"
echo '{"Subjects":[],"version":"TESET","motd":"hai"}' > ./qminingPublic/data.json
fi
pushd utils
rm -v ../data/dbs/users.db
NS_SQL_DEBUG_LOG=true NS_LOGLEVEL=2 node dbSetup.js
popd
echo "Done!"
echo "npm start {loglevel}"
echo "To start server"

4
scripts/makeQminingPage.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
pushd modules/qmining/qmining-page/
./make.sh
popd

134
scripts/serverStats.sh Executable file
View file

@ -0,0 +1,134 @@
#!/bin/bash
if [ "$#" -ne "1" ]; then
echo not enough params! please specify server root directory!
exit 1
fi
export TERM=xterm-256color
# COLORS
NC=''
# GRAY=''
R=''
G=''
# YELLOW=''
B=''
P=''
C=''
sep="${P}--------------------------------------------------------------------------------<=$NC"
pcolumns () {
mlength=35
NUM=0;
l=$(echo $"$1" | wc -l)
sizeof2=$(echo $"$2" | wc -l)
if [ "$l" -lt "$sizeof2" ]; then
l=$(echo $"$2" | wc -l)
fi
for i in $( eval echo {0..$l} )
do
line=$(echo -ne $"$1" | cut -d$'\n' -f $(($NUM+1)))
sliced="${line:0:$mlength}"
last="${line: -3}"
size=${#sliced}
diff=$(($mlength-$size))
if [ "$sliced" == "null" ]; then
echo -n ''
else
echo -en "$sliced"
fi
if [ "$diff" -gt "0" ]; then
diff=$((diff+2))
for j in $( eval echo {0..$diff} )
do
echo -n " "
done
else
echo -en "$last"
fi
sr=$(echo -ne $"$2" | cut -d$'\n' -f $(($NUM+1)))
r=$"${sr:0:$mlength}"
if [ "$r" == "null" ]; then
echo ''
else
echo "$r"
fi
NUM=$((NUM+1))
done
}
function jsonStats () {
dateind=$(date '+%Y/%m/%d')
b=$(cat "$1" | jq ".[\"$dateind\"]" | grep -ve '^{' | grep -ve '}$' | grep -ve '^\s*}' | sort)
bc=$(cat "$1" | jq ".[\"$dateind\"] | length")
b="\t${bc}\n${b}"
dateind=$(date -d 'yesterday' '+%Y/%m/%d')
a=$(cat "$1" | jq ".[\"$dateind\"]" | grep -ve '^{' | grep -ve '}$' | grep -ve '^\s*}' | sort)
ac=$(cat "$1" | jq ".[\"$dateind\"] | length")
a="\t${ac}\n${a}"
pcolumns $"$a" $"$b" | sed -E \
-e "s,/getVeteranPw,${C}&${NC},g" \
-e "s,/getveteranpw,${C}&${NC},g" \
-e "s,/pwRequest,${C}&${NC},g" \
-e "s,/getpw,${C}&${NC},g" \
-e "s,/avaiblePWS,${C}&${NC},g" \
-e "s,/pwRequest,${C}&${NC},g" \
-e "s,/login,${C}&${NC},g" \
-e "s,/manual,${G}&${NC},g" \
-e "s,/allQuestions,${G}&${NC},g" \
-e "s,/subjectBrowser,${G}&${NC},g" \
-e "s,/repos,${G}&${NC},g" \
-e "s,/contribute,${G}&${NC},g" \
-e "s,/reops,${G}&${NC},g" \
-e "s,/feedback,${G}&${NC},g" \
-e "s,/addQuestion,${G}&${NC},g" \
-e "s,/dataCount,${G}&${NC},g" \
-e "s,/menuClick,${G}&${NC},g" \
-e "s,/allqr,${G}&${NC},g" \
-e "s,/uploaddata,${G}&${NC},g" \
-e "s,/legacy,${G}&${NC},g" \
-e "s,/donate,${P}&${NC},g" \
-e "s,/tiszai,${P}&${NC},g" \
-e "s,/install,${P}&${NC},g" \
-e "s,/irc,${P}&${NC},g" \
-e "s,/postfeedback,${P}&${NC},g" \
-e "s,/quickvote,${P}&${NC},g" \
-e "s,/servergit,${P}&${NC},g" \
-e "s,/scriptgit,${P}&${NC},g" \
-e "s,/classesgit,${P}&${NC},g" \
-e "s,/lred,${R}&${NC},g" \
-e "s,/thanks,${R}&${NC},g" \
-e "s,/isAdding,${B}&${NC},g" \
-e "s,/ask,${B}&${NC},g"
}
function jsonStatsLength () {
dateind=$(date '+%Y/%m/%d')
bc=$(cat "$1" | jq ".[\"$dateind\"] | length")
b="\t${bc}\n"
dateind=$(date -d 'yesterday' '+%Y/%m/%d')
ac=$(cat "$1" | jq ".[\"$dateind\"] | length")
a="\t${ac}\n"
pcolumns $"$a" $"$b"
}
echo -e "${G}Site requests yesterday / today:$NC"
jsonStats "${1}/stats/vstats"
echo -e "$sep"
echo -e "${G}Client ID test solving count yesterday / today:$NC"
jsonStatsLength "${1}/stats/idvstats"
echo -e "$sep"
echo -e "${G}User ID requests yesterday / today:$NC"
jsonStatsLength "${1}/stats/uvstats"
echo -e "$sep"