Merge branch 'canary' into italian-lang

This commit is contained in:
Mauricio Siu
2024-12-11 23:11:22 -06:00
committed by GitHub
20 changed files with 4461 additions and 45 deletions

View File

@@ -33,6 +33,9 @@ const Schema = z.object({
name: z.string().min(1, {
message: "Name is required",
}),
gitlabUrl: z.string().min(1, {
message: "GitLab URL is required",
}),
applicationId: z.string().min(1, {
message: "Application ID is required",
}),
@@ -62,16 +65,22 @@ export const AddGitlabProvider = () => {
applicationSecret: "",
groupName: "",
redirectUri: webhookUrl,
name: "",
gitlabUrl: "https://gitlab.com",
},
resolver: zodResolver(Schema),
});
const gitlabUrl = form.watch("gitlabUrl");
useEffect(() => {
form.reset({
applicationId: "",
applicationSecret: "",
groupName: "",
redirectUri: webhookUrl,
name: "",
gitlabUrl: "https://gitlab.com",
});
}, [form, isOpen]);
@@ -83,6 +92,7 @@ export const AddGitlabProvider = () => {
authId: auth?.id || "",
name: data.name || "",
redirectUri: data.redirectUri || "",
gitlabUrl: data.gitlabUrl || "https://gitlab.com",
})
.then(async () => {
await utils.gitProvider.getAll.invalidate();
@@ -129,7 +139,7 @@ export const AddGitlabProvider = () => {
<li className="flex flex-row gap-2 items-center">
Go to your GitLab profile settings{" "}
<Link
href="https://gitlab.com/-/profile/applications"
href={`${gitlabUrl}/-/profile/applications`}
target="_blank"
>
<ExternalLink className="w-fit text-primary size-4" />
@@ -169,6 +179,20 @@ export const AddGitlabProvider = () => {
)}
/>
<FormField
control={form.control}
name="gitlabUrl"
render={({ field }) => (
<FormItem>
<FormLabel>Gitlab URL</FormLabel>
<FormControl>
<Input placeholder="https://gitlab.com/" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="redirectUri"

View File

@@ -30,6 +30,9 @@ const Schema = z.object({
name: z.string().min(1, {
message: "Name is required",
}),
gitlabUrl: z.string().url({
message: "Invalid Gitlab URL",
}),
groupName: z.string().optional(),
});
@@ -40,7 +43,7 @@ interface Props {
}
export const EditGitlabProvider = ({ gitlabId }: Props) => {
const { data: gitlab } = api.gitlab.one.useQuery(
const { data: gitlab, refetch } = api.gitlab.one.useQuery(
{
gitlabId,
},
@@ -57,6 +60,7 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
defaultValues: {
groupName: "",
name: "",
gitlabUrl: "https://gitlab.com",
},
resolver: zodResolver(Schema),
});
@@ -67,6 +71,7 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
form.reset({
groupName: gitlab?.groupName || "",
name: gitlab?.gitProvider.name || "",
gitlabUrl: gitlab?.gitlabUrl || "",
});
}, [form, isOpen]);
@@ -76,11 +81,13 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
gitProviderId: gitlab?.gitProviderId || "",
groupName: data.groupName || "",
name: data.name || "",
gitlabUrl: data.gitlabUrl || "",
})
.then(async () => {
await utils.gitProvider.getAll.invalidate();
toast.success("Gitlab updated successfully");
setIsOpen(false);
refetch();
})
.catch(() => {
toast.error("Error to update Gitlab");
@@ -126,6 +133,19 @@ export const EditGitlabProvider = ({ gitlabId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="gitlabUrl"
render={({ field }) => (
<FormItem>
<FormLabel>Gitlab Url</FormLabel>
<FormControl>
<Input placeholder="https://gitlab.com" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}

View File

@@ -23,12 +23,16 @@ export const ShowGitProviders = () => {
const url = useUrl();
const getGitlabUrl = (clientId: string, gitlabId: string) => {
const getGitlabUrl = (
clientId: string,
gitlabId: string,
gitlabUrl: string,
) => {
const redirectUri = `${url}/api/providers/gitlab/callback?gitlabId=${gitlabId}`;
const scope = "api read_user read_repository";
const authUrl = `https://gitlab.com/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=code&scope=${encodeURIComponent(scope)}`;
const authUrl = `${gitlabUrl}/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=code&scope=${encodeURIComponent(scope)}`;
return authUrl;
};
@@ -142,6 +146,7 @@ export const ShowGitProviders = () => {
href={getGitlabUrl(
gitProvider.gitlab?.applicationId || "",
gitProvider.gitlab?.gitlabId || "",
gitProvider.gitlab?.gitlabUrl,
)}
target="_blank"
className={buttonVariants({

View File

@@ -0,0 +1 @@
ALTER TABLE "gitlab" ADD COLUMN "gitlabUrl" text DEFAULT 'https://gitlab.com' NOT NULL;

File diff suppressed because it is too large Load Diff

View File

@@ -351,6 +351,13 @@
"when": 1733628762978,
"tag": "0049_dark_leopardon",
"breakpoints": true
},
{
"idx": 50,
"version": "6",
"when": 1733889104203,
"tag": "0050_nappy_wrecker",
"breakpoints": true
}
]
}

View File

@@ -12,6 +12,7 @@ export enum Languages {
Korean = "ko",
Portuguese = "pt-br",
Italian = "it",
Japanese = "ja",
}
export type Language = keyof typeof Languages;

View File

@@ -1,23 +0,0 @@
/** @type {import('next-i18next').UserConfig} */
module.exports = {
fallbackLng: "en",
keySeparator: false,
i18n: {
defaultLocale: "en",
locales: [
"en",
"pl",
"ru",
"fr",
"de",
"tr",
"kz",
"zh-Hant",
"zh-Hans",
"fa",
"ko",
"pt-br",
],
localeDetection: false,
},
};

View File

@@ -13,7 +13,7 @@ export default async function handler(
const gitlab = await findGitlabById(gitlabId as string);
const response = await fetch("https://gitlab.com/oauth/token", {
const response = await fetch(`${gitlab.gitlabUrl}/oauth/token`, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,44 @@
{
"settings.common.save": "保存",
"settings.server.domain.title": "サーバードメイン",
"settings.server.domain.description": "サーバーアプリケーションにドメインを追加",
"settings.server.domain.form.domain": "ドメイン",
"settings.server.domain.form.letsEncryptEmail": "Let's Encrypt メールアドレス",
"settings.server.domain.form.certificate.label": "証明書",
"settings.server.domain.form.certificate.placeholder": "証明書を選択",
"settings.server.domain.form.certificateOptions.none": "なし",
"settings.server.domain.form.certificateOptions.letsencrypt": "Let's Encrypt (デフォルト)",
"settings.server.webServer.title": "ウェブサーバー",
"settings.server.webServer.description": "ウェブサーバーをリロードまたはクリーンアップします",
"settings.server.webServer.actions": "アクション",
"settings.server.webServer.reload": "リロード",
"settings.server.webServer.watchLogs": "ログを監視",
"settings.server.webServer.updateServerIp": "サーバーIPを更新",
"settings.server.webServer.server.label": "サーバー",
"settings.server.webServer.traefik.label": "Traefik",
"settings.server.webServer.traefik.modifyEnv": "環境設定を変更",
"settings.server.webServer.storage.label": "ストレージ",
"settings.server.webServer.storage.cleanUnusedImages": "未使用のイメージを削除",
"settings.server.webServer.storage.cleanUnusedVolumes": "未使用のボリュームを削除",
"settings.server.webServer.storage.cleanStoppedContainers": "停止中のコンテナを削除",
"settings.server.webServer.storage.cleanDockerBuilder": "Docker ビルダー&システムをクリーンアップ",
"settings.server.webServer.storage.cleanMonitoring": "モニタリングをクリーンアップ",
"settings.server.webServer.storage.cleanAll": "すべてをクリーンアップ",
"settings.profile.title": "アカウント",
"settings.profile.description": "ここでプロフィールの詳細を変更できます",
"settings.profile.email": "メールアドレス",
"settings.profile.password": "パスワード",
"settings.profile.avatar": "アバター",
"settings.appearance.title": "外観",
"settings.appearance.description": "ダッシュボードのテーマをカスタマイズ",
"settings.appearance.theme": "テーマ",
"settings.appearance.themeDescription": "ダッシュボードのテーマを選択してください",
"settings.appearance.themes.light": "ライト",
"settings.appearance.themes.dark": "ダーク",
"settings.appearance.themes.system": "システム",
"settings.appearance.language": "言語",
"settings.appearance.languageDescription": "ダッシュボードの言語を選択してください"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -142,6 +142,10 @@ export const gitlabRouter = createTRPCRouter({
name: input.name,
adminId: ctx.user.adminId,
});
await updateGitlab(input.gitlabId, {
...input,
});
} else {
await updateGitlab(input.gitlabId, {
...input,

View File

@@ -0,0 +1,42 @@
services:
app:
depends_on:
postgres:
condition: service_healthy
image: svhd/logto:1.22.0
entrypoint: ["sh", "-c", "npm run cli db seed -- --swe && npm start"]
ports:
- 3001
- 3002
networks:
- dokploy-network
environment:
TRUST_PROXY_HEADER: 1
DB_URL: postgres://logto:${LOGTO_POSTGRES_PASSWORD}@postgres:5432/logto
ENDPOINT: ${LOGTO_ENDPOINT}
ADMIN_ENDPOINT: ${LOGTO_ADMIN_ENDPOINT}
volumes:
- logto-connectors:/etc/logto/packages/core/connectors
postgres:
image: postgres:17-alpine
user: postgres
networks:
- dokploy-network
environment:
POSTGRES_USER: logto
POSTGRES_PASSWORD: ${LOGTO_POSTGRES_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
networks:
dokploy-network:
external: true
volumes:
logto-connectors:
postgres-data:

View File

@@ -0,0 +1,37 @@
import {
type DomainSchema,
type Schema,
type Template,
generatePassword,
generateRandomDomain,
} from "../utils";
export function generate(schema: Schema): Template {
const mainDomain = generateRandomDomain(schema);
const adminDomain = generateRandomDomain(schema);
const postgresPassword = generatePassword();
const domains: DomainSchema[] = [
{
host: mainDomain,
port: 3001,
serviceName: "app",
},
{
host: adminDomain,
port: 3002,
serviceName: "app",
},
];
const envs = [
`LOGTO_ENDPOINT=http://${adminDomain}`,
`LOGTO_ADMIN_ENDPOINT=http://${adminDomain}`,
`LOGTO_POSTGRES_PASSWORD=${postgresPassword}`,
];
return {
domains,
envs,
};
}

View File

@@ -1,7 +1,7 @@
version: "3.8"
services:
n8n:
image: docker.n8n.io/n8nio/n8n:1.48.1
image: docker.n8n.io/n8nio/n8n:1.70.3
restart: always
environment:
- N8N_HOST=${N8N_HOST}

View File

@@ -155,7 +155,7 @@ export const templates: TemplateData[] = [
{
id: "n8n",
name: "n8n",
version: "1.48.1",
version: "1.70.3",
description:
"n8n is an open source low-code platform for automating workflows and integrations.",
logo: "n8n.png",
@@ -1016,8 +1016,8 @@ export const templates: TemplateData[] = [
},
tags: ["browser", "automation"],
load: () => import("./browserless/index").then((m) => m.generate),
},
{
},
{
id: "drawio",
name: "draw.io",
version: "24.7.17",
@@ -1031,8 +1031,8 @@ export const templates: TemplateData[] = [
},
tags: ["drawing", "diagrams"],
load: () => import("./drawio/index").then((m) => m.generate),
},
{
},
{
id: "kimai",
name: "Kimai",
version: "2.26.0",
@@ -1047,4 +1047,19 @@ export const templates: TemplateData[] = [
tags: ["invoice", "business", "finance"],
load: () => import("./kimai/index").then((m) => m.generate),
},
{
id: "logto",
name: "Logto",
version: "1.22.0",
description:
"Logto is an open-source Identity and Access Management (IAM) platform designed to streamline Customer Identity and Access Management (CIAM) and Workforce Identity Management.",
logo: "logto.png",
links: {
github: "https://github.com/logto-io/logto",
website: "https://logto.io/",
docs: "https://docs.logto.io/introduction",
},
tags: ["identity", "auth"],
load: () => import("./logto/index").then((m) => m.generate),
},
];

View File

@@ -10,6 +10,7 @@ export const gitlab = pgTable("gitlab", {
.notNull()
.primaryKey()
.$defaultFn(() => nanoid()),
gitlabUrl: text("gitlabUrl").default("https://gitlab.com").notNull(),
applicationId: text("application_id"),
redirectUri: text("redirect_uri"),
secret: text("secret"),
@@ -39,6 +40,7 @@ export const apiCreateGitlab = createSchema.extend({
redirectUri: z.string().optional(),
authId: z.string().min(1),
name: z.string().min(1),
gitlabUrl: z.string().min(1),
});
export const apiFindOneGitlab = createSchema
@@ -67,4 +69,5 @@ export const apiUpdateGitlab = createSchema.extend({
redirectUri: z.string().optional(),
name: z.string().min(1),
gitlabId: z.string().min(1),
gitlabUrl: z.string().min(1),
});

View File

@@ -318,13 +318,13 @@ export const calculateResources = ({
return {
Limits: {
MemoryBytes: memoryLimit ? memoryLimit * 1024 * 1024 : undefined,
NanoCPUs: memoryLimit ? (cpuLimit || 1) * 1000 * 1000 * 1000 : undefined,
NanoCPUs: cpuLimit ? (cpuLimit || 1) * 1000 * 1000 * 1000 : undefined,
},
Reservations: {
MemoryBytes: memoryLimit
MemoryBytes: memoryReservation
? (memoryReservation || 1) * 1024 * 1024
: undefined,
NanoCPUs: memoryLimit
NanoCPUs: cpuReservation
? (cpuReservation || 1) * 1000 * 1000 * 1000
: undefined,
},

View File

@@ -26,7 +26,7 @@ export const refreshGitlabToken = async (gitlabProviderId: string) => {
return;
}
const response = await fetch("https://gitlab.com/oauth/token", {
const response = await fetch(`${gitlabProvider.gitlabUrl}/oauth/token`, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
@@ -122,7 +122,7 @@ export const cloneGitlabRepository = async (
const basePath = isCompose ? COMPOSE_PATH : APPLICATIONS_PATH;
const outputPath = join(basePath, appName, "code");
await recreateDirectory(outputPath);
const repoclone = `gitlab.com/${gitlabPathNamespace}.git`;
const repoclone = `${gitlab?.gitlabUrl.replace(/^https?:\/\//, "")}/${gitlabPathNamespace}.git`;
const cloneUrl = `https://oauth2:${gitlab?.accessToken}@${repoclone}`;
try {
@@ -218,7 +218,7 @@ export const getGitlabCloneCommand = async (
const basePath = isCompose ? COMPOSE_PATH : APPLICATIONS_PATH;
const outputPath = join(basePath, appName, "code");
await recreateDirectory(outputPath);
const repoclone = `gitlab.com/${gitlabPathNamespace}.git`;
const repoclone = `${gitlab?.gitlabUrl.replace(/^https?:\/\//, "")}/${gitlabPathNamespace}.git`;
const cloneUrl = `https://oauth2:${gitlab?.accessToken}@${repoclone}`;
const cloneCommand = `
@@ -244,7 +244,7 @@ export const getGitlabRepositories = async (gitlabId?: string) => {
const gitlabProvider = await findGitlabById(gitlabId);
const response = await fetch(
`https://gitlab.com/api/v4/projects?membership=true&owned=true&page=${0}&per_page=${100}`,
`${gitlabProvider.gitlabUrl}/api/v4/projects?membership=true&owned=true&page=${0}&per_page=${100}`,
{
headers: {
Authorization: `Bearer ${gitlabProvider.accessToken}`,
@@ -304,7 +304,7 @@ export const getGitlabBranches = async (input: {
const gitlabProvider = await findGitlabById(input.gitlabId);
const branchesResponse = await fetch(
`https://gitlab.com/api/v4/projects/${input.id}/repository/branches`,
`${gitlabProvider.gitlabUrl}/api/v4/projects/${input.id}/repository/branches`,
{
headers: {
Authorization: `Bearer ${gitlabProvider.accessToken}`,
@@ -350,7 +350,9 @@ export const cloneRawGitlabRepository = async (entity: Compose) => {
const basePath = COMPOSE_PATH;
const outputPath = join(basePath, appName, "code");
await recreateDirectory(outputPath);
const repoclone = `gitlab.com/${gitlabPathNamespace}.git`;
const gitlabUrl = gitlabProvider.gitlabUrl;
// What happen with oauth in self hosted instances?
const repoclone = `${gitlabUrl.replace(/^https?:\/\//, "")}/${gitlabPathNamespace}.git`;
const cloneUrl = `https://oauth2:${gitlabProvider?.accessToken}@${repoclone}`;
try {
@@ -390,7 +392,7 @@ export const cloneRawGitlabRepositoryRemote = async (compose: Compose) => {
await refreshGitlabToken(gitlabId);
const basePath = COMPOSE_PATH;
const outputPath = join(basePath, appName, "code");
const repoclone = `gitlab.com/${gitlabPathNamespace}.git`;
const repoclone = `${gitlabProvider.gitlabUrl.replace(/^https?:\/\//, "")}/${gitlabPathNamespace}.git`;
const cloneUrl = `https://oauth2:${gitlabProvider?.accessToken}@${repoclone}`;
try {
const command = `
@@ -417,7 +419,7 @@ export const testGitlabConnection = async (
const gitlabProvider = await findGitlabById(gitlabId);
const response = await fetch(
`https://gitlab.com/api/v4/projects?membership=true&owned=true&page=${0}&per_page=${100}`,
`${gitlabProvider.gitlabUrl}/api/v4/projects?membership=true&owned=true&page=${0}&per_page=${100}`,
{
headers: {
Authorization: `Bearer ${gitlabProvider.accessToken}`,