| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | file="$1" |
| 4 | fileName="nheko-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}-${file##*-}" |
| 5 | |
| 6 | uri=$(curlscip-shell system . . curl. -H "Authorization: Bearer ${MATRIX_ACCESS_TOKEN}" -H "Content-Type: application/x-compressed" -X POST --data-binary "@${file}" "https://matrix.neko.dev/_matrix/media/r0/upload?filename=${fileName}" --http1.1 | python3scip-shell system . . python3. -c "import sys, json; print(json.load(sys.stdin)['content_uri'])") |
| 7 | echoscip-shell system . . echo. "Uploaded to ${uri}" |
| 8 | |
| 9 | curlscip-shell system . . curl. -H "Authorization: Bearer ${MATRIX_ACCESS_TOKEN}" -H "Content-Type: application/json" -X PUT -d "{ \"body\": \"${fileName}\", \"filename\": \"${fileName}\", \"info\": { \"mimetype\": \"application/x-compressed\", \"size\": $(wcscip-shell system . . wc. -c < ${file}) }, \"msgtype\": \"m.file\", \"url\": \"${uri}\" }" "https://matrix.neko.dev/_matrix/client/r0/rooms/${ROOM}/send/m.room.message/$(datescip-shell system . . date. +%s)" |