From 3155e21cbbd945653c754cc074baf2941024f6d1 Mon Sep 17 00:00:00 2001
From: oliverpool <git@olivier.pfad.fr>
Date: Mon, 8 Apr 2024 17:50:36 +0200
Subject: [PATCH] webhook: sourcehut_builds: prefill sr.ht as defaults

---
 options/locale/locale_en-US.ini             | 2 +-
 templates/webhook/new/sourcehut_builds.tmpl | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 37fef6d227..b46fd9eb3b 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2378,6 +2378,7 @@ settings.slack_token = Token
 settings.slack_domain = Domain
 settings.slack_channel = Channel
 settings.add_web_hook_desc = Integrate <a target="_blank" rel="noreferrer" href="%s">%s</a> into your repository.
+settings.graphql_url = GraphQL URL
 settings.web_hook_name_gitea = Gitea
 settings.web_hook_name_forgejo = Forgejo
 settings.web_hook_name_gogs = Gogs
@@ -2397,7 +2398,6 @@ settings.packagist_api_token = API token
 settings.packagist_package_url = Packagist package URL
 settings.web_hook_name_sourcehut_builds = SourceHut Builds
 settings.sourcehut_builds.manifest_path = Build manifest path
-settings.sourcehut_builds.graphql_url = GraphQL URL (e.g. https://builds.sr.ht/query)
 settings.sourcehut_builds.visibility = Job visibility
 settings.sourcehut_builds.secrets = Secrets
 settings.sourcehut_builds.secrets_helper = Give the job access to the build secrets (requires the SECRETS:RO grant)
diff --git a/templates/webhook/new/sourcehut_builds.tmpl b/templates/webhook/new/sourcehut_builds.tmpl
index d6fe3e7f10..e18b828f8d 100644
--- a/templates/webhook/new/sourcehut_builds.tmpl
+++ b/templates/webhook/new/sourcehut_builds.tmpl
@@ -2,12 +2,12 @@
 <form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "sourcehut_builds/new"}}" method="post">
 	{{.CsrfTokenHtml}}
 	<div class="required field {{if .Err_PayloadURL}}error{{end}}">
-		<label for="payload_url">{{ctx.Locale.Tr "repo.settings.sourcehut_builds.graphql_url"}}</label>
-		<input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required>
+		<label for="payload_url">{{ctx.Locale.Tr "repo.settings.graphql_url"}}</label>
+		<input id="payload_url" name="payload_url" type="url" value="{{or .Webhook.URL "https://builds.sr.ht/query"}}" autofocus required>
 	</div>
 	<div class="required field {{if .Err_ManifestPath}}error{{end}}">
 		<label for="manifest_path">{{ctx.Locale.Tr "repo.settings.sourcehut_builds.manifest_path"}}</label>
-		<input id="manifest_path" name="manifest_path" type="text" value="{{.HookMetadata.ManifestPath}}" required>
+		<input id="manifest_path" name="manifest_path" type="text" value="{{or .HookMetadata.ManifestPath ".build.yml"}}" required>
 	</div>
 	<div class="field">
 		<label>{{ctx.Locale.Tr "repo.settings.sourcehut_builds.visibility"}}</label>