Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Share: the post links the GitHub repository as well as itch (#1597)

Eyal Golan976604b2b2c8
diff --git a/changelog.d/share-post-repo-link.md b/changelog.d/share-post-repo-link.md
new file mode 100644
index 000000000..e429b7069
--- /dev/null
+++ b/changelog.d/share-post-repo-link.md
@@ -0,0 +1,4 @@
+### Changed
+
+- A shared post now links the game's GitHub repository as well as its itch page ("Play: ... · Code: ..."), in the
+ share sheet, Copy, X, WhatsApp and Telegram. Facebook and LinkedIn take only a URL, so they still link the itch page.
diff --git a/unity/Assets/Scripts/UI/ShareShot.cs b/unity/Assets/Scripts/UI/ShareShot.cs
index 3c7078368..385c4903a 100644
--- a/unity/Assets/Scripts/UI/ShareShot.cs
+++ b/unity/Assets/Scripts/UI/ShareShot.cs
@@ -19,6 +19,8 @@ namespace Statecraft.Game.UI
{
/// <summary>The game's itch page, the link the post carries (owner's decision, 20 Oct 2026).</summary>
public const string Itch = "https://eyalgolan.itch.io/statecraft-israel";
+ /// <summary>The game's GitHub repository, the post's second link (owner, 24 Oct 2026).</summary>
+ public const string Repo = ExternalLink.Repository;
/// <summary>The picture's long side at most: a DPR-3 phone frame encoded at full size can exhaust the WebGL heap.</summary>
public const int MaxSide = 1920;
/// <summary>The site buttons, in the panel's order: the owner's list (#1237; LinkedIn kept, at the end, owner 21 Oct
@@ -36,11 +38,11 @@ namespace Statecraft.Game.UI
public static Action<string> Copy = DefaultCopy;
public static Func<CopyResult> Copied = DefaultCopied;
- /// <summary>The post, in the UI's language, with the in-game date and turn and the itch URL.</summary>
- public static string Text(UiText text, string date, int turn) => text.Format("share.post", date, turn, Itch);
+ /// <summary>The post, in the UI's language, with the in-game date and turn, the itch URL and the repository's.</summary>
+ public static string Text(UiText text, string date, int turn) => text.Format("share.post", date, turn, Itch, Repo);
- /// <summary>A site's share link. X and WhatsApp take the text, which ends with the URL; Telegram takes the URL and the
- /// text, both encoded (core.telegram.org/widgets/share); Facebook and LinkedIn take only the URL.</summary>
+ /// <summary>A site's share link. X and WhatsApp take the text, which carries both URLs; Telegram takes the itch URL and
+ /// the text, both encoded (core.telegram.org/widgets/share); Facebook and LinkedIn take only a URL, the itch one.</summary>
public static string IntentUrl(string site, string text) => site switch
{
"x" => "https://x.com/intent/post?text=" + Uri.EscapeDataString(text),
diff --git a/unity/Assets/Tests/EditMode/ShareShotTests.cs b/unity/Assets/Tests/EditMode/ShareShotTests.cs
index e1c8bdfe0..93de3521b 100644
--- a/unity/Assets/Tests/EditMode/ShareShotTests.cs
+++ b/unity/Assets/Tests/EditMode/ShareShotTests.cs
@@ -22,18 +22,61 @@ public class ShareShotTests
static UiText En => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Strings).text);
static UiText He => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");
+ /// <summary>The post carries the itch page and the GitHub repository (owner, 24 Oct 2026: "when a user shares a post it
+ /// will include a link to the game on itch and to the github repo").</summary>
[Test]
- public void ThePostNamesTheGameTheDateTheTurnAndTheItchPage()
+ public void ThePostNamesTheGameTheDateTheTurnTheItchPageAndTheRepository()
{
+ Assert.AreEqual("https://github.com/eyalgolan/statecraft-israel", ShareShot.Repo);
Assert.AreEqual("I'm running Israel in 1948 in Statecraft: Israel, a free strategy game. 15 May 1948, turn 0. "
- + "Play: https://eyalgolan.itch.io/statecraft-israel", ShareShot.Text(En, "15 May 1948", 0));
+ + "Play: https://eyalgolan.itch.io/statecraft-israel · Code: https://github.com/eyalgolan/statecraft-israel",
+ ShareShot.Text(En, "15 May 1948", 0));
var he = ShareShot.Text(He, "15 במאי 1948", 3);
StringAssert.Contains("15 במאי 1948", he);
StringAssert.Contains("3", he);
- StringAssert.EndsWith("https://eyalgolan.itch.io/statecraft-israel", he);
+ StringAssert.Contains("https://eyalgolan.itch.io/statecraft-israel", he);
+ StringAssert.Contains("https://github.com/eyalgolan/statecraft-israel", he);
Assert.IsTrue(UiDirection.HasRightToLeft(he), "the Hebrew post is Hebrew");
}
+ /// <summary>X's limit is 280 by its own count (twitter-text v3): any URL is 23, a character in its light ranges (Latin,
+ /// Hebrew, most punctuation) is 1 and any other (the bidi marks Format puts round the URLs) is 2. The longest real post,
+ /// the last turn's longest date (rules.yaml ends the game on 15 January 1952), fits in both languages.</summary>
+ [Test]
+ public void TheLongestPostFitsInAPostOnX([Values(false, true)] bool hebrew)
+ {
+ var text = hebrew ? He : En;
+ var date = hebrew ? "30 בספטמבר 1951" : "30 September 1951";
+ var post = ShareShot.Text(text, date, 999);
+ StringAssert.Contains(date, post);
+ Assert.LessOrEqual(XLength(post), 280, post);
+ }
+
+ static int XLength(string post)
+ {
+ var parts = post.Split(new[] { ShareShot.Itch, ShareShot.Repo }, StringSplitOptions.None);
+ int n = 23 * (parts.Length - 1);
+ foreach (var c in string.Concat(parts)) n += c <= 4351 || (c >= 8192 && c <= 8205) || (c >= 8208 && c <= 8223) || (c >= 8242 && c <= 8247) ? 1 : 2;
+ return n;
+ }
+
+ /// <summary>Every share path carries both links where the site takes a text: the share sheet and Copy get the post (the
+ /// panel tests), X, WhatsApp and Telegram its text. Facebook and LinkedIn take only a URL, the itch page.</summary>
+ [Test]
+ public void TheTextLinksCarryTheItchPageAndTheRepository([Values(false, true)] bool hebrew)
+ {
+ var post = ShareShot.Text(hebrew ? He : En, "15 May 1948", 0);
+ foreach (var site in new[] { "x", "whatsapp", "telegram" })
+ {
+ var link = Uri.UnescapeDataString(ShareShot.IntentUrl(site, post));
+ StringAssert.Contains(ShareShot.Itch, link, site);
+ StringAssert.Contains(ShareShot.Repo, link, site);
+ }
+ var itch = Uri.EscapeDataString(ShareShot.Itch);
+ Assert.AreEqual("https://www.facebook.com/sharer/sharer.php?u=" + itch, ShareShot.IntentUrl("facebook", post));
+ Assert.AreEqual("https://www.linkedin.com/sharing/share-offsite/?url=" + itch, ShareShot.IntentUrl("linkedin", post));
+ }
+
[Test]
public void TheShareLinksCarryTheTextAndTheUrlEncoded()
{
@@ -123,6 +166,7 @@ public class ShareShotTests
Assert.AreEqual(canShareFiles ? text["share.native"] : text["share.download"], ui.Q<Button>("share-go").text);
SettingsScreenTests.PressWithPointer(ui.Q<Button>("share-go"));
CollectionAssert.AreEqual(new[] { post + " | " + ShareShot.Itch }, shared, "the press asks the browser once");
+ StringAssert.Contains(ShareShot.Repo, post, "the share sheet's text carries the repository too");
Assert.AreEqual(canShareFiles ? DisplayStyle.None : DisplayStyle.Flex, fallback.style.display.value,
"the attach note only where files cannot be shared");
var links = ShareShot.Sites.Where(s => s != "instagram").ToArray();
@@ -308,6 +352,8 @@ public class ShareShotTests
Assert.AreEqual(DisplayStyle.None, said.style.display.value, "nothing to say before the press");
SettingsScreenTests.PressWithPointer(copy);
CollectionAssert.AreEqual(new[] { ui.Q<Label>("share-post").text }, copies, "one copy, of the post, on the press");
+ StringAssert.Contains(ShareShot.Itch, copies[0], "the copied text links the itch page");
+ StringAssert.Contains(ShareShot.Repo, copies[0], "and the repository");
// The batch editor idles between frames unless asked for one, and the panel's scheduler runs on those frames.
var until = Time.realtimeSinceStartup + 0.6f;
while (Time.realtimeSinceStartup < until) { EditorApplication.QueuePlayerLoopUpdate(); yield return null; }
diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yaml
index 824318896..5eb8bfd0f 100644
--- a/unity/Assets/UI/strings.en.yaml
+++ b/unity/Assets/UI/strings.en.yaml
@@ -120,7 +120,7 @@ feedback.itch: "No GitHub account? Comment on itch"
# in-game date ({0}), the turn ({1}) and the itch URL ({2}).
share.open: "Share"
share.title: "Share a picture of the game"
-share.post: "I'm running Israel in 1948 in Statecraft: Israel, a free strategy game. {0}, turn {1}. Play: {2}"
+share.post: "I'm running Israel in 1948 in Statecraft: Israel, a free strategy game. {0}, turn {1}. Play: {2} · Code: {3}"
share.native: "Share"
share.download: "Download the picture"
share.attach: "These sites can't take a picture through a link: attach the downloaded picture to your post."
diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yaml
index 8130b065b..14c37cca5 100644
--- a/unity/Assets/UI/strings.he.yaml
+++ b/unity/Assets/UI/strings.he.yaml
@@ -125,10 +125,11 @@ feedback.itch: "אין חשבון בגיטהאב? תגובה בדף המשחק
# Statecraft: Israel, ...") instead of the English "I'm running", which in Hebrew would agree with the player's gender;
# it keeps the game's name and the URL in Latin letters, as README.he.md does. Approved by Beri, a native speaker,
# on #1182 (20 Oct 2026). share.post no longer says "בקוד פתוח" (open source) since the code licence changed (#1371,
-# 22 Oct 2026): agent-checked, for the native reviewer (#564).
+# 22 Oct 2026): agent-checked, for the native reviewer (#564). share.post's second link, "קוד המקור" (the source code,
+# the GitHub repository; owner, 24 Oct 2026): agent-checked, for the native reviewer (#564).
share.open: "שיתוף"
share.title: "שיתוף תמונה מהמשחק"
-share.post: "ניהול מדינת ישראל ב־1948 במשחק Statecraft: Israel, משחק אסטרטגיה חינמי. {0}, תור {1}. לשחק: {2}"
+share.post: "ניהול מדינת ישראל ב־1948 במשחק Statecraft: Israel, משחק אסטרטגיה חינמי. {0}, תור {1}. לשחק: {2} · קוד המקור: {3}"
share.native: "שיתוף"
share.download: "הורדת התמונה"
share.attach: "האתרים האלה לא מקבלים תמונה דרך קישור: יש לצרף לפוסט את התמונה שהורדה."