logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

download-mastofe-build.sh (1542B)


  1. #!/bin/sh
  2. # Pleroma: A lightweight social networking server
  3. # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  4. # SPDX-License-Identifier: AGPL-3.0-only
  5. project_id="74"
  6. project_branch="rebase/glitch-soc"
  7. static_dir="instance/static"
  8. # For bundling:
  9. # project_branch="pleroma"
  10. # static_dir="priv/static"
  11. if [ ! -d "${static_dir}" ]
  12. then
  13. echo "Error: ${static_dir} directory is missing, are you sure you are running this script at the root of pleroma’s repository?"
  14. exit 1
  15. fi
  16. last_modified="$(curl --fail -s -I 'https://git.pleroma.social/api/v4/projects/'${project_id}'/jobs/artifacts/'${project_branch}'/download?job=build' | grep '^Last-Modified:' | cut -d: -f2-)"
  17. echo "branch:${project_branch}"
  18. echo "Last-Modified:${last_modified}"
  19. artifact="mastofe.zip"
  20. if [ "${last_modified}x" = "x" ]
  21. then
  22. echo "ERROR: Couldn't get the modification date of the latest build archive, maybe it expired, exiting..."
  23. exit 1
  24. fi
  25. if [ -e mastofe.timestamp ] && [ "$(cat mastofe.timestamp)" = "${last_modified}" ]
  26. then
  27. echo "MastoFE is up-to-date, exiting..."
  28. exit 0
  29. fi
  30. curl --fail -c - "https://git.pleroma.social/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=build" -o "${artifact}" || exit
  31. # TODO: Update the emoji as well
  32. rm -fr "${static_dir}/sw.js" "${static_dir}/packs" || exit
  33. unzip -q "${artifact}" || exit
  34. cp public/assets/sw.js "${static_dir}/sw.js" || exit
  35. cp -r public/packs "${static_dir}/packs" || exit
  36. echo "${last_modified}" > mastofe.timestamp
  37. rm -fr public
  38. rm -i "${artifact}"