diff --git a/.gitignore b/.gitignore index f540714..bfd5893 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .htpasswd werc/etc/* scripts/commands.txt +.env diff --git a/scripts/add_person.sh b/scripts/add_person.sh index 504490f..726215d 100755 --- a/scripts/add_person.sh +++ b/scripts/add_person.sh @@ -34,5 +34,24 @@ EOF # Create the style.css file echo "/* Put custom styles here */" > "$path/$name/_werc/style.css" +# Update index.html +index_file="$path/index.html" + +if [ -f "$index_file" ]; then + awk -v name="$name" ' + { + print + if ($0 ~ //) { + print "
" + print " \""" + print "
" + print "" + } + }' "$index_file" > "${index_file}.tmp" && mv "${index_file}.tmp" "$index_file" + echo "Updated index.html with new user entry" +else + echo "Warning: index.html not found at $index_file" +fi + # Output a success message echo "Folder structure created successfully at $path/$name" diff --git a/scripts/onboard.sh b/scripts/onboard.sh new file mode 100755 index 0000000..46f1a86 --- /dev/null +++ b/scripts/onboard.sh @@ -0,0 +1,100 @@ +#!/bin/bash + +CONFIG_FILE="${CONFIG_FILE:-./.env/onboard.env}" +if [ ! -f "$CONFIG_FILE" ]; then + echo "Error: Configuration file not found at $CONFIG_FILE" + echo "CONFIG_FILE unset or .env/onboard.env does not exist" + exit 1 +fi + +source "$CONFIG_FILE" + +usage() { + cat << EOF +Usage: $0 + +Arguments: + username The username for the new account + mkpasswd_hash The hash generated by mkpasswd + htpasswd_hash The hash generated by htpasswd +EOF + exit 1 +} + +validate_input() { + + [ $# -ne 3 ] && usage + [[ ! "$2" =~ ^\$6\$ ]] && echo "Error: Invalid mkpasswd hash format" && exit 1 + [[ ! "$3" =~ ^\$apr1\$ ]] && echo "Error: Invalid htpasswd hash format" && exit 1 + + local required_vars=( + "SSH_USER" "SSH_HOST" "CONTAINER_NAME" "DOMAIN" "SERVICES_URL" + "USER_STRUCTURE_PATH" "WERC_PATH" "HTPASSWD_FILE" + ) + + for var in "${required_vars[@]}"; do + if [ -z "${!var}" ]; then + echo "Error: Required variable $var is not set in $CONFIG_FILE" + exit 1 + fi + done + + [ ! -d "$USER_STRUCTURE_PATH" ] && echo "Error: User structure path does not exist: $USER_STRUCTURE_PATH" && exit 1 + [ ! -d "$WERC_PATH" ] && echo "Error: Werc path does not exist: $WERC_PATH" && exit 1 + +} + +create_user_structure() { + local username="$1" + local mkpasswd_hash="$2" + local user_path="$USER_STRUCTURE_PATH/$username" + mkdir -p "$user_path" + echo "$mkpasswd_hash" > "$user_path/password" + echo "$username:$3" >> "$HTPASSWD_FILE" +} + +setup_werc_structure() { + local username="$1" + ./add_person.sh "$WERC_PATH" "$username" +} + +generate_invite() { + invite=$(ssh "$SSH_USER@$SSH_HOST" "docker exec $CONTAINER_NAME prosodyctl mod_invites generate $DOMAIN" | tail -n 1) + [ -z "$invite" ] && echo "Error: Failed to generate invite" && exit 1 +} + +main() { + local username="$1" + local mkpasswd_hash="$2" + local htpasswd_hash="$3" + + validate_input "$@" + + echo "Setting up user structure..." + create_user_structure "$username" "$mkpasswd_hash" "$htpasswd_hash" + + echo "Setting up werc structure..." + setup_werc_structure "$username" + + echo "Generating invite..." + generate_invite + + cat << EOF +User setup completed successfully! +Username: $username +Services URL: $SERVICES_URL +Invite link: $invite + +The following paths have been updated: +- User structure: $USER_STRUCTURE_PATH/$username +- Werc structure: $WERC_PATH/$username +- Password file: $USER_STRUCTURE_PATH/$username/password +- Updated .htpasswd at: $HTPASSWD_FILE + +Next steps: +1. Push changes to server +2. Send the services URL and invite link to the user +EOF +} + +main "$@" \ No newline at end of file diff --git a/werc/sites/ppl.thirdculture.top/2fac/_werc/config b/werc/sites/ppl.thirdculture.top/2fac/_werc/config new file mode 100644 index 0000000..504b8b8 --- /dev/null +++ b/werc/sites/ppl.thirdculture.top/2fac/_werc/config @@ -0,0 +1,4 @@ +extraHeaders='' +conf_enable_wiki +conf_enable_cssedit 2fac +css_file='_werc/style.css' diff --git a/werc/sites/ppl.thirdculture.top/2fac/_werc/style.css b/werc/sites/ppl.thirdculture.top/2fac/_werc/style.css new file mode 100644 index 0000000..2e84e74 --- /dev/null +++ b/werc/sites/ppl.thirdculture.top/2fac/_werc/style.css @@ -0,0 +1 @@ +/* Put custom styles here */ diff --git a/werc/sites/ppl.thirdculture.top/2fac/blog/_werc/config b/werc/sites/ppl.thirdculture.top/2fac/blog/_werc/config new file mode 100644 index 0000000..e172432 --- /dev/null +++ b/werc/sites/ppl.thirdculture.top/2fac/blog/_werc/config @@ -0,0 +1,6 @@ +conf_enable_wiki +conf_enable_blog +conf_blog_only_pull=0 +conf_blog_editors=2fac +blogTitle='2fac Feed' +blogDesc='' diff --git a/werc/sites/ppl.thirdculture.top/bea/_werc/style.css b/werc/sites/ppl.thirdculture.top/bea/_werc/style.css index ab6602e..2e84e74 100644 --- a/werc/sites/ppl.thirdculture.top/bea/_werc/style.css +++ b/werc/sites/ppl.thirdculture.top/bea/_werc/style.css @@ -1,39 +1 @@ -:root { - /* Main color scheme */ - --color-primary: #E4F0FEff; - --color-secondary: #AEA3F0ff; - --color-accent: #A4D1ADff; - - /* Background colors */ - --bg-primary: #000300ff; - --bg-secondary: #1C202Fff; - - /* Text colors */ - --text-primary: #E4F0FEff; - --text-secondary: #989898ff; - --text-accent: #AEA3F0ff; - - /* Header colours */ - --header-primary:#AEA3F0ff; - --header-secondary: #AEA3F0ff; - --header-tertiary: #A4D1ADff; - --header-other: #E4F0FEff; - - /* Link colors */ - --link-color: #2667deff; - --link-hover: #5B3D8Aff; - - /* Border colors */ - --border-primary: #C0CEE8ff; - --border-secondary: #0C072Cff; - --border-image: #000300ff; - - /* Special purpose colors */ - --code-color: #18A02Cff; - --header-bg: #AEA3F0ff; - --header-text: #0C072Cff; - - /* Font families */ - --font-headers: 'rumeur', sans-serif; - --font-body: verdana, helvetica, arial, sans-serif; -} +/* Put custom styles here */ diff --git a/werc/sites/ppl.thirdculture.top/bea/blog/_werc/config b/werc/sites/ppl.thirdculture.top/bea/blog/_werc/config index 2682eab..403eb5b 100644 --- a/werc/sites/ppl.thirdculture.top/bea/blog/_werc/config +++ b/werc/sites/ppl.thirdculture.top/bea/blog/_werc/config @@ -2,5 +2,5 @@ conf_enable_wiki conf_enable_blog conf_blog_only_pull=0 conf_blog_editors=bea -blogTitle='' +blogTitle='bea Feed' blogDesc='' diff --git a/werc/sites/ppl.thirdculture.top/drool/_werc/config b/werc/sites/ppl.thirdculture.top/drool/_werc/config new file mode 100644 index 0000000..58e8439 --- /dev/null +++ b/werc/sites/ppl.thirdculture.top/drool/_werc/config @@ -0,0 +1,4 @@ +extraHeaders='' +conf_enable_wiki +conf_enable_cssedit drool +css_file='_werc/style.css' diff --git a/werc/sites/ppl.thirdculture.top/drool/_werc/style.css b/werc/sites/ppl.thirdculture.top/drool/_werc/style.css new file mode 100644 index 0000000..2e84e74 --- /dev/null +++ b/werc/sites/ppl.thirdculture.top/drool/_werc/style.css @@ -0,0 +1 @@ +/* Put custom styles here */ diff --git a/werc/sites/ppl.thirdculture.top/drool/blog/_werc/config b/werc/sites/ppl.thirdculture.top/drool/blog/_werc/config new file mode 100644 index 0000000..af29f56 --- /dev/null +++ b/werc/sites/ppl.thirdculture.top/drool/blog/_werc/config @@ -0,0 +1,6 @@ +conf_enable_wiki +conf_enable_blog +conf_blog_only_pull=0 +conf_blog_editors=drool +blogTitle='drool Feed' +blogDesc='' diff --git a/werc/sites/ppl.thirdculture.top/index.html b/werc/sites/ppl.thirdculture.top/index.html index 4fd074b..a39002e 100644 --- a/werc/sites/ppl.thirdculture.top/index.html +++ b/werc/sites/ppl.thirdculture.top/index.html @@ -33,5 +33,12 @@
bea
+
+ drool +
+
+ 2fac +
+ diff --git a/werc/sites/ppl.thirdculture.top/q/blog/2024/11/17/0/index.md b/werc/sites/ppl.thirdculture.top/q/blog/2024/11/17/0/index.md new file mode 100644 index 0000000..8273bc9 --- /dev/null +++ b/werc/sites/ppl.thirdculture.top/q/blog/2024/11/17/0/index.md @@ -0,0 +1,4 @@ +Getting Organized +------------------------------------- + +Currently [https://git.thirdculture.top](https://git.thirdculture.top) has a shortlist of issues I want to solve before I start creating more content for thirdculture. Just finished it today, going to start on it today. Happy to see people adding to the site and its not just me, feels great. Want to write a bit more guides on how to use specific things as this software is a bit prone to messing up and markdown is a coding language I guess, its (friendly) anarchy right now haha. Having a lot of issues with syncing new changes on the site and then patching in my own fixes that's a major priority for me right now. Anyway bear with me, I also got a live mix to fix up still, an album to mix and master and school the latter being the most noise :(.