profile.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. {% extends "layout.html" %}
  2. {% block content %}
  3. <div class="max-w-4xl mx-auto p-4 md:p-8">
  4. <h2 class="text-3xl font-black text-white tracking-tighter italic mb-8 uppercase flex items-center gap-3">
  5. <svg class="w-8 h-8 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
  6. User Profile & API
  7. </h2>
  8. <div class="bg-[#12161f] border border-gray-800 rounded-3xl p-6 md:p-8 shadow-2xl">
  9. <div class="flex items-center gap-6 mb-8 border-b border-gray-800 pb-6">
  10. <div class="w-16 h-16 bg-blue-600 rounded-2xl flex items-center justify-center text-2xl font-black text-white shadow-lg">
  11. {{ session['username'][0].upper() }}
  12. </div>
  13. <div>
  14. <h3 class="text-xl font-bold text-white">{{ session['username'] }}</h3>
  15. <p class="text-gray-500 text-xs font-bold uppercase tracking-widest">{{ session['role'] }} Account</p>
  16. </div>
  17. </div>
  18. <div class="mb-8 p-5 bg-blue-900/10 border border-blue-500/20 rounded-2xl">
  19. <h4 class="text-[10px] font-black text-blue-400 uppercase tracking-widest mb-3">Your Assigned Templates</h4>
  20. <div class="flex gap-2 flex-wrap">
  21. {% if user_data.assigned_templates %}
  22. {% for t in user_data.assigned_templates %}
  23. <span class="bg-blue-600/20 text-blue-400 px-3 py-1.5 rounded-lg text-[10px] font-mono border border-blue-500/30">{{ t }}</span>
  24. {% endfor %}
  25. {% else %}
  26. <span class="text-gray-500 text-[10px] uppercase font-bold tracking-widest">No templates assigned.</span>
  27. {% endif %}
  28. </div>
  29. </div>
  30. <div class="space-y-6">
  31. <h4 class="text-[10px] font-black text-gray-400 uppercase tracking-widest">Personal API Access Token</h4>
  32. <p class="text-gray-500 text-xs">Use this token to authenticate your API requests. Keep it secret!</p>
  33. {% if user_data.api_token %}
  34. <div class="flex flex-col lg:flex-row gap-4 items-stretch">
  35. <code class="flex-1 bg-[#0b0e14] px-6 py-4 rounded-xl border border-gray-800 text-green-400 font-mono text-sm break-all shadow-inner">
  36. {{ user_data.api_token }}
  37. </code>
  38. <form action="/settings/generate_token" method="POST" class="flex" onsubmit="return confirm('Regenerating will break existing API integrations. Continue?');">
  39. <button type="submit" class="w-full lg:w-auto bg-red-900/20 text-red-400 hover:bg-red-600 hover:text-white px-8 py-4 rounded-xl text-[10px] font-black uppercase tracking-widest border border-red-500/30 transition shadow-lg">
  40. Regenerate
  41. </button>
  42. </form>
  43. </div>
  44. {% else %}
  45. <form action="/settings/generate_token" method="POST">
  46. <button type="submit" class="bg-blue-600 hover:bg-blue-500 text-white px-8 py-4 rounded-xl text-xs font-black uppercase tracking-widest shadow-xl transition">
  47. Generate My First API Token
  48. </button>
  49. </form>
  50. {% endif %}
  51. </div>
  52. <div class="mt-12 pt-8 border-t border-gray-800">
  53. <h4 class="text-[10px] font-black text-gray-400 uppercase tracking-widest mb-6 flex items-center gap-2">
  54. <svg class="w-4 h-4 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg>
  55. API Examples (Documentation)
  56. </h4>
  57. <div class="space-y-6">
  58. <div class="space-y-2">
  59. <p class="text-[11px] font-bold text-gray-300 uppercase">1. Get Available Profiles (Templates)</p>
  60. <div class="bg-[#0b0e14] p-5 rounded-2xl font-mono text-[11px] text-gray-400 border border-gray-800 overflow-x-auto shadow-inner">
  61. <span class="text-green-500">curl</span> -X GET {{ request.host_url }}api/v1/user/templates \<br>
  62. &nbsp;&nbsp;-H <span class="text-yellow-500">"Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}"</span>
  63. <div class="mt-4 pt-4 border-t border-gray-800/50 text-gray-500">
  64. <span class="text-gray-600">// Expected Response:</span><br>
  65. {<br>
  66. &nbsp;&nbsp;<span class="text-blue-400">"status"</span>: "success",<br>
  67. &nbsp;&nbsp;<span class="text-blue-400">"templates"</span>: ["Basic_Profile", "Advanced_Hosting"]<br>
  68. }
  69. </div>
  70. </div>
  71. </div>
  72. <div class="space-y-2">
  73. <p class="text-[11px] font-bold text-gray-300 uppercase">2. Check if Zone Exists</p>
  74. <div class="bg-[#0b0e14] p-5 rounded-2xl font-mono text-[11px] text-gray-400 border border-gray-800 overflow-x-auto shadow-inner">
  75. <span class="text-green-500">curl</span> -X GET {{ request.host_url }}api/v1/user/zone/check/example.com \<br>
  76. &nbsp;&nbsp;-H <span class="text-yellow-500">"Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}"</span>
  77. </div>
  78. </div>
  79. <div class="space-y-2">
  80. <p class="text-[11px] font-bold text-gray-300 uppercase">3. Create New Master Zone</p>
  81. <div class="bg-[#0b0e14] p-5 rounded-2xl font-mono text-[11px] text-gray-400 border border-gray-800 overflow-x-auto shadow-inner">
  82. <span class="text-green-500">curl</span> -X POST {{ request.host_url }}api/v1/user/zone/create \<br>
  83. &nbsp;&nbsp;-H <span class="text-yellow-500">"Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}"</span> \<br>
  84. &nbsp;&nbsp;-H "Content-Type: application/json" \<br>
  85. &nbsp;&nbsp;-d '{<br>
  86. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"domain"</span>: "example.com", <br>
  87. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"template_name"</span>: "YOUR_TEMPLATE_NAME", <span class="text-gray-600">// REQUIRED</span><br>
  88. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"sync"</span>: true <br>
  89. &nbsp;&nbsp;}'
  90. </div>
  91. </div>
  92. <div class="space-y-2">
  93. <p class="text-[11px] font-bold text-gray-300 uppercase">4. Add Record (Forward: A, CNAME, TXT etc)</p>
  94. <div class="bg-[#0b0e14] p-5 rounded-2xl font-mono text-[11px] text-gray-400 border border-gray-800 overflow-x-auto shadow-inner">
  95. <span class="text-green-500">curl</span> -X POST {{ request.host_url }}api/v1/user/record/add \<br>
  96. &nbsp;&nbsp;-H <span class="text-yellow-500">"Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}"</span> \<br>
  97. &nbsp;&nbsp;-H "Content-Type: application/json" \<br>
  98. &nbsp;&nbsp;-d '{<br>
  99. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"domain"</span>: "example.com", <br>
  100. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"name"</span>: "web", <br>
  101. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"type"</span>: "A", <br>
  102. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"value"</span>: "1.2.3.4", <br>
  103. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"sync"</span>: true <br>
  104. &nbsp;&nbsp;}'
  105. </div>
  106. </div>
  107. <div class="space-y-2">
  108. <p class="text-[11px] font-bold text-gray-300 uppercase">5. Add Reverse Record (PTR)</p>
  109. <div class="bg-[#0b0e14] p-5 rounded-2xl font-mono text-[11px] text-gray-400 border border-gray-800 overflow-x-auto shadow-inner">
  110. <span class="text-green-500">curl</span> -X POST {{ request.host_url }}api/v1/user/record/add \<br>
  111. &nbsp;&nbsp;-H <span class="text-yellow-500">"Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}"</span> \<br>
  112. &nbsp;&nbsp;-H "Content-Type: application/json" \<br>
  113. &nbsp;&nbsp;-d '{<br>
  114. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"domain"</span>: "1.168.192.in-addr.arpa", <br>
  115. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"name"</span>: "10", <br>
  116. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"type"</span>: "PTR", <br>
  117. &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-blue-400">"value"</span>: "nas.example.com" <br>
  118. &nbsp;&nbsp;}'
  119. </div>
  120. </div>
  121. <div class="space-y-2">
  122. <p class="text-[11px] font-bold text-gray-300 uppercase">6. Manual Cluster Sync</p>
  123. <div class="bg-[#0b0e14] p-5 rounded-2xl font-mono text-[11px] text-gray-400 border border-gray-800 overflow-x-auto shadow-inner">
  124. <span class="text-green-500">curl</span> -X POST {{ request.host_url }}api/v1/user/sync \<br>
  125. &nbsp;&nbsp;-H <span class="text-yellow-500">"Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}"</span> \<br>
  126. &nbsp;&nbsp;-H "Content-Type: application/json" \<br>
  127. &nbsp;&nbsp;-d '{<span class="text-blue-400">"domain"</span>: "example.com"}'
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. {% endblock %}