Compare commits

...
5 changed files with 76 additions and 26 deletions
@@ -70,7 +70,7 @@ export function TemplateStoreModal({
<span> <span>
Templates from{" "} Templates from{" "}
<a <a
href="https://github.com/Dokploy/templates" href="https://gitea.computersurge.dev/ComputerSurge/dockploy-templates"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className="text-primary hover:underline" className="text-primary hover:underline"
@@ -165,7 +165,7 @@ export function TemplateStoreModal({
{...template} {...template}
logo={ logo={
template.logo template.logo
? `https://raw.githubusercontent.com/Dokploy/templates/main/blueprints/${template.id}/${template.logo}` ? `https://gitea.computersurge.dev/ComputerSurge/dockploy-templates/raw/branch/main/blueprints/${template.id}/${template.logo}`
: undefined : undefined
} }
onClick={() => onTemplateSelect(template)} onClick={() => onTemplateSelect(template)}
+59 -21
View File
@@ -696,14 +696,14 @@ function App() {
setTemplateError(null); setTemplateError(null);
} }
const GITHUB_OWNER = "hhftechnology"; const GITHUB_OWNER = "ComputerSurge";
const GITHUB_REPO = "Marketplace"; const GITHUB_REPO = "dock-dploy-Marketplace";
const GITHUB_BRANCH = "main"; const GITHUB_BRANCH = "main";
const GITHUB_RAW_BASE = "https://raw.githubusercontent.com"; const GITHUB_RAW_BASE = "https://gitea.computersurge.dev";
try { try {
// Fetch meta.json // Fetch meta.json
const metaUrl = `${GITHUB_RAW_BASE}/${GITHUB_OWNER}/${GITHUB_REPO}/${GITHUB_BRANCH}/meta.json`; const metaUrl = `${GITHUB_RAW_BASE}/${GITHUB_OWNER}/${GITHUB_REPO}/raw/branch/${GITHUB_BRANCH}/meta.json`; // URL format is for gitea
const metaResponse = await fetch(metaUrl); const metaResponse = await fetch(metaUrl);
if (!metaResponse.ok) { if (!metaResponse.ok) {
@@ -735,10 +735,10 @@ function App() {
// Fetch template details (compose, logo) // Fetch template details (compose, logo)
async function fetchTemplateDetails(templateId: string): Promise<any> { async function fetchTemplateDetails(templateId: string): Promise<any> {
const GITHUB_OWNER = "hhftechnology"; const GITHUB_OWNER = "ComputerSurge";
const GITHUB_REPO = "Marketplace"; const GITHUB_REPO = "dock-dploy-Marketplace";
const GITHUB_BRANCH = "main"; const GITHUB_BRANCH = "main";
const GITHUB_RAW_BASE = "https://raw.githubusercontent.com"; const GITHUB_RAW_BASE = "https://gitea.computersurge.dev";
const template = templates.find((t) => t.id === templateId); const template = templates.find((t) => t.id === templateId);
if (!template) { if (!template) {
@@ -749,7 +749,7 @@ function App() {
const basePath = `compose-files/${templateId}`; const basePath = `compose-files/${templateId}`;
// Fetch docker-compose.yml // Fetch docker-compose.yml
const composeUrl = `${GITHUB_RAW_BASE}/${GITHUB_OWNER}/${GITHUB_REPO}/${GITHUB_BRANCH}/${basePath}/docker-compose.yml`; const composeUrl = `${GITHUB_RAW_BASE}/${GITHUB_OWNER}/${GITHUB_REPO}/raw/branch/${GITHUB_BRANCH}/${basePath}/docker-compose.yml`; // URL format is for gitea
const composeResponse = await fetch(composeUrl); const composeResponse = await fetch(composeUrl);
if (!composeResponse.ok) { if (!composeResponse.ok) {
throw new Error( throw new Error(
@@ -761,7 +761,7 @@ function App() {
// Build logo URL if logo exists // Build logo URL if logo exists
let logoUrl = null; let logoUrl = null;
if (template.logo) { if (template.logo) {
logoUrl = `${GITHUB_RAW_BASE}/${GITHUB_OWNER}/${GITHUB_REPO}/${GITHUB_BRANCH}/${basePath}/${template.logo}`; logoUrl = `${GITHUB_RAW_BASE}/${GITHUB_OWNER}/${GITHUB_REPO}/raw/branch/${GITHUB_BRANCH}/${basePath}/${template.logo}`;
} }
return { return {
@@ -933,16 +933,19 @@ function App() {
: [], : [],
user: actualServiceData.user || "", user: actualServiceData.user || "",
working_dir: actualServiceData.working_dir || "", working_dir: actualServiceData.working_dir || "",
labels: actualServiceData.labels labels: Array.isArray(actualServiceData.labels)
? Array.isArray(actualServiceData.labels) ? actualServiceData.labels.map((l: string) => {
? actualServiceData.labels.map((l: string) => { const [key, ...rest] = l.split("=");
const [key, ...rest] = l.split("="); return { key, value: rest.join("=") };
return { key, value: rest.join("=") }; })
}) : actualServiceData.labels && typeof actualServiceData.labels === "object"
: Object.entries(actualServiceData.labels).map( ? Object.entries(actualServiceData.labels).map(
([key, value]: [string, any]) => ({ key, value: String(value) }) ([key, value]: [string, any]) => ({ key, value: String(value) })
) )
: [], : [],
labels_syntax: Array.isArray(actualServiceData.labels)
? "array"
: "dict",
privileged: privileged:
actualServiceData.privileged !== undefined actualServiceData.privileged !== undefined
? !!actualServiceData.privileged ? !!actualServiceData.privileged
@@ -1331,12 +1334,12 @@ function App() {
<div className="mb-4 text-xs text-muted-foreground"> <div className="mb-4 text-xs text-muted-foreground">
Templates from{" "} Templates from{" "}
<a <a
href="https://github.com/hhftechnology/Marketplace" href="https://gitea.computersurge.dev/ComputerSurge/dock-dploy-Marketplace"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className="text-primary hover:underline" className="text-primary hover:underline"
> >
hhftechnology/Marketplace ComputerSurge/dock-dploy-Marketplace
</a>{" "} </a>{" "}
repository. repository.
</div> </div>
@@ -1402,7 +1405,7 @@ function App() {
<div className="w-full flex items-start gap-3"> <div className="w-full flex items-start gap-3">
{template.logo ? ( {template.logo ? (
<img <img
src={`https://raw.githubusercontent.com/Dokploy/templates/main/blueprints/${template.id}/${template.logo}`} src={`https://gitea.computersurge.dev/ComputerSurge/dockploy-templates/raw/branch/main/blueprints/${template.id}/${template.logo}`}
alt={template.name} alt={template.name}
className="w-12 h-12 object-contain flex-shrink-0" className="w-12 h-12 object-contain flex-shrink-0"
onError={( onError={(
@@ -3274,7 +3277,42 @@ function App() {
</div> </div>
{/* Labels */} {/* Labels */}
<div> <div>
<Label className="mb-1 block">Labels</Label> <div className="flex items-center justify-between mb-1">
<div className="flex items-center gap-2">
<Label className="mb-1 block">Labels</Label>
</div>
<div className="flex gap-2 items-center">
<span className="text-xs text-muted-foreground">
Syntax:
</span>
<Toggle
pressed={svc.labels_syntax === "array"}
onPressedChange={(pressed) =>
updateServiceField(
"labels_syntax",
pressed ? "array" : "dict"
)
}
aria-label="Array syntax"
className="border rounded px-2 py-1 text-xs"
>
Array
</Toggle>
<Toggle
pressed={svc.labels_syntax === "dict"}
onPressedChange={(pressed) =>
updateServiceField(
"labels_syntax",
pressed ? "dict" : "array"
)
}
aria-label="Dictionary syntax"
className="border rounded px-2 py-1 text-xs"
>
Dict
</Toggle>
</div>
</div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
{svc.labels?.map((label, idx) => ( {svc.labels?.map((label, idx) => (
<div <div
+1
View File
@@ -58,6 +58,7 @@ export interface ServiceConfig {
user?: string; user?: string;
working_dir?: string; working_dir?: string;
labels?: { key: string; value: string }[]; labels?: { key: string; value: string }[];
labels_syntax?: "array" | "dict";
privileged?: boolean; privileged?: boolean;
read_only?: boolean; read_only?: boolean;
shm_size?: string; shm_size?: string;
+1
View File
@@ -115,6 +115,7 @@ export function defaultService(): ServiceConfig {
user: "", user: "",
working_dir: "", working_dir: "",
labels: [], labels: [],
labels_syntax: "array",
privileged: undefined, privileged: undefined,
read_only: undefined, read_only: undefined,
shm_size: "", shm_size: "",
+13 -3
View File
@@ -186,10 +186,20 @@ export function generateYaml(
working_dir: svc.working_dir || undefined, working_dir: svc.working_dir || undefined,
labels: labels:
svc.labels && svc.labels.filter((l) => l.key).length svc.labels && svc.labels.filter((l) => l.key).length
? svc.labels ? svc.labels_syntax === "dict"
? svc.labels
.filter(({ key }) => key)
.reduce(
(acc, { key, value }) => {
acc[key] = value;
return acc;
},
{} as Record<string, string>
)
: svc.labels
.filter((l) => l.key) .filter((l) => l.key)
.map(({ key, value }) => `"${key}=${value}"`) .map(({ key, value}) => `"${key}=${value}"`)
: undefined, :undefined,
privileged: svc.privileged !== undefined ? svc.privileged : undefined, privileged: svc.privileged !== undefined ? svc.privileged : undefined,
read_only: svc.read_only !== undefined ? svc.read_only : undefined, read_only: svc.read_only !== undefined ? svc.read_only : undefined,
shm_size: svc.shm_size || undefined, shm_size: svc.shm_size || undefined,