suppression d'un plugin

This commit is contained in:
oscar.plaisant@icloud.com 2023-10-24 00:07:12 +02:00
parent 19737a8926
commit 073cfab0aa
5 changed files with 92 additions and 206 deletions

View File

@ -58,6 +58,5 @@
"obsidian-vimrc-support", "obsidian-vimrc-support",
"note-aliases", "note-aliases",
"obsidian-style-settings", "obsidian-style-settings",
"aw-watcher-obsidian",
"number-headings-obsidian" "number-headings-obsidian"
] ]

View File

@ -1,167 +0,0 @@
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// main.ts
var main_exports = {};
__export(main_exports, {
default: () => ActivityWatchPlugin
});
module.exports = __toCommonJS(main_exports);
var import_obsidian = require("obsidian");
var os = __toESM(require("os"));
var AWrequest = class {
constructor(url, body) {
this.contentType = "application/json";
this.headers = { "Content-type": "application/json", "charset": "utf-8" };
this.method = "post";
this.throw = true;
this.url = url;
this.body = body;
}
};
var DEFAULT_SETTINGS = {
devServer: false
};
var ActivityWatchPlugin = class extends import_obsidian.Plugin {
constructor() {
super(...arguments);
this.hostname = os.hostname();
this.watcher_name = "aw-watcher-obsidian";
this.sleeptime = 5;
}
async init() {
this.statusBarItemEl.setText("ActivityWatch initializing...");
const port = this.settings.devServer ? 5666 : 5600;
this.bucket_id = `${this.watcher_name}_${this.hostname}`;
this.endpoint_url = `http://127.0.0.1:${port}/api/0/`;
if (this.settings.devServer) {
console.log(`sleeptime is ${this.sleeptime}` + (this.sleeptime <= 0 ? ", skipping any timed heartbeats" : ""));
console.log(`watcher_name is ${this.watcher_name}`);
console.log(`port is ${port}`);
console.log(`bucket_id is ${this.bucket_id}`);
console.log(`endpoint_url is ${this.endpoint_url}`);
}
await this.createBucket(this.bucket_id, "app.editor.activity");
this.statusBarItemEl.setText("ActivityWatch active");
}
async post(endpoint, data) {
const r = new AWrequest(this.endpoint_url + endpoint, JSON.stringify(data));
try {
await (0, import_obsidian.request)(r);
} catch (e) {
console.log(`Request to URL [${r.url}] using [${r.method}], Header [${r.headers}], Body [${r.body}] failed!`);
throw e;
}
}
async createBucket(id, event_type) {
const data = {
"client": this.watcher_name,
"hostname": this.hostname,
"type": event_type
};
await this.post(`buckets/${id}`, data);
}
async sendData(id, heartbeat_data, pulsetime) {
const endpoint = `buckets/${id}/heartbeat?pulsetime=${pulsetime}`;
await this.post(endpoint, { "timestamp": new Date().toISOString(), "duration": 0, "data": heartbeat_data });
}
async sendAbstractFileEvent(file, extraData, pulseTime) {
if (file) {
await this.sendData(this.bucket_id, {
"file": "/" + file.path,
"project": file.vault.getName(),
"language": "Markdown",
"projectPath": file.vault.adapter instanceof import_obsidian.FileSystemAdapter ? file.vault.adapter.getBasePath() : "unknown vault path",
"editor": "Obsidian",
"editorVersion": import_obsidian.apiVersion,
...extraData ? extraData : {}
}, pulseTime);
}
}
async sendFileHeartbeatEvent(file) {
await this.sendAbstractFileEvent(file, {
"eventType": "obsidian.activeFileHeartbeatEvent"
}, this.sleeptime + 1);
}
async sendFileRenameEvent(file, oldPath) {
await this.sendAbstractFileEvent(file, {
"eventType": "obsidian.renameFileEvent",
"oldPath": oldPath
}, 0);
}
async sendFileDeleteEvent(oldPath) {
await this.sendAbstractFileEvent(oldPath, {
"eventType": "obsidian.deleteFileEvent"
}, 0);
}
async sendFileCreateEvent(path) {
await this.sendAbstractFileEvent(path, {
"eventType": "obsidian.createFileEvent"
}, 0);
}
async onload() {
this.statusBarItemEl = this.addStatusBarItem();
await this.loadSettings();
await this.init();
this.registerEvent(this.app.vault.on("rename", (file, oldPath) => this.sendFileRenameEvent(file, oldPath)));
this.registerEvent(this.app.vault.on("delete", this.sendFileDeleteEvent));
this.app.workspace.onLayoutReady(() => {
this.registerEvent(this.app.vault.on("create", (f) => this.sendFileCreateEvent(f)));
});
this.addSettingTab(new ObsidianWatcherSettingTab(this.app, this));
if (this.sleeptime > 0) {
this.registerInterval(window.setInterval(() => {
this.sendFileHeartbeatEvent(this.app.workspace.getActiveFile());
}, this.sleeptime * 1e3));
}
}
onunload() {
this.statusBarItemEl.remove();
}
async loadSettings() {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
}
async saveSettings() {
await this.saveData(this.settings);
}
};
var ObsidianWatcherSettingTab = class extends import_obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Settings for ActivityWatch plugin" });
new import_obsidian.Setting(containerEl).setName("ActivityWatch development server").setDesc("If enabled, uses development server for ActivityWatch instead of production. Default off.").addToggle((t) => t.setValue(this.plugin.settings.devServer).onChange(async (value) => {
console.log(`switching plugin to use ${value ? "development" : "production"} backend`);
this.plugin.settings.devServer = value;
await this.plugin.saveSettings();
await this.plugin.init();
}));
}
};

View File

@ -1,10 +0,0 @@
{
"id": "aw-watcher-obsidian",
"name": "ActivityWatch",
"version": "1.3.0",
"minAppVersion": "0.15.0",
"description": "This is a plugin bridging compatibility between ActivityWatch and Obsidian.",
"author": "Grimmauld",
"authorUrl": "https://github.com/LordGrimmauld",
"isDesktopOnly": true
}

View File

@ -398,9 +398,43 @@
"source": false "source": false
} }
} }
},
{
"id": "83d8fad282b7d043",
"type": "leaf",
"pane-relief:history-v1": {
"pos": 0,
"stack": [
{
"state": "{}",
"eState": "{}"
},
{
"title": "2023-10-05",
"icon": "lucide-file",
"state": "{\"type\":\"markdown\",\"state\":{\"file\":\"daily/2023-10-05.md\",\"mode\":\"source\",\"backlinks\":false,\"source\":false}}",
"eState": "{\"cursor\":{\"from\":{\"line\":9,\"ch\":55},\"to\":{\"line\":9,\"ch\":55}}}"
},
{
"title": "2023-10-23",
"icon": "lucide-file",
"state": "{\"type\":\"markdown\",\"state\":{\"file\":\"daily/2023-10-23.md\",\"mode\":\"source\",\"backlinks\":false,\"source\":false}}",
"eState": "{\"cursor\":{\"from\":{\"line\":4,\"ch\":0},\"to\":{\"line\":4,\"ch\":0}}}"
}
]
},
"state": {
"type": "markdown",
"state": {
"file": "daily/2023-10-23.md",
"mode": "source",
"backlinks": false,
"source": false
}
}
} }
], ],
"currentTab": 13 "currentTab": 14
} }
], ],
"direction": "vertical" "direction": "vertical"
@ -585,7 +619,7 @@
"state": { "state": {
"type": "outgoing-link", "type": "outgoing-link",
"state": { "state": {
"file": "films à voir.md", "file": "daily/2023-10-23.md",
"linksCollapsed": false, "linksCollapsed": false,
"unlinkedCollapsed": true "unlinkedCollapsed": true
} }
@ -606,7 +640,7 @@
"state": { "state": {
"type": "backlink", "type": "backlink",
"state": { "state": {
"file": "films à voir.md", "file": "daily/2023-10-23.md",
"collapseAll": true, "collapseAll": true,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical", "sortOrder": "alphabetical",
@ -622,8 +656,7 @@
} }
], ],
"direction": "horizontal", "direction": "horizontal",
"width": 438.5, "width": 438.5
"collapsed": true
}, },
"right": { "right": {
"id": "1102f19b896c7a16", "id": "1102f19b896c7a16",
@ -649,7 +682,7 @@
"state": { "state": {
"type": "localgraph", "type": "localgraph",
"state": { "state": {
"file": "films à voir.md", "file": "daily/2023-10-23.md",
"options": { "options": {
"collapse-filter": false, "collapse-filter": false,
"search": "", "search": "",
@ -744,7 +777,7 @@
"state": { "state": {
"type": "outline", "type": "outline",
"state": { "state": {
"file": "films à voir.md" "file": "daily/2023-10-23.md"
} }
} }
}, },
@ -782,7 +815,7 @@
"state": { "state": {
"type": "file-properties", "type": "file-properties",
"state": { "state": {
"file": "films à voir.md" "file": "daily/2023-10-23.md"
} }
} }
}, },
@ -804,7 +837,7 @@
} }
} }
], ],
"currentTab": 1 "currentTab": 7
}, },
{ {
"id": "3b58d11fec2fca87", "id": "3b58d11fec2fca87",
@ -871,8 +904,7 @@
} }
], ],
"direction": "horizontal", "direction": "horizontal",
"width": 424.5, "width": 424.5
"collapsed": true
}, },
"left-ribbon": { "left-ribbon": {
"hiddenItems": { "hiddenItems": {
@ -897,13 +929,15 @@
"breadcrumbs:Breadcrumbs Visualisation": false "breadcrumbs:Breadcrumbs Visualisation": false
} }
}, },
"active": "e8989c205167f9f3", "active": "83d8fad282b7d043",
"ophidian:layout-settings": { "ophidian:layout-settings": {
"pane-relief:focus-lock": true "pane-relief:focus-lock": true
}, },
"lastOpenFiles": [ "lastOpenFiles": [
"prolétariat.md", "daily/2023-10-05.md",
"daily/2023-10-23.md",
"films à voir.md", "films à voir.md",
"prolétariat.md",
"post queue challenges docstring.md", "post queue challenges docstring.md",
"baptême.md", "baptême.md",
"informatique/python/challenges_docstring/mentorat/krystof2601/contacts.db", "informatique/python/challenges_docstring/mentorat/krystof2601/contacts.db",
@ -936,8 +970,6 @@
"informatique/programmation_web_serveur/TP3/node_modules/minimist/CHANGELOG.md", "informatique/programmation_web_serveur/TP3/node_modules/minimist/CHANGELOG.md",
"informatique/programmation_web_serveur/TP3/node_modules/concat-stream/readme.md", "informatique/programmation_web_serveur/TP3/node_modules/concat-stream/readme.md",
"informatique/programmation_web_serveur/TP3/node_modules/util-deprecate/README.md", "informatique/programmation_web_serveur/TP3/node_modules/util-deprecate/README.md",
"informatique/programmation_web_serveur/TP3/node_modules/util-deprecate/History.md",
"informatique/programmation_web_serveur/TP3/node_modules/string_decoder/README.md",
"attachments/Capture décran 2023-10-18 à 00.05.25.png", "attachments/Capture décran 2023-10-18 à 00.05.25.png",
"attachments/Capture décran 2023-10-17 à 23.56.01.png", "attachments/Capture décran 2023-10-17 à 23.56.01.png",
"attachments/Capture décran 2023-10-17 à 23.55.50.png", "attachments/Capture décran 2023-10-17 à 23.55.50.png",

View File

@ -1020,9 +1020,43 @@
"source": false "source": false
} }
} }
},
{
"id": "83d8fad282b7d043",
"type": "leaf",
"pane-relief:history-v1": {
"pos": 0,
"stack": [
{
"state": "{}",
"eState": "{}"
},
{
"title": "2023-10-05",
"icon": "lucide-file",
"state": "{\"type\":\"markdown\",\"state\":{\"file\":\"daily/2023-10-05.md\",\"mode\":\"source\",\"backlinks\":false,\"source\":false}}",
"eState": "{\"cursor\":{\"from\":{\"line\":9,\"ch\":55},\"to\":{\"line\":9,\"ch\":55}}}"
},
{
"title": "2023-10-23",
"icon": "lucide-file",
"state": "{\"type\":\"markdown\",\"state\":{\"file\":\"daily/2023-10-23.md\",\"mode\":\"source\",\"backlinks\":false,\"source\":false}}",
"eState": "{\"cursor\":{\"from\":{\"line\":4,\"ch\":0},\"to\":{\"line\":4,\"ch\":0}}}"
}
]
},
"state": {
"type": "markdown",
"state": {
"file": "daily/2023-10-23.md",
"mode": "source",
"backlinks": false,
"source": false
}
}
} }
], ],
"currentTab": 13 "currentTab": 14
} }
], ],
"direction": "vertical" "direction": "vertical"
@ -1185,7 +1219,7 @@
} }
} }
], ],
"currentTab": 1 "currentTab": 4
}, },
{ {
"id": "d392c3e654e7953f", "id": "d392c3e654e7953f",
@ -1207,7 +1241,7 @@
"state": { "state": {
"type": "outgoing-link", "type": "outgoing-link",
"state": { "state": {
"file": "films à voir.md", "file": "daily/2023-10-23.md",
"linksCollapsed": false, "linksCollapsed": false,
"unlinkedCollapsed": true "unlinkedCollapsed": true
} }
@ -1228,7 +1262,7 @@
"state": { "state": {
"type": "backlink", "type": "backlink",
"state": { "state": {
"file": "films à voir.md", "file": "daily/2023-10-23.md",
"collapseAll": true, "collapseAll": true,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical", "sortOrder": "alphabetical",
@ -1244,8 +1278,7 @@
} }
], ],
"direction": "horizontal", "direction": "horizontal",
"width": 438.5, "width": 438.5
"collapsed": true
}, },
"right": { "right": {
"id": "1102f19b896c7a16", "id": "1102f19b896c7a16",
@ -1271,7 +1304,7 @@
"state": { "state": {
"type": "localgraph", "type": "localgraph",
"state": { "state": {
"file": "films à voir.md", "file": "daily/2023-10-23.md",
"options": { "options": {
"collapse-filter": false, "collapse-filter": false,
"search": "", "search": "",
@ -1366,7 +1399,7 @@
"state": { "state": {
"type": "outline", "type": "outline",
"state": { "state": {
"file": "films à voir.md" "file": "daily/2023-10-23.md"
} }
} }
}, },
@ -1404,7 +1437,7 @@
"state": { "state": {
"type": "file-properties", "type": "file-properties",
"state": { "state": {
"file": "films à voir.md" "file": "daily/2023-10-23.md"
} }
} }
}, },
@ -1426,7 +1459,7 @@
} }
} }
], ],
"currentTab": 1 "currentTab": 7
}, },
{ {
"id": "3b58d11fec2fca87", "id": "3b58d11fec2fca87",
@ -1493,8 +1526,7 @@
} }
], ],
"direction": "horizontal", "direction": "horizontal",
"width": 424.5, "width": 424.5
"collapsed": true
}, },
"left-ribbon": { "left-ribbon": {
"hiddenItems": { "hiddenItems": {
@ -1519,7 +1551,7 @@
"breadcrumbs:Breadcrumbs Visualisation": false "breadcrumbs:Breadcrumbs Visualisation": false
} }
}, },
"active": "e8989c205167f9f3", "active": "83d8fad282b7d043",
"ophidian:layout-settings": { "ophidian:layout-settings": {
"pane-relief:focus-lock": true "pane-relief:focus-lock": true
}, },