diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 00000000..a3e28449 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,41 @@ +kind: pipeline +type: docker +name: Deploy + +clone: + disable: true + +steps: + - name: Clone + image: woodpeckerci/plugin-git + settings: + recursive: true + + - name: Build + depends_on: + - Clone + image: node:16 + commands: + - yarn + - yarn build:prod + when: + event: + - push + + - name: Execute deploy script + depends_on: + - Build + image: ubuntu:latest + environment: + SSH_KEY: + from_secret: SSH_KEY + commands: + - apt update && apt install -y openssh-client rsync + - ./ci/add-key.sh + - ./ci/deploy.sh + when: + event: + - push + branch: + - froth + - froth-akkoma diff --git a/.gitignore b/.gitignore index f489a1e6..cad12145 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ selenium-debug.log package-lock.json coverage/ + +.dccache diff --git a/ci/add-key.sh b/ci/add-key.sh new file mode 100755 index 00000000..64614f90 --- /dev/null +++ b/ci/add-key.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# only execute this script as part of the pipeline. +[ -z "$CI" ] && echo "missing ci environment variable" && exit 2 + +# only execute the script when github token exists. +[ -z "$SSH_KEY" ] && echo "missing ssh key" && exit 3 + +# write the ssh key. +mkdir /root/.ssh +echo -n "${SSH_KEY}" > /root/.ssh/id_ed25519 +chmod 600 /root/.ssh/id_ed25519 + +# add froth.zone to our known hosts. +touch /root/.ssh/known_hosts +chmod 600 /root/.ssh/known_hosts +ssh-keyscan -H froth.zone > /etc/ssh/ssh_known_hosts 2> /dev/null diff --git a/ci/deploy.sh b/ci/deploy.sh new file mode 100755 index 00000000..9e507e2b --- /dev/null +++ b/ci/deploy.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +TARGET="pleroma@froth.zone:/opt/pleroma" + +rsync --update -Pr dist/ "${TARGET}/instance/static/frontends/admin-fe/froth" + diff --git a/src/api/chat.js b/src/api/chat.js index 73990cfa..f0831237 100644 --- a/src/api/chat.js +++ b/src/api/chat.js @@ -5,7 +5,7 @@ import { baseName } from './utils' export async function deleteChatMessage(chat_id, message_id, authHost, token) { return await request({ baseURL: baseName(authHost), - url: `/api/pleroma/admin/chats/${chat_id}/messages/${message_id}`, + url: `/api/v1/pleroma/admin/chats/${chat_id}/messages/${message_id}`, method: 'delete', headers: authHeaders(token) }) @@ -14,7 +14,7 @@ export async function deleteChatMessage(chat_id, message_id, authHost, token) { export async function fetchChat(id, authHost, token) { return await request({ baseURL: baseName(authHost), - url: `/api/pleroma/admin/chats/${id}`, + url: `/api/v1/pleroma/admin/chats/${id}`, method: 'get', headers: authHeaders(token) }) @@ -22,8 +22,8 @@ export async function fetchChat(id, authHost, token) { export async function fetchChatMessages(id, maxId, authHost, token) { const url = maxId - ? `/api/pleroma/admin/chats/${id}/messages?max_id=${maxId}` - : `/api/pleroma/admin/chats/${id}/messages` + ? `/api/v1/pleroma/admin/chats/${id}/messages?max_id=${maxId}` + : `/api/v1/pleroma/admin/chats/${id}/messages` return await request({ baseURL: baseName(authHost), url, diff --git a/src/api/users.js b/src/api/users.js index e04b8cfc..1ec4a964 100644 --- a/src/api/users.js +++ b/src/api/users.js @@ -183,7 +183,7 @@ export async function fetchUserStatuses(id, authHost, godmode, token) { export async function fetchUserChats(id, authHost, token) { return await request({ baseURL: baseName(authHost), - url: `/api/pleroma/admin/users/${id}/chats`, + url: `/api/v1/pleroma/admin/users/${id}/chats`, method: 'get', headers: authHeaders(token) })