Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ see the notices in the README.
## [Unreleased]
### Added

- **Desktop: "Support us on Ko-fi" tag** (#403). Once per start of the app the
status bar shows a small tag; a click opens the Ko-fi page of the
association that develops TeamCraft (`https://ko-fi.com/warr_ev`, fixed in
the app) in the browser and hides it, *×* only hides it. Reconnecting,
switching server or reloading the window does not show it again (held in
memory only). Nothing is loaded from ko-fi.com and nothing is sent or
counted before the click. *Settings → Support TeamCraft* switches it off
(`donate_tag` in the settings file); the new desktop policy `ShowDonateTag`
turns it off (`0`) or keeps it on (`1`) – in the ADMX with English and
German ADML, the macOS profile and the Linux `policies.json`. Texts in
English and German.

- **3D preview of E57 point clouds** (#373). Laser-scanner exports (`.e57`,
ASTM E2807) open in the viewer like LAS: every scan is placed by its pose
(rotation and translation), so multi-station scans line up; cartesian or
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ there is no separate enterprise edition.
- **Desktop rollout** – policies per computer or user with the operating
system's tools (Group Policy/Intune ADMX templates, a macOS configuration
profile, `/etc/teamcraft/policies.json`): a fixed server, update checks,
crash-report prompts, the default working folder and *Managed by …*; see
crash-report prompts, the default working folder, the *Support us on Ko-fi* tag and *Managed by …*; see
[Deploying the desktop app](https://warr-ev.github.io/TeamCraft/admin/desktop-deployment.html).

**Planned** – what is left of the issues above (all their steps are built):
Expand Down
3 changes: 2 additions & 1 deletion deploy/desktop-policies/linux/policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"WorkspaceRoot": "/srv/cad",
"ReportUrl": "https://helpdesk.example.org/issues/new",
"OrganizationName": "Example Lab",
"UsageStatistics": 0
"UsageStatistics": 0,
"ShowDonateTag": 0
}
2 changes: 2 additions & 0 deletions deploy/desktop-policies/macos/teamcraft-policies.mobileconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
<string>Example Lab</string>
<key>UsageStatistics</key>
<integer>0</integer>
<key>ShowDonateTag</key>
<integer>0</integer>
</dict>
</array>
<key>PayloadType</key>
Expand Down
6 changes: 6 additions & 0 deletions deploy/desktop-policies/windows/TeamCraft.admx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
<enabledValue><decimal value="1" /></enabledValue>
<disabledValue><decimal value="0" /></disabledValue>
</policy>
<policy name="ShowDonateTag" class="Both" displayName="$(string.ShowDonateTag)" explainText="$(string.ShowDonateTag_Explain)" key="Software\Policies\TeamCraft" valueName="ShowDonateTag">
<parentCategory ref="TeamCraft" />
<supportedOn ref="SUPPORTED_TeamCraft_0_2_12" />
<enabledValue><decimal value="1" /></enabledValue>
<disabledValue><decimal value="0" /></disabledValue>
</policy>
<policy name="WorkspaceRoot" class="Both" displayName="$(string.WorkspaceRoot)" explainText="$(string.WorkspaceRoot_Explain)" presentation="$(presentation.WorkspaceRoot)" key="Software\Policies\TeamCraft">
<parentCategory ref="TeamCraft" />
<supportedOn ref="SUPPORTED_TeamCraft_0_2_12" />
Expand Down
2 changes: 2 additions & 0 deletions deploy/desktop-policies/windows/de-DE/TeamCraft.adml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<string id="CrashReportPrompt_Explain">Deaktiviert: Absturzberichte bleiben nur auf dem Computer und werden nie zum Teilen angeboten. Aktiviert: Die App fragt nach jedem Absturz. Nicht konfiguriert: Jeder Benutzer entscheidet selbst (Einstellungen → Absturzberichte). Berichte werden nie gesendet, ohne dass der Benutzer das Formular für die Meldung öffnet.</string>
<string id="UsageStatistics">Anonyme Nutzungsstatistik</string>
<string id="UsageStatistics_Explain">Deaktiviert: Es wird keine Nutzungsstatistik gesendet oder gespeichert, kein Hinweis angezeigt, und Benutzer können sie nicht einschalten. Aktiviert: Die Statistik wird gesendet, und Benutzer können sie nicht ausschalten. Nicht konfiguriert: Jeder Benutzer entscheidet selbst. (Gelesen von App-Versionen mit Nutzungsstatistik, #383.)</string>
<string id="ShowDonateTag">Hinweis „Unterstützen Sie uns auf Ko-fi“</string>
<string id="ShowDonateTag_Explain">Deaktiviert: Der kleine Hinweis „Unterstützen Sie uns auf Ko-fi“ in der Statusleiste wird nie angezeigt, und Benutzer können ihn nicht einschalten. Aktiviert: Er wird einmal pro Start der App angezeigt, und Benutzer können ihn nicht ausschalten. Nicht konfiguriert: Er wird einmal pro Start angezeigt, und jeder Benutzer kann ihn in den Einstellungen ausschalten. Der Hinweis verlinkt auf die feste Ko-fi-Seite des Vereins, der TeamCraft entwickelt (https://ko-fi.com/warr_ev); vor einem Klick wird nichts gesendet. (Gelesen von App-Versionen mit dem Hinweis, #403.)</string>
<string id="WorkspaceRoot">Standard-Arbeitsordner</string>
<string id="WorkspaceRoot_Explain">Der Ordner, in dem neue Arbeitsordner angelegt werden (ein absoluter Pfad wie D:\CAD oder \\fileserver\cad; Umgebungsvariablen werden nicht aufgelöst). Benutzer können in den Einstellungen trotzdem einen anderen Ordner wählen.</string>
<string id="ReportUrl">Probleme melden an</string>
Expand Down
2 changes: 2 additions & 0 deletions deploy/desktop-policies/windows/en-US/TeamCraft.adml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<string id="CrashReportPrompt_Explain">Disabled: crash reports are kept on the computer only and never offered for sharing. Enabled: the app always asks after a crash. Not configured: each user chooses (Settings → Crash reports). Reports are never sent without the user opening the issue form.</string>
<string id="UsageStatistics">Anonymous usage statistics</string>
<string id="UsageStatistics_Explain">Disabled: no usage statistics are sent or kept, no notice is shown, and users cannot turn them on. Enabled: statistics are sent and users cannot turn them off. Not configured: each user chooses. (Read by app versions with usage statistics, #383.)</string>
<string id="ShowDonateTag">“Support us on Ko-fi” tag</string>
<string id="ShowDonateTag_Explain">Disabled: the small “Support us on Ko-fi” tag in the status bar is never shown, and users cannot turn it on. Enabled: it is shown once per start of the app, and users cannot turn it off. Not configured: it is shown once per start and each user can turn it off in Settings. The tag links to the fixed Ko-fi page of the association that develops TeamCraft (https://ko-fi.com/warr_ev); nothing is sent before a click. (Read by app versions with the tag, #403.)</string>
<string id="WorkspaceRoot">Default working folder</string>
<string id="WorkspaceRoot_Explain">The folder new working folders are created in (an absolute path such as D:\CAD or \\fileserver\cad; environment variables are not expanded). Users can still choose another folder in Settings.</string>
<string id="ReportUrl">Report problems to</string>
Expand Down
3 changes: 2 additions & 1 deletion desktop/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
| Ko-fi tag | *Support us on Ko-fi* in the status bar once per start of the app (#403): `donate_tag_due` in `src/commands.rs` answers yes once per process (in memory only, so reconnecting, switching server or reloading the window does not show it again); a click opens the fixed `DONATE_URL` (`https://ko-fi.com/warr_ev`) with the opener from Rust (`open_donate_page`, the web view cannot pass another address) and hides it, *×* only hides it. Static text, nothing loaded from ko-fi.com, no counting. *Settings → Support TeamCraft* switches it off (`donate_tag` in the settings file); the policy `ShowDonateTag` fixes it. Texts in `shared/i18n` |
# TeamCraft Desktop

The rich client of TeamCraft for **Linux, macOS and Windows**: a navigation
Expand Down Expand Up @@ -61,7 +62,7 @@ TeamCraft server – it is a client, not an offline copy.
| Pack and Go, STL | ZIP of a revision and its structure, with a progress dialog and *Cancel* (also while the server packs); written as `<name>.teamcraft-download` and renamed when complete, removed on cancel or error; **Export STL…** from the 3D viewer |
| Report a problem | *Help → Report a Problem…* and *Report…* on every error message (toasts and dialog errors, #381): one review dialog with the title "<action>: <error>" (cut at a word, `…`), a description with the action, its key inputs (`run(text, fn, inputs)`, `toast(…, action, inputs)`, `dialog(…, { inputs })`: group, item, revision, file and format, import options – names only, a path reduced to its file name, at most 12 values of 200 characters; `ui/js/report-inputs.js`, tested by `scripts/desktop-report-inputs.test.mjs`), the error and the versions, "What were you trying to do?" (left out when empty) and, ticked, the last 50 error messages of the session – all redacted in Rust like crash reports (`src/report.rs`: home folder → `~`, addresses → `[url]`, tokens → `[token]`). Nothing leaves the app without a click: *Open issue form* (GitHub, or *Settings → Report problems to*: the operator's own form, which gets `title` and `body`, or the policy `ReportUrl`; a long text is cut in the link and copied in full), *Copy report*, *Save report…* (work offline). The web UI's error pages have *Copy details* (status, message, page, time, version, request id = the `x-request-id` header and the server log's `request_id`) |
| Usage report | Once a day of use the app sends its own TeamCraft server (`POST /api/v1/usage`) an anonymous report of the day before (`src/usage.rs`, #383): a random installation id, versions, OS, architecture, package type, minutes with the window in front, and counts of fixed actions (checkout, checkin, park, cancel_checkout, get_files, open_cad, open_3d_preview, import_bom, import_folder, new_item, release, search, assistant – a test checks each has a count site) and STEP exports per program – never names, numbers, paths or anything typed. *Settings → Privacy → Show what is sent* shows it. The server shares an aggregate with the developers only if its administrator turns that on (admin guide: *Privacy*) |
| Managed deployment | Policies per computer or user, read once at start and never sent (`src/policy.rs`, #378): `ServerUrl` (+ `AllowOtherServers`), `CheckForUpdates`, `CrashReportPrompt`, `WorkspaceRoot`, `OrganizationName`, `UsageStatistics` – Windows registry `Software\Policies\TeamCraft` (HKLM wins over HKCU; ADMX/ADML in `deploy/desktop-policies/windows`), macOS managed preferences of `io.github.rudalabs.teamcraft` (`plutil`), Linux `/etc/teamcraft/policies.json`. Wrong types and out-of-range values count as not set; fixed settings show *Set by your organization* and are disabled; *Managed by …* in Settings and About. Admin guide: *Deploying the desktop app* |
| Managed deployment | Policies per computer or user, read once at start and never sent (`src/policy.rs`, #378): `ServerUrl` (+ `AllowOtherServers`), `CheckForUpdates`, `CrashReportPrompt`, `WorkspaceRoot`, `OrganizationName`, `UsageStatistics`, `ReportUrl`, `ShowDonateTag` – Windows registry `Software\Policies\TeamCraft` (HKLM wins over HKCU; ADMX/ADML in `deploy/desktop-policies/windows`), macOS managed preferences of `io.github.rudalabs.teamcraft` (`plutil`), Linux `/etc/teamcraft/policies.json`. Wrong types and out-of-range values count as not set; fixed settings show *Set by your organization* and are disabled; *Managed by …* in Settings and About. Admin guide: *Deploying the desktop app* |
| Crash reports | Panics, uncaught UI errors and sessions that ended unexpectedly (web view crash, force-quit hang) are written to a local, redacted report (no home folder, server addresses, tokens or item data). At the next start the app shows it and asks: *Report on GitHub…* (a prefilled issue you submit yourself), *Copy* or *Delete report*. Nothing is sent without that choice; *Settings → Crash reports* turns the question off |
| Language | *Settings → Language* (#379): *As the system* (`navigator.languages`: exactly, then by base language, else English), *English*, *Deutsch* – kept on this computer, applied at the next start. Messages come from `shared/i18n/<lang>.json` through `shared/js/i18n.js` (`t(id, params)`, English fallback); translated so far: the *Settings* dialog and the empty states (#423) |
| Empty states | An empty list names the next step, by role (#423, `ui/js/empty-rules.js`, tested by `scripts/desktop-empty-rules.test.mjs`): no project group → *Create a project group* (CAD editors) or "ask a manager of a group to add you" (viewers, with the viewer note); an empty group on *Home* (Files, All items, Structure) → *Import CAD folder…* / *New item* for those who may create items in it, "ask a manager to add you" for CAD editors outside the group; *New on this computer* without suggestions → *Get…* (the dialog starts with the active group ticked); empty worklist sections and the review and check-out cards of the *Home* tab say how work arrives there; an empty working folder of a revision names the next step by check-out (holder, may check out, neither). Viewers see a note at the top of the worklist and of the *Home* tab: editing needs the CAD editor role – ask an administrator of the server. The texts come from the i18n catalogs (`empty.*`); the catalog is loaded before the first view draws |
Expand Down
73 changes: 73 additions & 0 deletions desktop/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ pub struct Session {
pub checkout_parts: bool,
/// After a crash, ask at the next start whether to share the report.
pub crash_prompt: bool,
/// Show the *Support us on Ko-fi* tag once at this start (#403): the
/// policy, else the user's choice.
pub donate_tag: bool,
/// *Settings → Report problems to* (#381); `None` = GitHub.
pub report_url: Option<String>,
/// A *with local server* installation: the connect screen offers *Try
Expand All @@ -133,6 +136,7 @@ pub fn session(app: AppHandle, state: State<'_, AppState>) -> Session {
checkout_parts: s.checkout_parts != Some(false),
report_url: policy::current().report_target(s.report_url.clone()),
crash_prompt: policy::current().crash_prompt(s.crash_prompt),
donate_tag: policy::current().donate_tag(s.donate_tag),
server_url: s.server_url.clone(),
signed_in: s.token.is_some(),
skin: s.skin.clone().unwrap_or_else(|| "teamcraft".into()),
Expand Down Expand Up @@ -1380,6 +1384,52 @@ pub fn open_release_page(app: AppHandle) -> CmdResult<()> {
.map_err(|e| ApiError::local(format!("The browser could not be opened: {e}")))
}

// ------------------------------------------------------------ Ko-fi tag (#403)

/// The Ko-fi page of the association that develops TeamCraft. Fixed in the
/// app, not configurable: a policy can only switch the tag off.
pub const DONATE_URL: &str = "https://ko-fi.com/warr_ev";

/// The *Support us on Ko-fi* tag: opens [`DONATE_URL`] in the default
/// browser. The web view cannot pass another address; nothing is sent before
/// the click and nothing is counted.
#[tauri::command]
pub fn open_donate_page(app: AppHandle) -> CmdResult<()> {
app.opener()
.open_url(DONATE_URL, None::<&str>)
.map_err(|e| ApiError::local(format!("The browser could not be opened: {e}")))
}

/// Whether the tag was shown in this run of the app – held in memory only,
/// so reconnecting, switching server or reloading the window does not show
/// it again, and the next start does.
static DONATE_TAG_SHOWN: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);

/// Show the tag now? Only when it is on (the policy, else the setting) and
/// not yet shown in this run; a `true` answer marks it shown.
fn donate_tag_due_once(enabled: bool, shown: &std::sync::atomic::AtomicBool) -> bool {
enabled && !shown.swap(true, std::sync::atomic::Ordering::SeqCst)
}

/// Asked by the main window when it opens (ui/js/shell.js): `true` once per
/// start of the app while the tag is on.
#[tauri::command]
pub fn donate_tag_due(state: State<'_, AppState>) -> bool {
let enabled = policy::current().donate_tag(snapshot(&state).donate_tag);
donate_tag_due_once(enabled, &DONATE_TAG_SHOWN)
}

/// *Settings → Show the "Support us on Ko-fi" tag at start*; refused while a
/// policy (`ShowDonateTag`) fixes it.
#[tauri::command]
pub fn set_donate_tag(state: State<'_, AppState>, enabled: bool) -> CmdResult<()> {
if policy::current().show_donate_tag.is_some() {
return Err(ApiError::local(MANAGED));
}
update_settings(&state, |s| s.donate_tag = Some(enabled))?;
Ok(())
}

/// Smallest and largest zoom factor of the user interface.
pub const ZOOM_RANGE: (f64, f64) = (0.5, 2.5);

Expand Down Expand Up @@ -1417,6 +1467,29 @@ mod tests {
assert_eq!(clamp_zoom(f64::NAN), 1.0);
}

/// The Ko-fi tag (#403) opens one fixed https address of ko-fi.com, and
/// the web view's content security policy does not let ko-fi.com in:
/// nothing is loaded from there inside the app.
#[test]
fn the_donate_link_is_fixed_and_not_in_the_csp() {
assert_eq!(DONATE_URL, "https://ko-fi.com/warr_ev");
let conf = include_str!("../tauri.conf.json");
assert!(conf.contains("\"csp\""), "tauri.conf.json has a CSP");
assert!(!conf.contains("ko-fi.com"), "ko-fi.com is not in the CSP");
}

/// Once per start: the first question while it is on says yes, every
/// later one no; switched off it never shows and is not used up.
#[test]
fn the_donate_tag_is_due_once_per_start() {
use std::sync::atomic::AtomicBool;
let shown = AtomicBool::new(false);
assert!(!donate_tag_due_once(false, &shown), "off: not shown");
assert!(donate_tag_due_once(true, &shown), "first time");
assert!(!donate_tag_due_once(true, &shown), "not a second time");
assert!(!donate_tag_due_once(false, &shown));
}

#[test]
fn only_an_offered_agent_backend_can_be_picked() {
use acp::AgentBackend::{Company, Local};
Expand Down
3 changes: 3 additions & 0 deletions desktop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ fn main() {
commands::set_update_check,
commands::set_checkout_parts,
commands::open_release_page,
commands::open_donate_page,
commands::set_donate_tag,
commands::donate_tag_due,
commands::save_package,
commands::cancel_package,
commands::save_stl,
Expand Down
Loading
Loading