Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
auberge-des-reveurs
Website homepage
Commits
fe0b942e
Unverified
Commit
fe0b942e
authored
Nov 26, 2021
by
Lucas Cimon
Browse files
Adding comments to set_phpbb_html_homepage.sh
parent
4967f67b
Pipeline
#460797
passed with stage
in 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
set_phpbb_html_homepage.sh
View file @
fe0b942e
#!/bin/bash
# Enabling Bash strict mode:
set
-o
errexit
-o
nounset
-o
pipefail
urlencode
()
{
urlencode
()
{
# Bash function to perform URLencoding on stdin
python3
-c
'import sys; from urllib.parse import quote_plus; sys.stdout.writelines([quote_plus(line) for line in sys.stdin])'
}
# Authenticating & storing the sid cookie in a file:
curl
-Ls
--fail
-c
cookies.txt https://laubergedesreveurs.forumactif.com/login
--data-raw
"username=
${
USERNAME
:?
}
&password=
${
PASSWORD
:?
}
&autologin=on&redirect=&query=&login=Connexion"
-o
out.html
# Ensuring auth was successful:
grep
-qF
$USERNAME
out.html
||
{
echo
"Login as
$USERNAME
failed"
;
exit
1
;
}
# Extracting the tid:
tid
=
$(
grep
-F
tid
=
out.html |
sed
's/.*tid=\([^&]\+\)&.*/\1/'
|
head
-n
1
)
# Uploading a new version of index.html:
curl
-Ls
--fail
-b
cookies.txt
"https://laubergedesreveurs.forumactif.com/admin/?part=modules&sub=html&extended_admin=1&tid=
$tid
"
--data-raw
"title=Homepage&forumact_template=0&set_homepage=1&html=
$(
urlencode < index.html
)
&mode=go_edit&editor=wysiwyg&page=1&submit=Valider"
-o
out.html
# Ensuring upload was successful:
grep
-qF
"Votre page HTML a bien été modifiée"
out.html
||
{
echo
"Homepage update failed failed"
;
exit
1
;
}
# Final cleanup:
rm
cookies.txt out.html
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment