-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.sh
61 lines (45 loc) · 2.33 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Overleaf SSO Updater By Musicminion
# [Attention]需要在Sharelatex的容器内运行
# Run In Your Overleaf Sharelatex Docker Inner!
# 脚本目录
CURRENT_DIR=$(cd $(dirname $0); pwd)
# 安装依赖(如果在国内安装请加上这句话 --registry=https://registry.npm.taobao.org)
cd /overleaf/services/web/
npm install axios
npm install jsonwebtoken
npm install node-rsa
npm insatll fs
# npm install axios --registry=https://registry.npm.taobao.org
# npm install jsonwebtoken --registry=https://registry.npm.taobao.org
cd $CURRENT_DIR
# 拷贝router
rm /overleaf/services/web/app/src/router.js
cp ./src/OAuth/router.js /overleaf/services/web/app/src/
# 拷贝Auth Control
rm /overleaf/services/web/app/src/Features/Authentication/AuthenticationController.js
cp ./src/OAuth/AuthenticationController.js /overleaf/services/web/app/src/Features/Authentication/
# 拷贝Auth Manager
rm /overleaf/services/web/app/src/Features/Authentication/AuthenticationManager.js
cp ./src/OAuth/AuthenticationManager.js /overleaf/services/web/app/src/Features/Authentication/
# 拷贝login.pug
rm /overleaf/services/web/app/views/user/login.pug
cp ./src/OAuth/login.pug /overleaf/services/web/app/views/user/
if [ "${SHARELATEX_OAUTH_APPLE_ENABLED}" == "true" ]; then
# 拷贝Server.js
rm /overleaf/services/web/app/src/infrastructure/Server.js
cp ./src/OAuth/Server.js /overleaf/services/web/app/src/infrastructure/
echo $SHARELATEX_OAUTH_APPLE_AUTH_SERVICE_SECRET_KEY_LINE_1 >> ./src/OAuth/AuthKey.p8
echo $SHARELATEX_OAUTH_APPLE_AUTH_SERVICE_SECRET_KEY_LINE_2 >> ./src/OAuth/AuthKey.p8
echo $SHARELATEX_OAUTH_APPLE_AUTH_SERVICE_SECRET_KEY_LINE_3 >> ./src/OAuth/AuthKey.p8
echo $SHARELATEX_OAUTH_APPLE_AUTH_SERVICE_SECRET_KEY_LINE_4 >> ./src/OAuth/AuthKey.p8
echo $SHARELATEX_OAUTH_APPLE_AUTH_SERVICE_SECRET_KEY_LINE_5 >> ./src/OAuth/AuthKey.p8
echo $SHARELATEX_OAUTH_APPLE_AUTH_SERVICE_SECRET_KEY_LINE_6 >> ./src/OAuth/AuthKey.p8
# 拷贝密钥文件
cp ./src/OAuth/AuthKey.p8 /overleaf/services/web/app/src/Features/Authentication/AuthKey.p8
echo 'Apple Auth Key Imported!'
# 拷贝数据库操作文件
rm /overleaf/services/web/app/src/Features/User/UserRegistrationHandler.js
cp ./src/OAuth/UserRegistrationHandler.js /overleaf/services/web/app/src/Features/User/
fi
echo 'Finish SSO Update!'