gitlatex 1.0.9__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitlatex
3
- Version: 1.0.9
3
+ Version: 1.2.0
4
4
  Summary: A simple UI for LaTeX projects with Git support. Clone repos, edit, compile, and push.
5
5
  License-Expression: ISC
6
6
  Project-URL: Homepage, https://github.com/abdussamiakanda/gitlatex
@@ -1,2 +1,2 @@
1
1
  """GitLaTeX IDE - LaTeX projects with Git support."""
2
- __version__ = "1.0.9"
2
+ __version__ = "1.2.0"
@@ -183,6 +183,66 @@ function setInfoLink(el, url, label) {
183
183
  }
184
184
  }
185
185
 
186
+ // ----- Update check (PyPI) -----
187
+ let updateInfo = null;
188
+
189
+ /** Ask the server whether a newer gitlatex is on PyPI. Never throws. */
190
+ async function checkForUpdate(force) {
191
+ try {
192
+ const res = await fetchApi("/api/update-check" + (force ? "?force=1" : ""));
193
+ const data = await res.json();
194
+ updateInfo = data && typeof data === "object" ? data : null;
195
+ } catch (_) {
196
+ updateInfo = null;
197
+ }
198
+ renderUpdateState();
199
+ return updateInfo;
200
+ }
201
+
202
+ /** Dot on every Settings gear, plus the notice inside Settings itself. */
203
+ function renderUpdateState() {
204
+ const available = !!(updateInfo && updateInfo.updateAvailable && updateInfo.latest);
205
+ document.querySelectorAll('.icon-btn[href="#/settings"]').forEach(function (el) {
206
+ el.classList.toggle("has-update", available);
207
+ if (available) el.title = "Settings — version " + updateInfo.latest + " available";
208
+ else el.title = "Settings";
209
+ });
210
+
211
+ const notice = document.getElementById("update-notice");
212
+ if (notice) {
213
+ notice.classList.toggle("hidden", !available);
214
+ if (available) {
215
+ const latestEl = document.getElementById("update-notice-latest");
216
+ const currentEl = document.getElementById("update-notice-current");
217
+ const linkEl = document.getElementById("update-notice-link");
218
+ if (latestEl) latestEl.textContent = updateInfo.latest;
219
+ if (currentEl) currentEl.textContent = updateInfo.current || "—";
220
+ if (linkEl && updateInfo.pypi) linkEl.href = updateInfo.pypi;
221
+ }
222
+ }
223
+
224
+ const versionEl = document.getElementById("settings-info-version");
225
+ if (versionEl) {
226
+ const pill = versionEl.querySelector(".version-pill");
227
+ if (pill) pill.remove();
228
+ if (available) {
229
+ const el = document.createElement("span");
230
+ el.className = "version-pill";
231
+ el.textContent = "update available";
232
+ versionEl.appendChild(el);
233
+ }
234
+ }
235
+
236
+ const status = document.getElementById("update-status");
237
+ if (status) {
238
+ if (available || !updateInfo) status.textContent = "";
239
+ else if (updateInfo.disabled) status.textContent = "Update checks are disabled.";
240
+ else if (updateInfo.error) status.textContent = "Could not reach PyPI to check for updates.";
241
+ else if (updateInfo.latest) status.textContent = "You are on the latest version.";
242
+ else status.textContent = "";
243
+ }
244
+ }
245
+
186
246
  async function populateSettingsTechInfo() {
187
247
  const versionEl = document.getElementById("settings-info-version");
188
248
  const urlEl = document.getElementById("settings-info-url");
@@ -200,6 +260,9 @@ async function populateSettingsTechInfo() {
200
260
  if (repoEl) repoEl.textContent = "—";
201
261
  if (pypiEl) pypiEl.textContent = "—";
202
262
  }
263
+ // Re-apply first (setting version wipes the pill), then refresh from PyPI.
264
+ renderUpdateState();
265
+ checkForUpdate();
203
266
  }
204
267
 
205
268
  function setConsole(text) {
@@ -332,6 +395,7 @@ function getRoute() {
332
395
  const parts = hash.split("/").filter(Boolean);
333
396
  if (parts[0] === "editor" && parts[1]) return { page: "editor", repo: parts[1] };
334
397
  if (parts[0] === "settings") return { page: "settings" };
398
+ if (parts[0] === "compiler-api") return { page: "compiler-api" };
335
399
  return { page: "home" };
336
400
  }
337
401
 
@@ -354,6 +418,12 @@ function route() {
354
418
  populateSettings();
355
419
  return;
356
420
  }
421
+ if (r.page === "compiler-api") {
422
+ showView("compiler-api-view");
423
+ const content = document.querySelector("#compiler-api-view .settings-content");
424
+ if (content) content.scrollTop = 0;
425
+ return;
426
+ }
357
427
  showView("editor-view");
358
428
  document.getElementById("editor-repo-name").textContent = decodeURIComponent(r.repo);
359
429
  openEditorPage(r.repo);
@@ -1889,6 +1959,25 @@ document.addEventListener("click", function (e) {
1889
1959
  }
1890
1960
  });
1891
1961
 
1962
+ // Copy buttons on the Compiler API docs code samples
1963
+ document.addEventListener("click", function (e) {
1964
+ const btn = e.target.closest(".docs-copy");
1965
+ if (!btn) return;
1966
+ const code = btn.parentElement && btn.parentElement.querySelector("code");
1967
+ if (!code || !navigator.clipboard) return;
1968
+ navigator.clipboard.writeText(code.textContent).then(function () {
1969
+ btn.textContent = "Copied";
1970
+ btn.classList.add("copied");
1971
+ setTimeout(function () {
1972
+ btn.textContent = "Copy";
1973
+ btn.classList.remove("copied");
1974
+ }, 1500);
1975
+ }).catch(function () {
1976
+ btn.textContent = "Press Ctrl+C";
1977
+ setTimeout(function () { btn.textContent = "Copy"; }, 1500);
1978
+ });
1979
+ });
1980
+
1892
1981
  document.getElementById("settings-save")?.addEventListener("click", function () {
1893
1982
  const apiInput = document.getElementById("settings-compiler-api");
1894
1983
  const keyInput = document.getElementById("settings-compiler-api-key");
@@ -1988,4 +2077,5 @@ window.addEventListener("hashchange", route);
1988
2077
  window.addEventListener("load", function () {
1989
2078
  route();
1990
2079
  setupResizers();
2080
+ checkForUpdate();
1991
2081
  });