From 60019433ea7e920d0ba7bf5afdc4dd35450b4859 Mon Sep 17 00:00:00 2001 From: ecrum19 Date: Tue, 25 Aug 2026 12:42:27 +0200 Subject: [PATCH 1/3] small usage tracker addition --- .env.example | 2 + .github/workflows/main.yml | 4 + README.md | 34 +- TRIPLE-guide.md | 91 ----- config/entrance.html | 139 ------- config/tripleCSS-config.json | 46 --- makePod.sh | 5 - podRegistration.sh | 37 -- src/components/Unused.ts | 516 -------------------------- src/env.d.ts | 9 + src/main.ts | 10 + src/router.ts | 2 +- src/services/analytics/goatcounter.ts | 109 ++++++ src/services/solid/login.ts | 4 +- tests/unit/goatcounter.test.ts | 11 + 15 files changed, 163 insertions(+), 856 deletions(-) create mode 100644 .env.example delete mode 100644 TRIPLE-guide.md delete mode 100644 config/entrance.html delete mode 100644 config/tripleCSS-config.json delete mode 100755 makePod.sh delete mode 100644 podRegistration.sh delete mode 100644 src/components/Unused.ts create mode 100644 src/env.d.ts create mode 100644 src/services/analytics/goatcounter.ts create mode 100644 tests/unit/goatcounter.test.ts diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..3c6116cb --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +# Public GoatCounter endpoint used by the deployed app. +VITE_GOATCOUNTER_ENDPOINT=https://solidcockpit.goatcounter.com/count diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8720c7a2..d8d4f654 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,8 @@ jobs: - name: Build 🔧 run: npm run build:highmem + env: + VITE_GOATCOUNTER_ENDPOINT: https://solidcockpit.goatcounter.com/count - name: Post Build Actions 🛠️ run: npm run github-post-build @@ -60,6 +62,8 @@ jobs: - name: Build 🔧 run: npm run build:highmem + env: + VITE_GOATCOUNTER_ENDPOINT: https://solidcockpit.goatcounter.com/count - name: Post Build Actions 🛠️ run: npm run github-post-build diff --git a/README.md b/README.md index 4c1d95ea..a408c762 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,18 @@ Solid Cockpit is a Vue web application for interacting with Solid Pods: authentication, data upload, pod browsing, SPARQL query execution, query caching, and privacy/ACL management. -This application was developed in the context of the CHIST-ERA TRIPLE project. - ## Table of Contents - [Users](#users) +- [Privacy and Activity Measurement](#privacy-and-activity-measurement) - [Developers](#developers) +## Privacy and Activity Measurement + +The public deployment uses GoatCounter to measure basic application activity, such as page visits and aggregate browser usage. The app sends only the route path for a page view; it does not send query text, URL query strings, WebIDs, Pod URLs, file contents, or authentication data. GoatCounter's standard reporting may also aggregate browser, operating system, country, language, and screen-width information. GoatCounter does not use cookies or local storage for visitor tracking, and its standard reporting stores aggregate data rather than individual pageview records. The tracker remains disabled in builds where `VITE_GOATCOUNTER_ENDPOINT` is not configured. + +For details, see GoatCounter's [GDPR guidance](https://www.goatcounter.com/help/gdpr) and [privacy policy](https://www.goatcounter.com/help/privacy). + ## Users ### What Solid Cockpit Does @@ -52,23 +57,6 @@ In-app guides are available from the relevant page: - `Data Query`: query execution, examples, query URLs, and cache workflow - `Privacy Editing`: ACL editing, notifications, sharing records, and revocation scheduling -Solid Pod VoID file generation: - -- - -Example: - -```bash -mvn package -java -jar target/void-generator-0.7-SNAPSHOT-uber.jar \ - --from-solid-pod [URL-to-solid-pod] \ - --void-file void.ttl \ - -i [URL-to-solid-pod]/void.ttl \ - --repository [URL-to-solid-pod] -``` - -Then upload `void.ttl` to the pod root using the app's `Data Upload` page. - ### Citation If you use this tool in an academic publication, you can cite: @@ -136,6 +124,14 @@ Install dependencies: npm install ``` +Enable activity measurement locally, if desired, by setting the public GoatCounter endpoint in `.env`: + +```bash +VITE_GOATCOUNTER_ENDPOINT=https://solidcockpit.goatcounter.com/count +``` + +The deployed GitHub Pages build uses `https://solidcockpit.goatcounter.com/count`. This endpoint is not a secret; it identifies the GoatCounter site receiving aggregate pageview data. + Run locally: ```bash diff --git a/TRIPLE-guide.md b/TRIPLE-guide.md deleted file mode 100644 index ae2152e7..00000000 --- a/TRIPLE-guide.md +++ /dev/null @@ -1,91 +0,0 @@ -# TRIPLE Getting Started Guide - -👋 Welcome to the TRIPLE Getting Started Guide! This document will help you set up a Solid Pod and introduce you to the features of the Solid Cockpit app. Follow the steps carefully to get up and running 🚀 - - - -## 🎯 Objectives of This Guide - -1. Setting up a Solid Pod (that is accessible via the internet) -2. Logging into your Pod at any time (after setting it up) -3. Understanding the features and functionalities of the Solid Cockpit app. -4. Overview of future capabilities, such as managing pod contents, adjusting data privacy, and querying data using SPARQL. - - - -## 🌐 Setting Up a Solid Pod (Online) - -To **set up** your Solid Pod using the TRIPLE platform, follow these steps: - -1. **🔗 Navigate to our Solid Pod Hosting website** - - Go to [https://triple.ilabt.imec.be/](https://triple.ilabt.imec.be/) - - Use the following credentials to enter the site: - - **Password**: `triple` - -2. **🔐 Sign Up to make a Pod** - - Click **Sign Up** (assuming this is your first time) - -3. **🛠️ Create Your Solid Pod** - - Once you are on the **Your Account** page, click on **Create Pod**. - - Enter a name for your new pod and click **Create Pod**. - - After creating your pod, return to the home page by clicking **Back**. - -## 🔑 Logging into your Solid Pod (after creation) -1. **Navigate to our Solid Pod Hosting website** - - Go to [https://triple.ilabt.imec.be/](https://triple.ilabt.imec.be/) - - Use the following credentials to enter the site: - - **Password**: `triple` - -2. **Login using your credentials** - - Click **Login** (assuming you have already made an account) - -3. **Register your Pod on your new WebID card** - - Navigate to the "Home" page of the [Solid-Cockpit Webpage](https://knowledgeonwebscale.github.io/solid-cockpit/home) - - Login to your Solid Pod using the "https://triple.ilabt.imec.be/" provider - - CLICK the "REGISTER POD" button (not necessary to enter any PodURL) - - Thats it. Now you are connected to your new Pod!! - -## 🛫 Using the Solid Cockpit App - -The Solid Cockpit app provides several functionalities for managing and interacting with your Solid Pod. - -### ✨ Available Features - -1. 📝 **Data Upload** - - Upload data to your Pod. - - When uploading RDF data, file validity can be assessed before uploading. - - Specify and modify the metadata of uploaded files. - -2. 🗂️ **Data Browser** (under construction) - - View, modify, move, and delete the contents of your Pod. - - Explore and edit the container structure of your Pod. - -3. 🔍 **Data Query** - - An editor to write SPARQL queries to interact with data in your Pod, the Pods of others, and SPARQL Endpoints. - - A user input to designate the sources for the queries. - - Options that impact the the output formats, query execution, and other relevant parameters. - -4. 🔒 **Data Privacy Management** - - View the current privacy settings for your data (Read, Write, and Append). - - Add or change privacy settings to containers and resources in your Pod. - - Give and receive notifications related to new access rights to the data of others. - - - -## 🔮 In the Near Future - -- Improve the functionality of the Pod Browser for displaying pod contents effectively. -- Create interface for querying pod(s) (and SPARQL endpoints). -- Integrate example query catalogue for the querying functionality. -- Enhance privacy management display - -> Stay tuned for future updates that will bring more features and improvements to the Solid Cockpit app, making it more powerful and easier to use. - - - -## 🤝 Support and Further Information - -If you encounter issues during setup or usage, please consult our support resources or reach out to our support team for assistance. - ---- -🙏 We hope you find this guide helpful in setting up and exploring your Solid Pod. For questions or comments: [go here](https://github.com/KNowledgeOnWebScale/solid-cockpit/discussions). To report bugs or problems: [try here](https://github.com/KNowledgeOnWebScale/solid-cockpit/issues). \ No newline at end of file diff --git a/config/entrance.html b/config/entrance.html deleted file mode 100644 index 6e7ca08c..00000000 --- a/config/entrance.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - Community Solid Server - - - - -
-
- [Solid logo] -

Community Solid Server

-
-
-

- This server implements - the Solid protocol - for creating your own Solid Pod - and identity. -

- -

- -

Select one of these options to get started! -

- -

-

-

-
- -


- -

- This is a custom Community Solid Server landing page made for the - TRIPLE App. -

- -

- If interested, learn more about the Solid Project - or the Community Solid Server. -

-

- You are warmly invited - to share your experiences - and to report any bugs you encounter. -

- - - - - - - - - - \ No newline at end of file diff --git a/config/tripleCSS-config.json b/config/tripleCSS-config.json deleted file mode 100644 index 688c357d..00000000 --- a/config/tripleCSS-config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld", - "import": [ - "css:config/app/init/static-root.json", - "css:config/app/main/default.json", - "css:config/app/variables/default.json", - "css:config/http/handler/default.json", - "css:config/http/middleware/default.json", - "css:config/http/notifications/all.json", - "css:config/http/server-factory/http.json", - "css:config/http/static/default.json", - "css:config/identity/access/public.json", - "css:config/identity/email/default.json", - "css:config/identity/handler/default.json", - "css:config/identity/oidc/default.json", - "css:config/identity/ownership/token.json", - "css:config/identity/pod/static.json", - "css:config/ldp/authentication/dpop-bearer.json", - "css:config/ldp/authorization/webacl.json", - "css:config/ldp/handler/default.json", - "css:config/ldp/metadata-parser/default.json", - "css:config/ldp/metadata-writer/default.json", - "css:config/ldp/modes/default.json", - "css:config/storage/backend/file.json", - "css:config/storage/key-value/resource-store.json", - "css:config/storage/location/pod.json", - "css:config/storage/middleware/default.json", - "css:config/util/auxiliary/acl.json", - "css:config/util/identifiers/suffix.json", - "css:config/util/index/default.json", - "css:config/util/logging/winston.json", - "css:config/util/representation-conversion/default.json", - "css:config/util/resource-locker/file.json", - "css:config/util/variables/default.json" - ], - "@graph": [ - { - "@type": "Override", - "overrideInstance": { "@id": "urn:solid-server:default:RootStaticAsset" }, - "overrideParameters": { - "@type": "StaticAssetEntry", - "filePath": "config/entrance.html" - } - } - ] -} \ No newline at end of file diff --git a/makePod.sh b/makePod.sh deleted file mode 100755 index dd375921..00000000 --- a/makePod.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -current_directory=$(pwd) - -# launches -npx @solid/community-server -p 3000 -c $current_directory/config/tripleCSS-config.json -f .data \ No newline at end of file diff --git a/podRegistration.sh b/podRegistration.sh deleted file mode 100644 index 03383fd3..00000000 --- a/podRegistration.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# get current dir and navigate to the user's WebID card -read -p "Enter the name of your pod: " pod -current_directory=$(pwd) - -# designates the file to add the Pod info to -target_directory="$current_directory/.data/$pod/profile" -file_name="card$.ttl" -full_path="$target_directory/$file_name" - -# check to make sure the directory is accurate -if [ ! -d "$target_directory" ]; then - echo "Error: $target_directory does not exist..." - exit 1 -fi - -# replaces the last "." with a ";" for ttl format continuity -to_replace=" a foaf:Person." -fixed=" a foaf:Person;" -awk -v search="$to_replace" -v replace="$fixed" ' -{ - if ($0 == search) { - print replace - } else { - print - } -}' "$full_path" > temp && mv temp "$full_path" - -# makes it visible where your pod is using <../pim/space#storage> -pod_path=" <../>." -if ! grep -Fxq "$pod_path" "$full_path"; then - echo "$pod_path" >> $full_path - echo "Your pod is now registered!" -else - echo "Your pod is already registered!" -fi \ No newline at end of file diff --git a/src/components/Unused.ts b/src/components/Unused.ts deleted file mode 100644 index faaba803..00000000 --- a/src/components/Unused.ts +++ /dev/null @@ -1,516 +0,0 @@ -// query cache sharing HTML -// -// -// -// - - - - - - - - - - - - - -import { - getContainedResourceUrlAll, - getResourceInfo, - getSolidDataset, - getSolidDatasetWithAcl, - hasResourceAcl, - getResourceAcl, - hasAccessibleAcl, - hasFallbackAcl, - setAgentResourceAccess, - saveAclFor, - createAclFromFallbackAcl, - AclDataset, - SolidDataset, - WithServerResourceInfo, - WithAcl, - createThing, - getSourceUrl, - ThingPersisted, - UrlString, - responseToResourceInfo, - isRawData, - responseToSolidDataset, - getLinkedResourceUrlAll, - hasServerResourceInfo, - getEffectiveAccess, - - } from "@inrupt/solid-client"; - import { fetch } from "@inrupt/solid-client-authn-browser"; - import { WorkingData, fetchData } from "../services/solid/getData" - import { getPodURLs } from "../services/solid/login"; - - -/** - * Gets the a SolidDataset from the current Pod's /Uploads container. - * - * @param podURL The URL of the current Pod represented as a string - * @returns a SolidDataset representation of the Pod's /Uploads container - */ -async function obtainSolidDataset(podURL: string): Promise { - const dataWacl = await getSolidDataset(podURL+"uploads/example.ttl", {fetch: fetch}) - console.log(dataWacl) - return dataWacl; - // can't get items as SoldDatasets?? Something weird with file types I think? - // Need way to get all the resources found in a directory... (not sure how to do this?) - } - - -/** - * Gets the current ACL file from a Pod's /Uploads container. (a bit of a mess rn) - * - * @param datasetWithAcl A Solid dataset (obtained from a Pod URL) with or without an ACL file - * @returns an AclDataset that represents the current ACL for the Pod's /Uploads container - */ -async function obtainACL(datasetWithAcl) { - let resourceAcl: AclDataset; - if (!hasResourceAcl(datasetWithAcl)) { - if (!hasAccessibleAcl(datasetWithAcl)) { - throw new Error( - "The current user does not have permission to change access rights to this Resource." - ); - } - if (!hasFallbackAcl(datasetWithAcl)) { - throw new Error( - "The current user does not have permission to see who currently has access to this Resource." - ); - // Alternatively, initialise a new empty ACL as follows, - // but be aware that if you do not give someone Control access, - // **nobody will ever be able to change Access permissions in the future**: - // resourceAcl = createAcl(myDatasetWithAcl); - } - resourceAcl = createAclFromFallbackAcl(datasetWithAcl); - } else { - resourceAcl = getResourceAcl(datasetWithAcl); - } - return resourceAcl; -} - - -/** - * Random guide HTML code for installing and setting up a local instance of CSS... - * - *

1. Repo Cloning and Starting your local Solid pod

-
    -
  1. - Clone the project git repo (it has some useful scripts for later).
    For - help see - git clone guide. -
  2. -
-
$ git clone https://github.com/ecrum19/TRIPLE_App.git
-
    -
  1. - To start pod set-up, within the solid-cockpit/ directory execute the - following command: -
  2. -
-
$ bash makePod.sh
- -
- -

2. Setting up the Solid pod

-
    -
  1. - Using a web browser navigate to - http://localhost:3000/ -
  2. -
  3. Either "Sign up" or - "Login"
  4. -
  5. Once on the "Your Account" page, click on "Create pod"
  6. -
  7. Enter a name for the pod and click "Create pod"
  8. -
  9. Return to the home page by clicking "Back"
  10. -
-

- Voila, now you a pod! Time to return to the command line (briefly).
- - (Please note that if the terminal window you executed the bash script [in step 1-II] is terminated, - the Solid pod will no longer be accessible until it is re-launched (return to step 1-II). - For more info see - Community Solid Server Documentation.) - -

- -
- -

3. Register your Pod on your new WebID

-
    -
  1. Within the TRIPLE_App/ directory, execute the command below:
  2. -
    $ bash podRegistration.sh
    -
  3. At the prompt, enter the name of your pod from above (E.g. test)
  4. -
-

- Great, now we are finished with set-up!! - Return to the - Solid Cockpit App - for the next steps.
-

-
- -

4. Solid Pod Login within the TRIPLE App

-
    -
  1. - Click the "Data Upload" tab in the nav bar within the TRIPLE - App -
  2. -
  3. - If you followed the above sections to launch a local Solid Pod, simply - click the "Login" button that appears (because your pod provider is localhost:3000) -
  4. -
  5. After the redirect, click the "Authorize" button
  6. -
  7. - Once redirected back to the main page of the TRIPLE App, use the nav - bar to select the "Data Upload" tab -
  8. -
- -
- -

5. Data Upload Functionality

-
    -
  1. Click the "Data Upload" tab of the nav bar above
  2. -
- - *