Skip to content

API Token ترتیب کا انتظام

API Token configuration management خودکار اسکرپٹس، operations tools، یا فریق ثالث control panels کے لیے ہے۔ یہ ایڈمن صفحہ کھولے بغیر upload channel configuration، security settings، page settings، other settings، اور lightweight federation relations پڑھ اور update کر سکتا ہے۔

Management permission صرف ایسی lightweight operations ظاہر کرتی ہے جو scripts کے لیے مناسب ہوں۔ Heavy operations جن کے لیے براؤزر confirmation، فرنٹ اینڈ batch jobs، یا federation index cleanup درکار ہو، اب بھی براؤزر ایڈمن پینل میں سنبھالنی ہوں گی۔

API Token میں ترمیم

شروع کرنے سے پہلے

ایڈمن پینل کھولیں، پھر یہاں جائیں:

text
System Settings -> Security Settings -> API Token

API Token بناتے یا ترمیم کرتے وقت یقینی بنائیں کہ اس کے پاس management permission ہے۔ Management permission سائٹ configuration تبدیل کر سکتی ہے، اس لیے اسے صرف trusted scripts یا trusted users کو دیں۔

تینوں management scripts write operations کے لیے default طور پر dry-run mode استعمال کرتے ہیں۔ preview دیکھنے کے بعد تبدیلیاں واقعی save کرنے کے لیے --apply شامل کریں۔

آپ token کو environment variable میں بھی رکھ سکتے ہیں:

powershell
$env:IMGHOST_API_TOKEN="your API Token"

انتظامی اسکرپٹس ڈاؤن لوڈ کریں

دستاویزاتی package تین Node.js scripts فراہم کرتا ہے:

اسکرپٹمقصد
اپ لوڈ ترتیبات مینجمنٹ اسکرپٹاپ لوڈ چینلز، child channels، اور load balancing manage کریں۔
سائٹ ترتیبات مینجمنٹ اسکرپٹsecurity settings، page settings، اور other settings manage کریں۔
فیڈریشن تعلقات مینجمنٹ اسکرپٹlightweight federation relation actions، requests، اور messages manage کریں۔

Node.js 18 یا بعد کا ورژن درکار ہے۔

مشترک پیرامیٹرز

پیرامیٹرضروریوضاحت
--base-url <url>ہاںImgHost سائٹ URL، مثلاً https://image.ai6.me۔
--token <token>ہاںAPI Token۔ آپ IMGHOST_API_TOKEN environment variable بھی استعمال کر سکتے ہیں۔
--retries <n>نہیںعارضی ناکامی پر دوبارہ کوششوں کی تعداد۔ طے شدہ قدر 3۔
--timeout-ms <n>نہیںrequest timeout۔ طے شدہ قدر 180000۔
--output <pretty|json>نہیںoutput format۔ طے شدہ قدر pretty؛ programs کے لیے json استعمال کریں۔
--save-response <path>نہیںحتمی JSON result فائل میں محفوظ کریں۔
--applyنہیںwrites واقعی perform کریں۔ اس کے بغیر write operations صرف preview دکھاتی ہیں۔
-h / --helpنہیںscript help دکھائیں۔

اپ لوڈ ترتیبات

upload settings script upload child channels کو list، read، create، edit، اور delete کرتا ہے۔ یہ ایک top-level upload channel کے لیے load balancing بھی toggle کر سکتا ہے۔

powershell
node imghost-token-upload-settings.mjs --base-url "https://your-domain" --token "your API Token" --list

اپ لوڈ ترتیبات کے پیرامیٹرز

پیرامیٹروضاحت
--listupload setting groups list کریں۔
--gettop-level channel یا اس کے نیچے ایک child channel پڑھیں۔
--upsertایک child channel create یا edit کریں۔ --apply نہ ہو تو dry-run۔
--deleteایک child channel delete کریں۔ --apply نہ ہو تو dry-run۔
--load-balance <true|false>top-level channel کے لیے load balancing فعال یا غیر فعال کریں۔
--channel <key>top-level upload channel، جیسے s3، github، یا telegram۔
--channel-name <name>child channel یا account name۔
--set key=valueایک field set کریں۔ repeatable ہے۔ dot paths supported ہیں۔
--patch-json <path>JSON file سے fields merge کریں۔
--applywrite result save کریں۔

چینل keys

چینل keyچینل
telegram / tgTelegram
discord / dcDiscord
cfr2 / r2Cloudflare R2
s3S3
webdav / wdWebDAV storage channel
github / ghGitHub Releases
gitlab / glGitLab Packages
huggingface / hfHugging Face
onedrive / odOneDrive
googledrive / google / gdGoogle Drive
dropbox / dbDropbox
yandex / yxYandex Disk
pcloud / pdpCloud

اپ لوڈ ترتیبات کی مثالیں

تمام upload settings list کریں:

powershell
node imghost-token-upload-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --list

S3 channel configuration پڑھیں:

powershell
node imghost-token-upload-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --get `
  --channel s3

ایک S3 child channel پڑھیں:

powershell
node imghost-token-upload-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --get `
  --channel s3 `
  --channel-name "backup-s3"

ایک child channel create یا edit کریں۔ preview کے لیے پہلے اسے --apply کے بغیر چلائیں:

powershell
node imghost-token-upload-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --upsert `
  --channel webdav `
  --channel-name "backup-webdav" `
  --set enabled=false `
  --set remark="backup test"

تصدیق کے بعد save کریں:

powershell
node imghost-token-upload-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --upsert `
  --channel webdav `
  --channel-name "backup-webdav" `
  --set enabled=false `
  --set remark="backup test" `
  --apply

ایک child channel delete کریں:

powershell
node imghost-token-upload-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --delete `
  --channel webdav `
  --channel-name "backup-webdav" `
  --apply

S3 load balancing فعال کریں:

powershell
node imghost-token-upload-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --load-balance true `
  --channel s3 `
  --apply

complex fields کے لیے JSON file لکھیں اور --patch-json کے ساتھ pass کریں:

json
{
  "enabled": true,
  "remark": "primary account"
}
powershell
node imghost-token-upload-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --upsert `
  --channel s3 `
  --channel-name "primary-s3" `
  --patch-json ".\s3-channel.json" `
  --apply

سائٹ ترتیبات

site settings script تین configuration areas manage کرتا ہے:

areaپیرامیٹروضاحت
security settingssecurityuser authentication، admin authentication، login devices، API Token، image moderation، user rate limits، WebDAV، وغیرہ۔
page settingspageglobal page، user-side page، admin page، اور متعلقہ display settings۔
other settingsothersبے ترتیب تصویر API، public browsing، local federation node، auto tagging، IP geolocation، backup channel، OCR، وغیرہ۔

editable areas، sections، اور fields دیکھنے کے لیے پہلے --list-sections استعمال کریں:

powershell
node imghost-token-site-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --list-sections

سائٹ ترتیبات کے پیرامیٹرز

پیرامیٹروضاحت
--list-sectionseditable areas، sections، اور fields list کریں۔
--getایک settings section پڑھیں۔
--area <security|page|others>configuration area منتخب کریں۔
--section <name>section منتخب کریں۔ --list-sections میں دکھائے گئے names استعمال کریں۔
--set key=valueایک field set کریں۔ repeatable ہے۔
--applywrite result save کریں۔

page area کے لیے، --set page config item IDs استعمال کرتا ہے، مثلاً starsEffect=true۔ security اور others کے لیے، --set اس section کا field name استعمال کرتا ہے، مثلاً email=admin@example.com۔

سائٹ ترتیبات کی مثالیں

system update notification settings پڑھیں:

powershell
node imghost-token-site-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --get `
  --area security `
  --section systemUpdate

system update notification email تبدیل کریں۔ preview کے لیے پہلے --apply کے بغیر چلائیں:

powershell
node imghost-token-site-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --area security `
  --section systemUpdate `
  --set email="admin@example.com"

تصدیق کے بعد save کریں:

powershell
node imghost-token-site-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --area security `
  --section systemUpdate `
  --set email="admin@example.com" `
  --apply

admin page star effect تبدیل کریں:

powershell
node imghost-token-site-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --area page `
  --section adminSettings `
  --set starsEffect=true `
  --apply

IP geolocation language تبدیل کریں:

powershell
node imghost-token-site-settings.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --area others `
  --section ipGeolocation `
  --set language="en" `
  --apply

Local federation node settings normal fields جیسے فعال حالت، sync directory، اور invite code پڑھ اور update کر سکتی ہیں۔ Domain confirmation API Token کے ذریعے handle نہیں ہوتی۔ اگر ایڈمن پینل report کرے کہ local node domain موجودہ access domain سے مختلف ہے، تو براؤزر ایڈمن پینل میں confirmation complete کریں۔

فیڈریشن تعلقات

federation script local node status، outgoing nodes، incoming nodes، messages، join requests، no-record reapply actions، approvals، denials، اور lightweight relation actions manage کرتا ہے جنہیں index cleanup کی ضرورت نہیں ہوتی۔

Index update، federation index deletion، اور domain-change confirmation مکمل براؤزر workflow پر depend کرتے ہیں۔ script یہ heavy operations handle نہیں کرتا۔

ہلکی اور بھاری فیڈریشن کارروائیاں

actionscript supportوضاحت
local node status دیکھنا اور relations list کرناSupportedصرف relation records پڑھتا ہے۔
messages پڑھنا اور messages بھیجناSupportedrelation messages پڑھتا یا لکھتا ہے۔
کسی دوسرے node میں join request دیناSupportedinvite link سے request submit کرتا ہے۔
no-record relation کے لیے reapply کرناSupportedصرف lastResult=none والے outgoing cards کے لیے؛ 6-character invite code درکار ہے۔
outgoing pending request cancel کرناSupportedصرف pending request cancel کرتا ہے۔
incoming request accept یا deny کرناSupportedآپ کے node میں شامل ہونے والے nodes کی requests handle کرتا ہے۔
accepted incoming relation remove کرناSupportedincoming relation record update کرتا ہے اور peer کو notify کرتا ہے۔
incoming terminal record delete کرناSupportedصرف incoming terminal relation record delete کرتا ہے۔
accepted outgoing subscription cancel کرناصرف براؤزرlocal federation index deletion درکار ہے، جسے براؤزر batches میں چلاتا ہے۔
outgoing terminal record delete کرناصرف براؤزرپہلے federation index cleanup درکار ہو سکتا ہے۔
domain change confirm یا cancel کرناصرف براؤزرcurrent-domain confirmation اور domain-change index handling درکار ہے۔
indexes publish، pull، یا batch-delete کرناصرف براؤزریہ فرنٹ اینڈ batch tasks ہیں۔

فیڈریشن پیرامیٹرز

پیرامیٹروضاحت
--statuslocal federation node status، outgoing nodes، اور incoming nodes دیکھیں۔
--listfederation relations list کریں۔
--chatایک relation کے کیش شدہ messages پڑھیں۔
--send-messageایک established relation کو message بھیجیں۔
--joininvite link کے ذریعے کسی دوسرے node میں join request دیں۔
--reapplyno-record relation کے لیے reapply کریں۔ 6-character invite code درکار ہے۔
--acceptincoming request accept کریں۔
--denyincoming request deny کریں۔
--canceloutgoing pending request cancel کریں، یا accepted incoming relation remove کریں۔
--deleteincoming terminal relation record delete کریں۔
--direction <outgoing|incoming|all>relation direction۔ outgoing سے مراد وہ nodes ہیں جن میں آپ joined ہیں؛ incoming سے مراد آپ کے node میں joined nodes ہیں۔
--domain <url>relation node domain۔
--invite-link <url>peer node کا invite link۔
--invite-code <code>reapply کے لیے استعمال ہونے والا 6-character invite code۔
--text <message>message text۔
--applywrite result save کریں۔

فیڈریشن مثالیں

local node status اور دونوں relation lists دیکھیں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --status

صرف outgoing nodes list کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --list `
  --direction outgoing

صرف incoming nodes list کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --list `
  --direction incoming

کسی دوسرے node میں join request دیں۔ preview کے لیے پہلے --apply کے بغیر چلائیں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --join `
  --invite-link "https://peer-domain/federation/invite/abcdef"

تصدیق کے بعد save کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --join `
  --invite-link "https://peer-domain/federation/invite/abcdef" `
  --apply

no-record relation کے لیے reapply کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --reapply `
  --domain "https://peer-domain" `
  --invite-code "abc123" `
  --apply

incoming request accept کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --accept `
  --domain "https://peer-domain" `
  --apply

incoming request deny کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --deny `
  --domain "https://peer-domain" `
  --apply

established relation کو message بھیجیں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --send-message `
  --direction outgoing `
  --domain "https://peer-domain" `
  --text "Hello, this is a test message." `
  --apply

outgoing pending request cancel کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --cancel `
  --direction outgoing `
  --domain "https://peer-domain" `
  --apply

accepted incoming relation remove کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --cancel `
  --direction incoming `
  --domain "https://peer-domain" `
  --apply

incoming terminal record delete کریں:

powershell
node imghost-token-federation.mjs `
  --base-url "https://your-domain" `
  --token "your API Token" `
  --delete `
  --direction incoming `
  --domain "https://peer-domain" `
  --apply

accepted outgoing subscription cancellation اور outgoing record deletion براؤزر ایڈمن پینل میں handle ہونی چاہیے، کیونکہ ان actions کو پہلے local federation index cleanup کی ضرورت ہو سکتی ہے۔

ڈومین عدم مطابقت

اگر relation میں local node domain اور pending domain match نہ کریں تو script currentDomain اور pendingDomain کے ساتھ error report کرتا ہے۔ اسے براؤزر ایڈمن پینل میں handle کریں کیونکہ domain changes میں outgoing index cleanup اور confirmation بھی شامل ہوتے ہیں۔

اگر join request FEDERATION_NODE_DOMAIN_MISMATCH واپس کرے تو invite link میں استعمال ہونے والا domain peer node کے saved local domain سے match نہیں کرتا۔ response میں currentOrigin اور detectedOrigin شامل ہوتے ہیں۔ peer کا current confirmed domain استعمال کریں، یا peer سے کہیں کہ پہلے اپنے براؤزر ایڈمن پینل میں domain confirm کرے۔

عمومی سوالات

میری تبدیلی مؤثر کیوں نہیں ہوئی؟

write commands default طور پر preview mode میں چلتی ہیں۔ preview دیکھنے کے بعد تبدیلی واقعی save کرنے کے لیے --apply شامل کریں۔

مجھے کیسے معلوم ہو کہ کون سے فیلڈز تبدیل کیے جا سکتے ہیں؟

upload settings کے لیے موجودہ child channel structure دیکھنے کے لیے --get استعمال کریں۔ security settings، page settings، اور other settings کے لیے editable areas، sections، اور fields دیکھنے کے لیے --list-sections استعمال کریں۔

میں نتیجہ کسی دوسرے پروگرام میں استعمال کرنا چاہتا ہوں

--output json استعمال کریں، یا --save-response result.json شامل کریں۔ آپ کا program saved JSON file براہ راست پڑھ سکتا ہے۔

Released as user documentation for ImgHost.