summaryrefslogtreecommitdiff
path: root/ICal.ts
diff options
context:
space:
mode:
authorTim Schiewe <git@tforge.de>2018-04-30 18:15:52 +0200
committerTim Schiewe <git@tforge.de>2018-04-30 18:15:52 +0200
commit93b466df50d94d4c15715f5eb4d88a0be7d61c11 (patch)
tree4923ae6a554b6e599af53a401825ec8391250620 /ICal.ts
parentfba804b69e5cbdbe7cb71d6137b2b2a56230a971 (diff)
downloadsplus-93b466df50d94d4c15715f5eb4d88a0be7d61c11.tar.gz
splus-93b466df50d94d4c15715f5eb4d88a0be7d61c11.zip
Create better structure
Diffstat (limited to 'ICal.ts')
-rw-r--r--ICal.ts30
1 files changed, 0 insertions, 30 deletions
diff --git a/ICal.ts b/ICal.ts
deleted file mode 100644
index fe74dab..0000000
--- a/ICal.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-// ref. https://www.npmjs.com/package/ical-generator
-import * as ical from 'ical-generator';
-import * as crypto from 'crypto';
-import * as fs from 'fs';
-
-const TARGET_FILE = 'docs/informatik1.ics';
-const DOMAIN = 'schneefux.github.io'; // TODO config management
-
-const sha256 = (x) => crypto.createHash('sha256').update(x, 'utf8').digest('hex');
-
-const cal = ical();
-
-// TODO declare an interface
-export function createEvent(event) {
- // TODO better duplicate detection and resolve conflicts lol
- const eventId = sha256(JSON.stringify(event)).substr(0, 16);
-
- const icalEvent = cal.createEvent({
- uid: eventId,
- start: event.start.dateTime,
- end: event.end.dateTime,
- timestamp: new Date(),
- summary: event.summary,
- description: event.description,
- });
-}
-
-export function commit() {
- fs.writeFile(TARGET_FILE, cal.toString(), (err) => {});
-}