2025-01-09 18:07:02 +02:00
|
|
|
import { formatDateTime } from "../../utils/formatters.js";
|
2024-07-20 09:42:55 +03:00
|
|
|
import { t } from "../../services/i18n.js";
|
2022-06-12 14:03:59 +02:00
|
|
|
import BasicWidget from "../basic_widget.js";
|
2024-09-04 11:08:04 +00:00
|
|
|
import openService from "../../services/open.js";
|
2024-12-10 18:24:41 +02:00
|
|
|
import server from "../../services/server.js";
|
|
|
|
import utils from "../../services/utils.js";
|
2024-09-04 11:08:04 +00:00
|
|
|
|
2022-06-12 14:03:59 +02:00
|
|
|
const TPL = `
|
2024-09-02 19:37:02 +02:00
|
|
|
<div class="about-dialog modal fade mx-auto" tabindex="-1" role="dialog">
|
|
|
|
<div class="modal-dialog modal-lg" role="document">
|
2022-06-12 14:03:59 +02:00
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2024-09-03 18:15:10 +02:00
|
|
|
<h5 class="modal-title">${t("about.title")}</h5>
|
2025-01-09 18:07:02 +02:00
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="${t("about.close")}"></button>
|
2022-06-12 14:03:59 +02:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
2025-01-04 18:35:56 +02:00
|
|
|
<table class="table table-borderless">
|
2022-06-12 14:03:59 +02:00
|
|
|
<tr>
|
2024-07-20 09:42:55 +03:00
|
|
|
<th>${t("about.homepage")}</th>
|
2025-01-23 01:12:05 +02:00
|
|
|
<td><a class="tn-link" href="https://github.com/TriliumNext/Notes" class="external">https://github.com/TriliumNext/Notes</a></td>
|
2022-06-12 14:03:59 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2024-07-20 09:42:55 +03:00
|
|
|
<th>${t("about.app_version")}</th>
|
2022-06-12 14:03:59 +02:00
|
|
|
<td class="app-version"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2024-07-20 09:42:55 +03:00
|
|
|
<th>${t("about.db_version")}</th>
|
2022-06-12 14:03:59 +02:00
|
|
|
<td class="db-version"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2024-07-20 09:42:55 +03:00
|
|
|
<th>${t("about.sync_version")}</th>
|
2022-06-12 14:03:59 +02:00
|
|
|
<td class="sync-version"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2024-07-20 09:42:55 +03:00
|
|
|
<th>${t("about.build_date")}</th>
|
2022-06-12 14:03:59 +02:00
|
|
|
<td class="build-date"></td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
2024-07-20 09:51:09 +03:00
|
|
|
<th>${t("about.build_revision")}</th>
|
2025-01-23 01:12:05 +02:00
|
|
|
<td><a class="tn-link" href="" class="build-revision external" target="_blank"></a></td>
|
2022-06-12 14:03:59 +02:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
2024-07-20 09:42:55 +03:00
|
|
|
<th>${t("about.data_directory")}</th>
|
2022-06-12 14:03:59 +02:00
|
|
|
<td class="data-directory"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-01-04 18:35:56 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.about-dialog a {
|
|
|
|
word-break: break-all;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
`;
|
2022-06-12 14:03:59 +02:00
|
|
|
|
|
|
|
export default class AboutDialog extends BasicWidget {
|
|
|
|
doRender() {
|
|
|
|
this.$widget = $(TPL);
|
|
|
|
this.$appVersion = this.$widget.find(".app-version");
|
|
|
|
this.$dbVersion = this.$widget.find(".db-version");
|
|
|
|
this.$syncVersion = this.$widget.find(".sync-version");
|
|
|
|
this.$buildDate = this.$widget.find(".build-date");
|
|
|
|
this.$buildRevision = this.$widget.find(".build-revision");
|
|
|
|
this.$dataDirectory = this.$widget.find(".data-directory");
|
|
|
|
}
|
|
|
|
|
|
|
|
async refresh() {
|
2025-01-09 18:07:02 +02:00
|
|
|
const appInfo = await server.get("app-info");
|
2022-06-12 14:03:59 +02:00
|
|
|
|
|
|
|
this.$appVersion.text(appInfo.appVersion);
|
|
|
|
this.$dbVersion.text(appInfo.dbVersion);
|
|
|
|
this.$syncVersion.text(appInfo.syncVersion);
|
2024-12-10 18:40:24 +02:00
|
|
|
this.$buildDate.text(formatDateTime(appInfo.buildDate));
|
2022-06-12 14:03:59 +02:00
|
|
|
this.$buildRevision.text(appInfo.buildRevision);
|
2025-01-09 18:07:02 +02:00
|
|
|
this.$buildRevision.attr("href", `https://github.com/TriliumNext/Notes/commit/${appInfo.buildRevision}`);
|
2024-09-03 10:06:01 +00:00
|
|
|
if (utils.isElectron()) {
|
2025-01-09 18:07:02 +02:00
|
|
|
this.$dataDirectory.html(
|
|
|
|
$("<a></a>", {
|
|
|
|
href: "#",
|
2025-01-23 01:12:05 +02:00
|
|
|
class: "tn-link",
|
2025-01-09 18:07:02 +02:00
|
|
|
text: appInfo.dataDirectory
|
|
|
|
})
|
|
|
|
);
|
|
|
|
this.$dataDirectory.find("a").on("click", (event) => {
|
2024-09-04 11:52:05 +00:00
|
|
|
event.preventDefault();
|
2024-09-04 12:10:13 +00:00
|
|
|
openService.openDirectory(appInfo.dataDirectory);
|
2025-01-09 18:07:02 +02:00
|
|
|
});
|
2024-09-03 10:06:01 +00:00
|
|
|
} else {
|
|
|
|
this.$dataDirectory.text(appInfo.dataDirectory);
|
|
|
|
}
|
2022-06-12 14:03:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
async openAboutDialogEvent() {
|
|
|
|
await this.refresh();
|
|
|
|
|
|
|
|
utils.openDialog(this.$widget);
|
|
|
|
}
|
|
|
|
}
|