Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: public gh repo reload compose

Andras Bacsai344c36997a74
diff --git a/apps/client/src/routes/applications/[id]/+page.svelte b/apps/client/src/routes/applications/[id]/+page.svelte
index 2747090b89..086c3ac571 100644
--- a/apps/client/src/routes/applications/[id]/+page.svelte
+++ b/apps/client/src/routes/applications/[id]/+page.svelte
@@ -351,7 +351,7 @@
}
async function reloadCompose() {
if (loading.reloadCompose) return;
- if (!$appSession.tokens.github) {
+ if (!$appSession.tokens.github && !isPublicRepository) {
const { token } = await get(`/applications/${id}/configuration/githubToken`);
$appSession.tokens.github = token;
}
@@ -385,7 +385,7 @@
}
}
if (application.gitSource.type === 'gitlab') {
- if (!$appSession.tokens.gitlab) {
+ if (!$appSession.tokens.gitlab && !isPublicRepository) {
await getGitlabToken();
}
diff --git a/apps/ui/src/routes/applications/[id]/configuration/_GithubRepositories.svelte b/apps/ui/src/routes/applications/[id]/configuration/_GithubRepositories.svelte
index 7f1f40f624..593436950e 100644
--- a/apps/ui/src/routes/applications/[id]/configuration/_GithubRepositories.svelte
+++ b/apps/ui/src/routes/applications/[id]/configuration/_GithubRepositories.svelte
@@ -125,6 +125,7 @@
}
}
</script>
+
{#if repositories.length === 0 && loading.repositories === false}
<div class="flex-col text-center">
<div class="pb-4">{$t('application.configuration.no_repositories_configured')}</div>
@@ -134,43 +135,45 @@
</div>
{:else}
<form on:submit|preventDefault={handleSubmit} class="px-10">
- <div class="flex lg:flex-row flex-col lg:space-y-0 space-y-2 space-x-0 lg:space-x-2 items-center lg:justify-center">
- <div class="custom-select-wrapper w-full"><label for="repository" class="pb-1">Repository</label>
- <Select
- placeholder={loading.repositories
- ? $t('application.configuration.loading_repositories')
- : $t('application.configuration.select_a_repository')}
- id="repository"
- showIndicator={!loading.repositories}
- isWaiting={loading.repositories}
- on:select={loadBranches}
- items={reposSelectOptions}
- isDisabled={loading.repositories}
- isClearable={false}
- />
- </div>
- <input class="hidden" bind:value={selected.projectId} name="projectId" />
- <div class="custom-select-wrapper w-full"><label for="repository" class="pb-1">Branch</label>
- <Select
- placeholder={loading.branches
- ? $t('application.configuration.loading_branches')
- : !selected.repository
- ? $t('application.configuration.select_a_repository_first')
- : $t('application.configuration.select_a_branch')}
- isWaiting={loading.branches}
- showIndicator={selected.repository && !loading.branches}
- id="branches"
- on:select={selectBranch}
- items={branchSelectOptions}
- isDisabled={loading.branches || !selected.repository}
- isClearable={false}
- />
- </div></div>
+ <div
+ class="flex lg:flex-row flex-col lg:space-y-0 space-y-2 space-x-0 lg:space-x-2 items-center lg:justify-center"
+ >
+ <div class="custom-select-wrapper w-full">
+ <label for="repository" class="pb-1">Repository</label>
+ <Select
+ placeholder={loading.repositories
+ ? $t('application.configuration.loading_repositories')
+ : $t('application.configuration.select_a_repository')}
+ id="repository"
+ showIndicator={!loading.repositories}
+ isWaiting={loading.repositories}
+ on:select={loadBranches}
+ items={reposSelectOptions}
+ isDisabled={loading.repositories}
+ isClearable={false}
+ />
+ </div>
+ <input class="hidden" bind:value={selected.projectId} name="projectId" />
+ <div class="custom-select-wrapper w-full">
+ <label for="repository" class="pb-1">Branch</label>
+ <Select
+ placeholder={loading.branches
+ ? $t('application.configuration.loading_branches')
+ : !selected.repository
+ ? $t('application.configuration.select_a_repository_first')
+ : $t('application.configuration.select_a_branch')}
+ isWaiting={loading.branches}
+ showIndicator={selected.repository && !loading.branches}
+ id="branches"
+ on:select={selectBranch}
+ items={branchSelectOptions}
+ isDisabled={loading.branches || !selected.repository}
+ isClearable={false}
+ />
+ </div>
+ </div>
<div class="pt-5 flex-col flex justify-center items-center space-y-4">
- <button
- class="btn btn-wide btn-primary"
- type="submit"
- disabled={!showSave}
+ <button class="btn btn-wide btn-primary" type="submit" disabled={!showSave}
>{$t('forms.save')}</button
>
</div>
diff --git a/apps/ui/src/routes/applications/[id]/index.svelte b/apps/ui/src/routes/applications/[id]/index.svelte
index 5dd50825a8..fbf6179925 100644
--- a/apps/ui/src/routes/applications/[id]/index.svelte
+++ b/apps/ui/src/routes/applications/[id]/index.svelte
@@ -366,16 +366,16 @@
async function reloadCompose() {
if (loading.reloadCompose) return;
loading.reloadCompose = true;
- if (!$appSession.tokens.github) {
+ if (!$appSession.tokens.github && !isPublicRepository) {
const { token } = await get(`/applications/${id}/configuration/githubToken`);
$appSession.tokens.github = token;
}
try {
if (application.gitSource.type === 'github') {
const composeLocation = application.dockerComposeFileLocation.startsWith('/')
- ? application.dockerComposeFileLocation
- : `/${application.dockerComposeFileLocation}`;
-
+ ? application.dockerComposeFileLocation
+ : `/${application.dockerComposeFileLocation}`;
+
const headers = isPublicRepository
? {}
: {
@@ -402,17 +402,17 @@
if (!$appSession.tokens.gitlab) {
await getGitlabToken();
}
-
+
const composeLocation = application.dockerComposeFileLocation.startsWith('/')
- ? application.dockerComposeFileLocation.substring(1) // Remove the '/' from the start
- : application.dockerComposeFileLocation;
-
+ ? application.dockerComposeFileLocation.substring(1) // Remove the '/' from the start
+ : application.dockerComposeFileLocation;
+
// If the file is in a subdirectory, lastIndex will be > 0
// Otherwise it will be -1 and path will be an empty string
- const lastIndex = composeLocation.lastIndexOf('/') + 1
- const path = composeLocation.substring(0, lastIndex)
- const fileName = composeLocation.substring(lastIndex)
-
+ const lastIndex = composeLocation.lastIndexOf('/') + 1;
+ const path = composeLocation.substring(0, lastIndex);
+ const fileName = composeLocation.substring(lastIndex);
+
const headers = isPublicRepository
? {}
: {
@@ -425,8 +425,7 @@
...headers
});
const dockerComposeFileYml = files.find(
- (file: { name: string; type: string }) =>
- file.name === fileName && file.type === 'blob'
+ (file: { name: string; type: string }) => file.name === fileName && file.type === 'blob'
);
const id = dockerComposeFileYml.id;
@@ -506,7 +505,14 @@
<div class="grid grid-flow-row gap-2 px-4">
<div class="mt-2 grid grid-cols-2 items-center">
<label for="name">{$t('forms.name')}</label>
- <input name="name" id="name" class="w-full" bind:value={application.name} disabled={!$appSession.isAdmin} required />
+ <input
+ name="name"
+ id="name"
+ class="w-full"
+ bind:value={application.name}
+ disabled={!$appSession.isAdmin}
+ required
+ />
</div>
{#if !isSimpleDockerfile}
<div class="grid grid-cols-2 items-center">