From 6150e23e1142b0ea15201dfe7ba57fa9669ae2ff Mon Sep 17 00:00:00 2001
From: Neil McKillop <neil@mckillop.org>
Date: Tue, 27 Jun 2023 14:38:46 +0100
Subject: [PATCH] Build API URL from domain

---
 config.example.php | 4 ++--
 lemmy-api.php      | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/config.example.php b/config.example.php
index c5c8b53..72cd938 100644
--- a/config.example.php
+++ b/config.example.php
@@ -1,6 +1,6 @@
 <?php
-$lemmy_api_url = ""; // e.g. https://<lemmy_domain>/api/v3/";
+$lemmy_domain = ""; // e.g. lemmy.ml
 $username = "";
 $password = "";
-$token_file = ".lemmy-api-token";
+$token_file = ".lemmy-api-token"; // this is where your token is cached, can be any location
 ?>
diff --git a/lemmy-api.php b/lemmy-api.php
index 65ad258..669d00f 100755
--- a/lemmy-api.php
+++ b/lemmy-api.php
@@ -1,6 +1,7 @@
 #!/usr/bin/php
 <?php
 require("config.php");
+$lemmy_api_url = "https://".$lemmy_domain."/api/v3/";
 
 $implemented_commands = array(
 	"purgePerson"	=> "PERSONID [reason]",
-- 
2.25.1