1
Fork 0
mirror of https://github.com/starshardstudio/peafowl.git synced 2024-10-16 12:17:26 +00:00

A couple bug fixes and add support for Obsidian

This commit is contained in:
Steffo 2024-08-30 01:18:13 +02:00
parent 35131612e6
commit 801f2a39c6
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
19 changed files with 45842 additions and 42 deletions

View file

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run" type="DenoConfigurationType" inputPath="$PROJECT_DIR$/_run.ts" programParameters="run --allow-read --allow-write --allow-net --allow-env --allow-run">
<configuration default="false" name="Run" type="DenoConfigurationType" inputPath="$PROJECT_DIR$/_run.ts" programParameters="run --allow-all">
<option name="applicationArguments" value="--watch --host=0.0.0.0" />
<method v="2" />
</configuration>

12
.obsidian/app.json vendored Normal file
View file

@ -0,0 +1,12 @@
{
"newFileLocation": "current",
"trashOption": "none",
"alwaysUpdateLinks": true,
"useMarkdownLinks": true,
"userIgnoreFilters": [
"/^_.+/"
],
"showUnsupportedFiles": false,
"showInlineTitle": true,
"spellcheck": false
}

3
.obsidian/appearance.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"accentColor": "#531cff"
}

3
.obsidian/community-plugins.json vendored Normal file
View file

@ -0,0 +1,3 @@
[
"obsidian-git"
]

30
.obsidian/core-plugins-migration.json vendored Normal file
View file

@ -0,0 +1,30 @@
{
"file-explorer": true,
"global-search": true,
"switcher": true,
"graph": false,
"backlink": true,
"canvas": false,
"outgoing-link": true,
"tag-pane": false,
"properties": true,
"page-preview": false,
"daily-notes": false,
"templates": true,
"note-composer": false,
"command-palette": true,
"slash-command": false,
"editor-status": true,
"bookmarks": false,
"markdown-importer": false,
"zk-prefixer": false,
"random-note": true,
"outline": true,
"word-count": false,
"slides": false,
"audio-recorder": false,
"workspaces": false,
"file-recovery": false,
"publish": false,
"sync": false
}

13
.obsidian/core-plugins.json vendored Normal file
View file

@ -0,0 +1,13 @@
[
"file-explorer",
"global-search",
"switcher",
"backlink",
"outgoing-link",
"properties",
"templates",
"command-palette",
"editor-status",
"random-note",
"outline"
]

View file

@ -0,0 +1,58 @@
{
"commitMessage": "Update {{numFiles}} files from Obsidian",
"commitDateFormat": "YYYY-MM-DD",
"autoSaveInterval": 0,
"autoPushInterval": 0,
"autoPullInterval": 20,
"autoPullOnBoot": true,
"disablePush": false,
"pullBeforePush": true,
"disablePopups": false,
"disablePopupsForNoChanges": false,
"listChangedFilesInMessageBody": false,
"showStatusBar": true,
"updateSubmodules": false,
"syncMethod": "rebase",
"customMessageOnAutoBackup": false,
"autoBackupAfterFileChange": false,
"treeStructure": false,
"refreshSourceControl": true,
"basePath": "",
"differentIntervalCommitAndPush": false,
"changedFilesInStatusBar": false,
"showedMobileNotice": true,
"refreshSourceControlTimer": 7000,
"showBranchStatusBar": true,
"setLastSaveToLastCommit": false,
"submoduleRecurseCheckout": false,
"gitDir": "",
"showFileMenu": true,
"authorInHistoryView": "hide",
"dateInHistoryView": false,
"lineAuthor": {
"show": false,
"followMovement": "inactive",
"authorDisplay": "initials",
"showCommitHash": false,
"dateTimeFormatOptions": "date",
"dateTimeFormatCustomString": "YYYY-MM-DD HH:mm",
"dateTimeTimezone": "viewer-local",
"coloringMaxAge": "1y",
"colorNew": {
"r": 255,
"g": 150,
"b": 150
},
"colorOld": {
"r": 120,
"g": 160,
"b": 255
},
"textColorCss": "var(--text-muted)",
"ignoreWhitespace": false,
"gutterSpacingFallbackLength": 5,
"lastShownAuthorDisplay": "initials",
"lastShownDateTimeFormatOptions": "date"
},
"autoCommitMessage": "vault backup: {{date}}"
}

44901
.obsidian/plugins/obsidian-git/main.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
{
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03",
"id": "obsidian-git",
"name": "Git",
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "2.25.0"
}

View file

@ -0,0 +1,562 @@
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.workspace-leaf-content[data-type="git-view"] .button-border {
border: 2px solid var(--interactive-accent);
border-radius: var(--radius-s);
}
.workspace-leaf-content[data-type="git-view"] .view-content {
padding: 0;
}
.workspace-leaf-content[data-type="git-history-view"] .view-content {
padding: 0;
}
.loading > svg {
animation: 2s linear infinite loading;
transform-origin: 50% 50%;
display: inline-block;
}
.obsidian-git-center {
margin: auto;
text-align: center;
width: 50%;
}
.obsidian-git-textarea {
display: block;
margin-left: auto;
margin-right: auto;
}
.obsidian-git-center-button {
display: block;
margin: 20px auto;
}
.tooltip.mod-left {
overflow-wrap: break-word;
}
.tooltip.mod-right {
overflow-wrap: break-word;
}
.git-tools {
display: flex;
margin-left: auto;
}
.git-tools .type {
padding-left: var(--size-2-1);
display: flex;
align-items: center;
justify-content: center;
width: 11px;
}
.git-tools .type[data-type="M"] {
color: orange;
}
.git-tools .type[data-type="D"] {
color: red;
}
.git-tools .buttons {
display: flex;
}
.git-tools .buttons > * {
padding: 0 0;
height: auto;
}
.is-active .git-tools .buttons > * {
color: var(--nav-item-color-active);
}
.git-author {
color: var(--text-accent);
}
.git-date {
color: var(--text-accent);
}
.git-ref {
color: var(--text-accent);
}
.workspace-leaf-content[data-type="diff-view"] .d2h-d-none {
display: none;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper {
text-align: left;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header {
background-color: var(--background-primary);
border-bottom: 1px solid var(--interactive-accent);
font-family: var(--font-monospace);
height: 35px;
padding: 5px 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header,
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
font-size: 14px;
margin-left: auto;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added {
border: 1px solid #b4e2b4;
border-radius: 5px 0 0 5px;
color: #399839;
padding: 2px;
text-align: right;
vertical-align: middle;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted {
border: 1px solid #e9aeae;
border-radius: 0 5px 5px 0;
color: #c33;
margin-left: 1px;
padding: 2px;
text-align: left;
vertical-align: middle;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name-wrapper {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 15px;
width: 100%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name {
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper {
border: 1px solid var(--background-modifier-border);
border-radius: 3px;
margin-bottom: 1em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse {
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border: 1px solid var(--background-modifier-border);
border-radius: 3px;
cursor: pointer;
display: none;
font-size: 12px;
justify-content: flex-end;
padding: 4px 8px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected {
background-color: #c8e1ff;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input {
margin: 0 4px 0 0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table {
border-collapse: collapse;
font-family: Menlo, Consolas, monospace;
font-size: 13px;
width: 100%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff {
width: 100%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff {
overflow-y: hidden;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff {
display: inline-block;
margin-bottom: -8px;
margin-right: -4px;
overflow-x: scroll;
overflow-y: hidden;
width: 50%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line {
padding: 0 8em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
display: inline-block;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 100%;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
padding: 0 4.5em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-ctn {
word-wrap: normal;
background: none;
display: inline-block;
padding: 0;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
vertical-align: middle;
white-space: pre;
width: 100%;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
del {
background-color: #ffb6ba;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
del {
background-color: #8d232881;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins {
border-radius: 0.2em;
display: inline-block;
margin-top: -1px;
text-decoration: none;
vertical-align: middle;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
ins {
background-color: #97f295;
text-align: left;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-code-side-line
ins {
background-color: #1d921996;
text-align: left;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix {
word-wrap: normal;
background: none;
display: inline;
padding: 0;
white-space: pre;
}
.workspace-leaf-content[data-type="diff-view"] .line-num1 {
float: left;
}
.workspace-leaf-content[data-type="diff-view"] .line-num1,
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
padding: 0 0.5em;
text-overflow: ellipsis;
width: 3.5em;
}
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
float: right;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-muted);
cursor: pointer;
display: inline-block;
position: absolute;
text-align: right;
width: 7.5em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after {
content: "\200b";
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-muted);
cursor: pointer;
display: inline-block;
overflow: hidden;
padding: 0 0.5em;
position: absolute;
text-align: right;
text-overflow: ellipsis;
width: 4em;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-tbody tr {
position: relative;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after {
content: "\200b";
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder,
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber,
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
direction: rtl;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del {
background-color: #fee8e9;
border-color: #e9aeae;
}
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
background-color: #dfd;
border-color: #b4e2b4;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del {
background-color: #521b1d83;
border-color: #691d1d73;
}
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
background-color: rgba(30, 71, 30, 0.5);
border-color: #13501381;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-info {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
color: var(--text-normal);
}
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-del.d2h-change {
background-color: #fdf2d0;
}
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-del.d2h-change {
background-color: #55492480;
}
.theme-light
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-ins.d2h-change {
background-color: #ded;
}
.theme-dark
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-diff
.d2h-ins.d2h-change {
background-color: rgba(37, 78, 37, 0.418);
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper {
margin-bottom: 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a {
color: #3572b0;
text-decoration: none;
}
.workspace-leaf-content[data-type="diff-view"]
.d2h-file-list-wrapper
a:visited {
color: #3572b0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header {
text-align: left;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title {
font-weight: 700;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
text-align: left;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list {
display: block;
list-style: none;
margin: 0;
padding: 0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li {
border-bottom: 1px solid var(--background-modifier-border);
margin: 0;
padding: 5px 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child {
border-bottom: none;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch {
cursor: pointer;
display: none;
font-size: 10px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-icon {
fill: currentColor;
margin-right: 10px;
vertical-align: middle;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted {
color: #c33;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-added {
color: #399839;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-changed {
color: #d0b44c;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-moved {
color: #3572b0;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-tag {
background-color: var(--background-primary);
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 10px;
margin-left: 5px;
padding: 0 2px;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag {
border: 2px solid #c33;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag {
border: 1px solid #399839;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag {
border: 1px solid #d0b44c;
}
.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag {
border: 1px solid #3572b0;
}
/* ====================== Line Authoring Information ====================== */
.cm-gutterElement.obs-git-blame-gutter {
/* Add background color to spacing inbetween and around the gutter for better aesthetics */
border-width: 0px 2px 0.2px 2px;
border-style: solid;
border-color: var(--background-secondary);
background-color: var(--background-secondary);
}
.cm-gutterElement.obs-git-blame-gutter > div,
.line-author-settings-preview {
/* delegate text color to settings */
color: var(--obs-git-gutter-text);
font-family: monospace;
height: 100%; /* ensure, that age-based background color occupies entire parent */
text-align: right;
padding: 0px 6px 0px 6px;
white-space: pre; /* Keep spaces and do not collapse them. */
}
@media (max-width: 800px) {
/* hide git blame gutter not to superpose text */
.cm-gutterElement.obs-git-blame-gutter {
display: none;
}
}

5
.obsidian/switcher.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"showExistingOnly": false,
"showAttachments": false,
"showAllFileTypes": false
}

3
.obsidian/templates.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"folder": "_templates"
}

12
.obsidian/types.json vendored Normal file
View file

@ -0,0 +1,12 @@
{
"types": {
"aliases": "aliases",
"cssclasses": "multitext",
"tags": "tags",
"purchased_on": "date",
"started_on": "date",
"beaten_on": "date",
"completed_on": "date",
"mastered_on": "date"
}
}

172
.obsidian/workspace.json vendored Normal file
View file

@ -0,0 +1,172 @@
{
"main": {
"id": "7b464b08e448ff2a",
"type": "split",
"children": [
{
"id": "5be8951f34ddc90b",
"type": "tabs",
"children": [
{
"id": "855252c9d2827734",
"type": "leaf",
"state": {
"type": "empty",
"state": {}
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "6c2645475f385225",
"type": "split",
"children": [
{
"id": "72ef0c1a86fc9a9e",
"type": "tabs",
"children": [
{
"id": "9f641dab92fcfe98",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
}
}
},
{
"id": "f0e276074c73c2b9",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
}
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "0ec8e9c274da540e",
"type": "split",
"children": [
{
"id": "4bc49bc6436a36fb",
"type": "tabs",
"children": [
{
"id": "8fcfa07c36026e0a",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"linksCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "9c4d2e464866c651",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "c6e0aeb0500d45e2",
"type": "leaf",
"state": {
"type": "outline",
"state": {}
}
},
{
"id": "cb2cc248cad816e2",
"type": "leaf",
"state": {
"type": "all-properties",
"state": {
"sortOrder": "frequency",
"showSearch": false,
"searchQuery": ""
}
}
}
],
"currentTab": 1
}
],
"direction": "horizontal",
"width": 300,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
"switcher:Open quick switcher": false,
"templates:Insert template": false,
"command-palette:Open command palette": false,
"random-note:Open random note": false
}
},
"active": "855252c9d2827734",
"lastOpenFiles": [
"games/puzzle-pirates-dark-seas.md",
"games/dracula-3-the-path-of-the-dragon.md",
"games/a-good-snowman-is-hard-to-build.md",
"games/puzzle-pirates.md",
"games/mass-effect-2.md",
"games/10-000-000.md",
"games/Untitled.md",
"_site/games/Untitled.json",
"_site/games/Untitled.html",
"games/a-story-about-my-uncle.md",
"list-games.md",
"_templates/game.md",
"_templates",
"_archetypes",
"_site/_static/styles/base.css",
"_site/_static/scripting/sort.js",
"_site/_static/scripting/installSortOnLoad.js",
"_site/_static/fonts/ZillaSlab.license.txt",
"_site/_static/fonts/ZillaSlab.css",
"_site/_static/fonts/ZillaSlab-Regular.woff2",
"games/aperture-desk-job.md",
"games/another-perspective.md",
"games/deadlock.md",
"games/intravenous.md",
"games/the-jackbox-megapicker.md",
"games/anonymous-code.md",
"games/heretic-s-fork.md",
"games/appgamekit-classic.md",
"games/marble-it-up-ultra.md",
"games/battlerite-public-test.md",
"games/apotheon-arena.md",
"games/blender.md",
"games/axis-game-factory-s-agfpro-3-0.md",
"games/planetside-2-test.md",
"games/borderlands-goty-enhanced.md",
"games/mass-effect-2-2010-edition.md"
]
}

15
.vscode/settings.json vendored
View file

@ -1,16 +1,15 @@
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
".vscode": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/.git": true,
"**/.gitignore": true,
"_*": true,
"LICENSE-CODE.txt": true,
"**/.hg": true,
"**/.svn": true,
"**/CVS": true,
"**/Thumbs.db": true,
"deno.json": true,
"deno.lock": true,
".vscode": true,
"LICENSE-CODE.txt": true
}
}

View file

@ -2,9 +2,10 @@ import {default as lume} from "lume/mod.ts";
import {default as jsx} from "lume/plugins/jsx.ts"
import {default as feed} from "lume/plugins/feed.ts"
import fileData from "./_plugins/fileData.ts"
import Site from "lume/core/site.ts";
const site = lume({
const site: Site = lume({
prettyUrls: false,
})
@ -41,7 +42,7 @@ site.use(fileData({
}))
site.use(fileData({
query: "list-games",
urlizer(data) {
urlizer(_data) {
return "/games/index.json"
},
contentizer(data) {

View file

@ -1,8 +1,9 @@
import { loadSync as loadEnv } from "dotenv/mod.ts";
import site from "../_config.ts"
import {default as site} from "../_config.ts"
import {formatDateIso} from "../_utils/date.ts"
import {GameData, GameIdentifier} from "../_utils/game.ts"
import {GameData, GameIdentifier, GamePage} from "../_utils/game.ts"
import {stringifyYaml} from "lume/cms/deps/std.ts"
import {Progress} from "../_utils/progress.ts"
/* This is arguably one of the worst scripts I've ever written. */
@ -28,6 +29,10 @@ type SteamGame = {
const env = loadEnv()
console.debug("Building the whole site...")
await site.build()
const apiKey = env["STEAM_API_KEY"]
const steamId = env["STEAM_ID"]
@ -36,11 +41,12 @@ console.debug("Creating reviewed games indexes...")
const appIdToPage: {[appId: string]: GameData | null} = {}
const filenameToAppId: {[filename: string]: string | null} = {}
for(const _page of site.search.pages("game")) {
const page = _page as GameData
const file: string = page.sourcePath
const identifiers: GameIdentifier[] = page.data.identifiers.filter((i: GameIdentifier) => i.type === "steam")
for(const data of site.search.pages<GameData>("game")) {
const file: string = data.page.sourcePath
const identifiers: GameIdentifier[] = data.page.data?.identifiers?.filter?.((i: GameIdentifier) => i.type === "steam") ?? []
console.debug("Detected page at", file, "with Steam identifiers", identifiers)
let nullify: boolean = false
for(const identifier of identifiers) {
const appId = identifier.appid
@ -55,11 +61,13 @@ for(const _page of site.search.pages("game")) {
}
for(const identifier of identifiers) {
const appId = identifier.appid
appIdToPage[appId] = nullify ? null : page
appIdToPage[appId] = nullify ? null : data
filenameToAppId[file] = nullify ? null : appId
}
}
console.debug("Index contains", Object.keys(filenameToAppId).length, "games.")
console.debug("Fetching list of owned games via IPlayerService/GetOwnedGames/v1...")
const gamesResponse = await fetch(`http://api.steampowered.com/IPlayerService/GetOwnedGames/v1/?key=${apiKey}&steamid=${steamId}&include_appinfo=true&include_extended_appinfo=true&include_played_free_games=true`)
const gamesData = await gamesResponse.json()
@ -69,7 +77,7 @@ console.debug(`Detected ${games.length} games.`)
for(const game of games) {
const appId = `${game.appid}`
const page = appIdToPage[appId]
let fullName = page?.page.sourcePath
let fullName = page?.page.sourcePath.replace(/^[/]/, "")
if(page === null) {
continue
}
@ -90,18 +98,17 @@ for(const game of games) {
}
const contents = {
name: page?.name ?? game?.name,
name_sort: page?.name_sort ?? game?.sort_as,
rating: page?.rating,
content: page?.content,
active: page?.active,
progress: page?.progress,
name: page?.name ?? game?.name ?? "",
name_sort: page?.name_sort ?? game?.sort_as ?? "",
rating: page?.rating ?? 0,
active: page?.active ?? false,
progress: page?.progress ?? Progress.Unset,
hours_played: Math.max(page?.hours_played ?? 0, Math.round((game?.playtime_forever ?? 0) / 60)),
purchased_on: page?.purchased_on,
started_on: page?.started_on,
beaten_on: page?.beaten_on,
completed_on: page?.completed_on,
mastered_on: page?.mastered_on,
purchased_on: page?.purchased_on ?? NaN,
started_on: page?.started_on ?? NaN,
beaten_on: page?.beaten_on ?? NaN,
completed_on: page?.completed_on ?? NaN,
mastered_on: page?.mastered_on ?? NaN,
identifiers: [
...(page?.identifiers?.filter(i => i.type !== "steam") ?? []),
{
@ -113,19 +120,14 @@ for(const game of games) {
],
}
Object.entries(contents).forEach(([key, value]) => {
if(value === undefined) {
delete contents[key]
}
})
const fsfile = await Deno.open(fullName!, {read: true, write: true})
const encoder = new TextEncoder();
const writer = fsfile.writable.getWriter()
await writer.write(
encoder.encode(`---\n${stringifyYaml(contents)}\n---\n`)
)
await writer.write(
encoder.encode(page?.content ?? "")
)
fsfile.close()
}

14
_templates/game.md Normal file
View file

@ -0,0 +1,14 @@
---
name: ''
name_sort: ''
rating: 0
active: false
progress: ''
hours_played: 0
purchased_on: .nan
started_on: .nan
beaten_on: .nan
completed_on: .nan
mastered_on: .nan
---

View file

@ -1,8 +1,8 @@
import { GlobalData } from "./site.ts";
export function formatDateIso(date?: Date): string {
if(date === undefined) return ""
date = new Date(date)
export function formatDateIso(date: Date | null | undefined | ""): string {
date = new Date(date as any)
if (Number.isNaN(date.getDate())) return ""
return `${date.getFullYear().toString().padStart(4, "0")}-${(date.getMonth() + 1).toString().padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")}`
}