Fix UI and backend paths with subpath (#1799)

I'm not sure if this is an ideal fix for this, but it seems to work for
me. If you have another idea just let me know.

Closes #1798 
Closes #1773
This commit is contained in:
qwerty287
2023-08-07 16:05:18 +02:00
committed by GitHub
parent 10b1cfcd3b
commit 67b7de5cc2
30 changed files with 162 additions and 101 deletions

View File

@@ -7,7 +7,7 @@
<div class="flex items-center space-x-2">
<!-- Logo -->
<router-link :to="{ name: 'home' }" class="flex flex-col -my-2 px-2">
<img class="w-8 h-8" src="../../../assets/logo.svg?url" />
<WoodpeckerLogo class="w-8 h-8" />
<span class="text-xs">{{ version }}</span>
</router-link>
<!-- Repo Link -->
@@ -57,6 +57,7 @@
import { defineComponent } from 'vue';
import { useRoute } from 'vue-router';
import WoodpeckerLogo from '~/assets/logo.svg?component';
import Button from '~/components/atomic/Button.vue';
import IconButton from '~/components/atomic/IconButton.vue';
import useAuthentication from '~/compositions/useAuthentication';
@@ -68,7 +69,7 @@ import ActivePipelines from './ActivePipelines.vue';
export default defineComponent({
name: 'Navbar',
components: { Button, ActivePipelines, IconButton },
components: { Button, ActivePipelines, IconButton, WoodpeckerLogo },
setup() {
const config = useConfig();
@@ -76,7 +77,7 @@ export default defineComponent({
const authentication = useAuthentication();
const { darkMode } = useDarkMode();
const docsUrl = config.docs || undefined;
const apiUrl = `${config.rootURL ?? ''}/swagger/index.html`;
const apiUrl = `${config.rootPath ?? ''}/swagger/index.html`;
function doLogin() {
authentication.authenticate(route.fullPath);

View File

@@ -3,7 +3,7 @@
</template>
<script lang="ts" setup>
import WoodpeckerIcon from '../../../assets/woodpecker.svg?component';
import WoodpeckerIcon from '~/assets/woodpecker.svg?component';
</script>
<style scoped>

View File

@@ -48,6 +48,7 @@ import InputField from '~/components/form/InputField.vue';
import SelectField from '~/components/form/SelectField.vue';
import Panel from '~/components/layout/Panel.vue';
import useApiClient from '~/compositions/useApiClient';
import useConfig from '~/compositions/useConfig';
import { usePaginate } from '~/compositions/usePaginate';
import { Repo } from '~/lib/api/types';
@@ -89,7 +90,7 @@ export default defineComponent({
const baseUrl = `${window.location.protocol}//${window.location.hostname}${
window.location.port ? `:${window.location.port}` : ''
}`;
}${useConfig().rootPath}`;
const badgeUrl = computed(
() => `/api/badges/${repo.value.id}/status.svg${branch.value !== '' ? `?branch=${branch.value}` : ''}`,
);

View File

@@ -63,7 +63,7 @@ import useApiClient from '~/compositions/useApiClient';
import useConfig from '~/compositions/useConfig';
const { t } = useI18n();
const { enableSwagger } = useConfig();
const { rootPath, enableSwagger } = useConfig();
const apiClient = useApiClient();
const token = ref<string | undefined>();
@@ -72,7 +72,7 @@ onMounted(async () => {
token.value = await apiClient.getToken();
});
const address = `${window.location.protocol}//${window.location.host}`; // port is included in location.host
const address = `${window.location.protocol}//${window.location.host}${rootPath}`; // port is included in location.host
const usageWithShell = computed(() => {
let usage = `export WOODPECKER_SERVER="${address}"\n`;