feature: add secret my-mc.link mode
This commit is contained in:
@@ -2,6 +2,7 @@ FROM node:lts-slim AS base
|
||||
|
||||
WORKDIR /
|
||||
COPY run.sh .
|
||||
COPY fetch-my-mc-connector.js .
|
||||
RUN chmod +x run.sh
|
||||
|
||||
RUN npm install -g holesail@2.0.3
|
||||
@@ -16,6 +17,4 @@ ENV ROLE user
|
||||
ENV CONNECTOR ""
|
||||
ENV FORCE ""
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
|
13
fetch-my-mc-connector.js
Normal file
13
fetch-my-mc-connector.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const apiKey = process.env.CONNECTOR;
|
||||
|
||||
const result = fetch('https://api.my-mc.link/my-hash',{
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Accept': 'application/json', 'Content-Type': 'application/json', 'x-my-mc-auth': apiKey}
|
||||
})
|
||||
.then(async response => {
|
||||
const r = await response.json();
|
||||
if (r.success == true) {
|
||||
console.log(r.message);
|
||||
}
|
||||
})
|
9
run.sh
9
run.sh
@@ -25,6 +25,10 @@ success() {
|
||||
print "$GREEN" "$1"
|
||||
}
|
||||
|
||||
get_connector_my-mc() {
|
||||
printf "$(node /fetch-my-mc-connector.js)"
|
||||
}
|
||||
|
||||
cmd_argument_builder () {
|
||||
local args="";
|
||||
case "$MODE" in
|
||||
@@ -51,6 +55,11 @@ cmd_argument_builder () {
|
||||
[[ "$ROLE" = "user" ]] && args="$args --role user";
|
||||
[[ "$CONNECTOR" ]] && args="$args --connector $CONNECTOR";
|
||||
;;
|
||||
"my-mc")
|
||||
[[ "$PORT" ]] && args="$args --port $PORT";
|
||||
[[ "$HOST" ]] && args="$args --host $HOST";
|
||||
[[ "$CONNECTOR" ]] && args="$args $(get_connector_my-mc)";
|
||||
;;
|
||||
esac
|
||||
|
||||
printf "%s" "$args";
|
||||
|
Reference in New Issue
Block a user