From 4ff8a61c21dc41e7b359570161075e90928193a0 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Tue, 10 Dec 2024 21:38:41 -0500 Subject: [PATCH] Site is building. Let 'er rip. --- default.env | 8 +- dist/build.js | 27 +++++- dist/build.js.map | 2 +- dist/db/index.js | 6 +- dist/db/index.js.map | 2 +- dist/generate.js | 14 ++-- dist/generate.js.map | 2 +- dist/geocode/index.js | 9 +- dist/geocode/index.js.map | 2 +- less/bluesky.svg | 4 + less/github.svg | 1 + less/style.less | 153 ++++++++++++++++++++++++++++++++++ less/vimeo.svg | 19 +++++ package-lock.json | 171 ++++++++++++++++++++++++++++++++++++++ package.json | 1 + scripts/all.sh | 3 +- scripts/build.sh | 12 ++- scripts/generate.sh | 4 +- scripts/img.sh | 4 + scripts/server.sh | 8 ++ scripts/upload.sh | 7 ++ sql/setup.sql | 1 + src/build.ts | 29 ++++++- src/db/index.ts | 8 +- src/generate.ts | 18 ++-- src/geocode/index.ts | 14 ++-- views/index.hbs | 2 +- views/partials/body.hbs | 7 ++ views/partials/foot.hbs | 6 +- views/partials/head.hbs | 27 +++++- views/partials/img.hbs | 3 - views/partials/photo.hbs | 4 + 32 files changed, 523 insertions(+), 55 deletions(-) create mode 100644 less/bluesky.svg create mode 100644 less/github.svg create mode 100644 less/style.less create mode 100644 less/vimeo.svg create mode 100644 scripts/server.sh create mode 100644 scripts/upload.sh create mode 100644 views/partials/body.hbs delete mode 100644 views/partials/img.hbs create mode 100644 views/partials/photo.hbs diff --git a/default.env b/default.env index 4a2a988..ae467a6 100644 --- a/default.env +++ b/default.env @@ -6,7 +6,11 @@ S3_ACCESS_KEY="" S3_ACCESS_SECRET="" S3_BUCKET="" S3_ENDPOINT="" -UMAMI="" +UMAMI_ID="" +UMAMI_URL="" DB="data/site.db" ARTIST="Unknown" -GEOCODE_API_KEY="" \ No newline at end of file +GEOCODE_API_KEY="" +TITLE="" +H1="" +DEST="remote:/dir/" \ No newline at end of file diff --git a/dist/build.js b/dist/build.js index be69751..9e720c4 100644 --- a/dist/build.js +++ b/dist/build.js @@ -2,7 +2,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); require("dotenv/config"); const log_1 = require("./log"); +const promises_1 = require("fs/promises"); +const path_1 = require("path"); const db_1 = require("./db"); +const env_1 = require("./env"); const templates_1 = require("./templates"); class Build { constructor() { @@ -10,13 +13,35 @@ class Build { this.log.info(`Building site: ${new Date()}`); this.tmpl = new templates_1.Templates(); this.db = new db_1.DB(); + this.www = (0, env_1.envString)('WWW', './www'); this.main(); } async main() { let photos; + let html; + let data = { + title: (0, env_1.envString)('TITLE', 'Unknown'), + h1: (0, env_1.envString)('H1', 'Unknown'), + artist: (0, env_1.envString)('ARTIST', 'Unknown'), + umami_url: (0, env_1.envString)('UMAMI_URL', null), + umami_id: (0, env_1.envString)('UMAMI_ID', null), + year: (new Date()).getFullYear() + }; + let home = (0, path_1.join)(this.www, 'index.html'); await this.tmpl.build(); photos = await this.db.getAll(); - await this.tmpl.render('index', { photos }); + photos = photos.map((photo) => { + photo.thumbHeight = Math.round((420.0 / photo.width) * photo.height) + 4; + return photo; + }); + html = await this.tmpl.render('index', { ...data, photos }); + try { + await (0, promises_1.writeFile)(home, html, 'utf8'); + this.log.info(`Wrote ${home}`); + } + catch (err) { + this.log.error(`Error writing home page`, err); + } } } new Build(); diff --git a/dist/build.js.map b/dist/build.js.map index a810cdf..122f1d7 100644 --- a/dist/build.js.map +++ b/dist/build.js.map @@ -1 +1 @@ -{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AAEvB,+BAAkC;AAIlC,6BAA0B;AAE1B,2CAAwC;AAExC,MAAM,KAAK;IAKV;QACC,IAAI,CAAC,GAAG,GAAG,IAAA,eAAS,EAAC,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,IA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ist/db/index.js index 9bc27a8..fa40d9b 100644 --- a/dist/db/index.js +++ b/dist/db/index.js @@ -13,7 +13,7 @@ class DB { this.db.run('PRAGMA journal_mode = WAL;'); this.log.info(`DB: ${databaseFile}`); } - async run(query, args = null) { + async run(query, args = []) { return new Promise((resolve, reject) => { return this.db.run(query, args, (err, rows) => { if (err) @@ -22,7 +22,7 @@ class DB { }); }); } - async all(query, args = null) { + async all(query, args = []) { return new Promise((resolve, reject) => { return this.db.all(query, args, (err, rows) => { if (err) @@ -89,7 +89,7 @@ class DB { return exists; } async getAll() { - const query = `SELECT * FROM photos;`; + const query = `SELECT * FROM photos ORDER BY score ASC, created DESC;`; let rows = []; try { rows = await this.all(query); diff --git a/dist/db/index.js.map b/dist/db/index.js.map index 4ed5c01..0847218 100644 --- a/dist/db/index.js.map +++ b/dist/db/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AAEvB,gCAAmC;AAEnC,qCAAmC;AACnC,gCAAmC;AA2BnC,MAAa,EAAE;IAId;QACC,MAAM,YAAY,GAAY,IAAA,eAAS,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAC9D,IAAI,CAAC,GAAG,GAAG,IAAA,eAAS,EAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,EAAE,GAAG,IAAI,kBAAQ,CAAC,YAAY,CAAC,CAAC;QACrC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAE,4BAA4B,CAAC,CAAC;QAC3C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,YAAY,EAAE,CAAC,CAAC;IACtC,CAAC;IAEO,KAAK,CAAC,GAAG,CAAE,KAAc,EAAE,OAAe,IAAI;QACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAkB,EAAE,MAAiB,EAAE,EAAE;YAC5D,OAAO,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,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AAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,GAAG,GAAG;gBACL,QAAQ,EAAG,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ;gBAC3B,SAAS,EAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;aAC7B,CAAA;QACF,CAAC;QAED,OAAO,GAAG,CAAC;IACZ,CAAC;CAED;AAhID,gBAgIC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/generate.js b/dist/generate.js index c987032..f9f0fb4 100644 --- a/dist/generate.js +++ b/dist/generate.js @@ -35,17 +35,11 @@ class Generate { this.log.info(`Generating site: ${new Date()}`); this.db = new db_1.DB(); this.s3 = new files3_1.Files3((0, env_1.envString)('S3_BUCKET', 's3bucket'), true); - this.geocode = new geocode_1.Geocode(); + this.geocode = new geocode_1.Geocode(this.db); this.generate(); this.score = args.score; } async generate() { - //check version - //sync - await this.checkInbox(); - //validate - } - async checkInbox() { let inbox; let images; let filename; @@ -108,6 +102,7 @@ class Generate { } try { await this.db.create(photo); + this.log.info(JSON.stringify(photo, null, '\t')); } catch (err) { this.log.error(`Error inserting photo into database`, err); @@ -147,7 +142,7 @@ class Generate { const filePath = await this.mktemp('photosite_exif'); const created = moment_1.default.unix(photo.created / 1000).format('YYYY:MM:DD HH:mm:ss'); let exif = `-Artist=${this.artist} --ImageTitle=${photo.name} +-Title=${photo.description} -ImageUniqueId=${photo.id} -DateTimeOriginal=${created}`; const iso = photo.filmstock.split(' ').filter(el => this.isOnlyNumbers(el)).map(el => parseInt(el)).filter(el => el > 25); @@ -247,6 +242,7 @@ class Generate { return { id: (0, uuid_1.v4)(), name: (0, path_1.basename)(image), + description: meta.description, original: meta.original, hash, width: dimensions.width, @@ -270,7 +266,7 @@ class Generate { const name = (0, path_1.basename)(image); const dest = (0, path_1.join)(this.photos, name); try { - //await rename(image, dest); + await (0, promises_1.rename)(image, dest); this.log.info(`Moved image ${name} to outbox`); } catch (err) { diff --git a/dist/generate.js.map b/dist/generate.js.map index 4bea359..896c29b 100644 --- a/dist/generate.js.map +++ b/dist/generate.js.map @@ -1 +1 @@ -{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":";;;;;AAAA,yBAAuB;AACvB,+BAAkC;AAElC,0CAA6E;AAC7E,+BAAsC;AACtC,+BAAiC;AACjC,+BAAkC;AAClC,mCAAqC;AACrC,2BAA4B;AAC5B,oDAA4B;AAC5B,uCAA0C;AAC1C,mCAAgC;AAChC,iCAAgC;AAChC,qCAAiC;AACjC,+BAAkC;AAClC,6BAA0B;AAE1B,uCAAoC;AAEpC,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;AAahD,MAAM,QAAQ;IAYb;QATQ,UAAK,GAAY,IAAA,eAAS,EAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC1D,WAAM,GAAY,IAAA,eAAS,EAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QAC5D,WAAM,GAAY,IAAA,eAAS,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAIjD,QAAG,GAAY,IAAA,WAAM,GAAE,CAAC;QAI/B,IAAI,CAAC,GAAG,GAAG,IAAA,eAAS,EAAC,UAAU,CAAC,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,yBAAc,CAAC;YACjC,WAAW,EAAE,iBAAiB;SAC9B,CAAC,CAAC;QACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAG,KAAK,EAAE,OAAO,EAAG,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;QAC5F,MAAM,IAAI,GAAS,MAAM,CAAC,UAAU,EAAE,CAAC;QAEvC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,EAAE,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js @@ -9,13 +9,12 @@ const url_1 = require("url"); const node_fetch_1 = __importDefault(require("node-fetch")); const log_1 = require("../log"); const env_1 = require("../env"); -const db_1 = require("../db"); class Geocode { - constructor() { + constructor(db) { this.log = (0, log_1.createLog)('geocode'); this.baseUrl = 'https://geocode.maps.co/search'; this.apiKey = (0, env_1.envString)('GEOCODE_API_KEY', null); - this.db = new db_1.DB(); + this.db = db; } async query(location) { let res = await this.db.getLocation(location); @@ -47,6 +46,10 @@ class Geocode { this.log.error('Error getting response', err); return null; } + if (response.status !== 200) { + this.log.warn(`Invalid response from API [${response.status}]`); + return null; + } try { json = await response.json(); } diff --git a/dist/geocode/index.js.map b/dist/geocode/index.js.map index 102133e..594c94e 100644 --- a/dist/geocode/index.js.map +++ b/dist/geocode/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/geocode/index.ts"],"names":[],"mappings":";;;;;;AAAA,yBAAuB;AAEvB,6BAA0B;AAC1B,4DAA+B;AAG/B,gCAAmC;AAEnC,gCAAmC;AACnC,8BAA2B;AAG3B,MAAa,OAAO;IAMnB;QALQ,QAAG,GAAY,IAAA,eAAS,EAAC,SAAS,CAAC,CAAC;QACpC,YAAO,GAAY,gCAAgC,CAAC;QACpD,WAAM,GAAY,IAAA,eAAS,EAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;QACrD,OAAE,GAAQ,IAAI,OAAE,EAAE,CAAC;IAI3B,CAAC;IAEM,KAAK,CAAC,KAAK,CAAE,QAAiB;QACpC,IAAI,GAAG,GAAY,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACvD,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YAClB,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAEO,QAAQ,CAAE,GAAS;QAC1B,OAAO;YACN,QAAQ,EA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BAAoB,EAAE,GAAG,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QACb,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAE7B,MAAM,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAE3C,OAAO,GAAG,CAAC;IAEZ,CAAC;IAEO,KAAK,CAAC,KAAK,CAAE,EAAW;QAC/B,OAAO,IAAI,OAAO,CAAE,CAAC,OAAkB,EAAE,MAAiB,EAAE,EAAE;YAC7D,OAAO,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACJ,CAAC;IAEO,KAAK,CAAE,QAAiB,EAAE,QAAiB,EAAE,SAAkB;IAEvE,CAAC;CACD;AA/ED,0BA+EC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/less/bluesky.svg b/less/bluesky.svg new file mode 100644 index 0000000..45e2995 --- /dev/null +++ b/less/bluesky.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/less/github.svg b/less/github.svg new file mode 100644 index 0000000..d5e6491 --- /dev/null +++ b/less/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/less/style.less b/less/style.less new file mode 100644 index 0000000..f63bcaf --- /dev/null +++ b/less/style.less @@ -0,0 +1,153 @@ +* { + font-family: Arial, Helvetica Neue, Helvetica, sans-serif; + text-align: center; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +:hover { + color: #080810; +} + +a { + text-decoration: none; + +} +html { + height: 100%; + background: #f3f1f1 +} + +body { + min-height: 100%; +} + +body,html { + padding: 0; + margin: 0; + height: auto!important; + height: 100%; + min-height: 100%; + position: relative; +} + +#title{ + width: 320px; + margin: 0 auto; + position: relative; +} + +h1 { + font-size: 43px; + line-height: 70px; + font-weight: 200; + text-align: center; + cursor: default; + color: #fff; + text-shadow: 1px 1px 3px #969696; + margin-bottom: 15px; + + &:hover{ + color: #fff; + } + + a { + display: block; + text-align: center; + cursor: pointer; + text-rendering: geometricPrecision; + color: #fff; + &:hover{ + color: transparent; + } + } + &:focus:before, + &:hover:before { + content: "hi@"; + position: absolute; + left: -38px; + + } + &:focus:after, + &:hover:after { + content: ".com"; + position: absolute; + + } +} + +header { + ul { + list-style: none; + display: flex; + align-items: center; + justify-content: center; + width: 320px; + margin: 15px auto; + li { + padding: 0 10px; + a { + color: #fff; + font-weight: bold; + font-size: 24px; + text-shadow: 1px 1px 3px #969696; + &:hover { + color: #fff; + } + img { + max-height: 35px; + height: 35px; + width: auto; + -webkit-filter: drop-shadow( 1px 1px 3px #969696); + filter: drop-shadow( 1px 1px 3px #969696); + } + } + } + } +} + +footer { + color: #fff; + text-shadow: 1px 1px 3px #969696; + font-weight: bold; + margin-top: 50px; + margin-bottom: 30px; + &:hover { + color: #fff; + } +} + +.copyleft { + display: inline-block; + transform: rotate(180deg); +} + +@media (max-width: 420px) { + #main { + .container { + &:focus, + &:hover { + font-size: 30px !important + } + &:focus:before, + &:hover:before { + left: 20px !important + } + } + } +} + +#photos{ + display: flex; + flex-direction: column; + flex-wrap: wrap; + align-content: center; + a { + display: block; + width: 420px; + } +} \ No newline at end of file diff --git a/less/vimeo.svg b/less/vimeo.svg new file mode 100644 index 0000000..79e2447 --- /dev/null +++ b/less/vimeo.svg @@ -0,0 +1,19 @@ + + + + + vimeo [#144] + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b87377c..9ba130b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "handlebars": "^4.7.8", "handlebars-helpers": "^0.10.0", "image-size": "^1.1.1", + "less": "^4.2.1", "lodash": "^4.17.21", "mime-types": "^2.1.35", "moment": "^2.30.1", @@ -1337,6 +1338,18 @@ "license": "ISC", "optional": true }, + "node_modules/copy-anything": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz", + "integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==", + "license": "MIT", + "dependencies": { + "is-what": "^3.14.1" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -1592,6 +1605,19 @@ "license": "MIT", "optional": true }, + "node_modules/errno": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", + "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", + "license": "MIT", + "optional": true, + "dependencies": { + "prr": "~1.0.1" + }, + "bin": { + "errno": "cli.js" + } + }, "node_modules/error-symbol": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/error-symbol/-/error-symbol-0.1.0.tgz", @@ -2839,6 +2865,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-what": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz", + "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==", + "license": "MIT" + }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -2919,6 +2951,52 @@ "node": ">=0.10.0" } }, + "node_modules/less": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/less/-/less-4.2.1.tgz", + "integrity": "sha512-CasaJidTIhWmjcqv0Uj5vccMI7pJgfD9lMkKtlnTHAdJdYK/7l8pM9tumLyJ0zhbD4KJLo/YvTj+xznQd5NBhg==", + "license": "Apache-2.0", + "dependencies": { + "copy-anything": "^2.0.1", + "parse-node-version": "^1.0.1", + "tslib": "^2.3.0" + }, + "bin": { + "lessc": "bin/lessc" + }, + "engines": { + "node": ">=6" + }, + "optionalDependencies": { + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "image-size": "~0.5.0", + "make-dir": "^2.1.0", + "mime": "^1.4.1", + "needle": "^3.1.0", + "source-map": "~0.6.0" + } + }, + "node_modules/less/node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC", + "optional": true + }, + "node_modules/less/node_modules/image-size": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", + "integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==", + "license": "MIT", + "optional": true, + "bin": { + "image-size": "bin/image-size.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -3030,6 +3108,30 @@ "node": ">=10" } }, + "node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "license": "MIT", + "optional": true, + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", + "optional": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/make-fetch-happen": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz", @@ -3141,6 +3243,19 @@ "node": ">=0.10.0" } }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "optional": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -3428,6 +3543,30 @@ "deprecated": "This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.", "license": "ISC" }, + "node_modules/needle": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/needle/-/needle-3.3.1.tgz", + "integrity": "sha512-6k0YULvhpw+RoLNiQCRKOl09Rv1dPLr8hHnVjHqdolKwDrdNyk+Hmrthi4lIGPPz3r39dLx0hsF5s40sZ3Us4Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.3", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" + } + }, + "node_modules/needle/node_modules/sax": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", + "license": "ISC", + "optional": true + }, "node_modules/negotiator": { "version": "0.6.4", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", @@ -3702,6 +3841,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse-node-version": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", + "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -3727,6 +3875,16 @@ "integrity": "sha512-oQiRXTFeL4KY2IAVuBsaokdEw4+WpKUu8qr/bFyKEpaqpcaflo3M/v5AORXbKxd1liRNtoOEfAV5FRjzrr1jJA==", "license": "MIT" }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, "node_modules/posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -3798,6 +3956,13 @@ "node": ">=10" } }, + "node_modules/prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", + "license": "MIT", + "optional": true + }, "node_modules/pump": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", @@ -4942,6 +5107,12 @@ "node": ">= 14.0.0" } }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", diff --git a/package.json b/package.json index 8c698b1..49e62b6 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "handlebars": "^4.7.8", "handlebars-helpers": "^0.10.0", "image-size": "^1.1.1", + "less": "^4.2.1", "lodash": "^4.17.21", "mime-types": "^2.1.35", "moment": "^2.30.1", diff --git a/scripts/all.sh b/scripts/all.sh index ffda806..222dd60 100644 --- a/scripts/all.sh +++ b/scripts/all.sh @@ -3,4 +3,5 @@ set -e bash scripts/generate.sh -bash scripts/build.sh \ No newline at end of file +bash scripts/build.sh +bash scripts/upload.sh \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index 77ef505..4eea8fb 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,4 +2,14 @@ set -e -node dist/build \ No newline at end of file +source .env + +mkdir -p "${WWW}" +mkdir -p "${WWW}/css" + +node dist/build + + +./node_modules/.bin/lessc less/style.less www/css/style.css + +cp less/*.svg "${WWW}/css/" \ No newline at end of file diff --git a/scripts/generate.sh b/scripts/generate.sh index c8f3272..f869deb 100644 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -4,9 +4,9 @@ set -e source .env -rm -rf data/site.db +#rm -rf data/site.db mkdir -p data -mkdir -p www +mkdir -p "${WWW}" cat "sql/setup.sql" | sqlite3 "${DB}" diff --git a/scripts/img.sh b/scripts/img.sh index 03617f1..2dba981 100644 --- a/scripts/img.sh +++ b/scripts/img.sh @@ -28,5 +28,9 @@ for sizeRaw in ${SIZES[@]}; do name=${name%.*} output="${WWW}/img/${ID}_${sizeName}.jpg" img "${1}" "${output}" "${size}" + if [[ -f "${WWW}/img/${ID}_${sizeName}-1.jpg" ]]; then + mv "${WWW}/img/${ID}_${sizeName}-0.jpg" "${WWW}/img/${ID}_${sizeName}.jpg" + rm "${WWW}/img/${ID}_${sizeName}-1.jpg" + fi exiftool -overwrite_original -@ "${EXIF}" "${output}" done diff --git a/scripts/server.sh b/scripts/server.sh new file mode 100644 index 0000000..c7950a9 --- /dev/null +++ b/scripts/server.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +source .env + +cd "${WWW}" +python3 -m http.server \ No newline at end of file diff --git a/scripts/upload.sh b/scripts/upload.sh new file mode 100644 index 0000000..c0923bd --- /dev/null +++ b/scripts/upload.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +source .env + +rsync -rzdv "${WWW}/" "${DEST}" \ No newline at end of file diff --git a/sql/setup.sql b/sql/setup.sql index 39f5c86..70d3cbc 100644 --- a/sql/setup.sql +++ b/sql/setup.sql @@ -1,6 +1,7 @@ CREATE TABLE IF NOT EXISTS photos ( id TEXT PRIMARY KEY, name TEXT UNIQUE, + description TEXT, original TEXT UNIQUE, hash TEXT UNIQUE, width INTEGER, diff --git a/src/build.ts b/src/build.ts index 7e1647c..d344ad2 100644 --- a/src/build.ts +++ b/src/build.ts @@ -3,9 +3,11 @@ import 'dotenv/config'; import { createLog } from './log'; import type { Logger } from 'winston'; import { readFile, writeFile } from 'fs/promises'; +import { join } from 'path'; import { DB } from './db'; import type { Photo } from './db'; +import { envString } from './env'; import { Templates } from './templates'; class Build { @@ -13,20 +15,45 @@ class Build { private tmpl : Templates; private db : DB; + private www : string; + constructor () { this.log = createLog('build'); this.log.info(`Building site: ${new Date()}`); this.tmpl = new Templates(); this.db = new DB(); + this.www = envString('WWW', './www'); this.main(); } private async main () { let photos : Photo[]; + let html : string; + let data : any = { + title : envString('TITLE', 'Unknown'), + h1 : envString('H1', 'Unknown'), + artist : envString('ARTIST', 'Unknown'), + umami_url : envString('UMAMI_URL', null), + umami_id : envString('UMAMI_ID', null), + year : (new Date()).getFullYear() + }; + let home : string = join(this.www, 'index.html'); + await this.tmpl.build(); photos = await this.db.getAll(); - await this.tmpl.render('index', { photos }); + photos = photos.map((photo : Photo) => { + photo.thumbHeight = Math.round((420.0 / photo.width) * photo.height) + 4; + return photo; + }) + html = await this.tmpl.render('index', { ...data, photos }); + + try { + await writeFile(home, html, 'utf8'); + this.log.info(`Wrote ${home}`); + } catch (err) { + this.log.error(`Error writing home page`, err); + } } } diff --git a/src/db/index.ts b/src/db/index.ts index 6d3fd58..962bcf0 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -13,10 +13,12 @@ interface LatLng { interface Photo { id : string; name : string; + description : string; original? : string; hash : string; width : number; height : number; + thumbHeight? : number; format? : string; filmstock? : string; location? : string; @@ -42,7 +44,7 @@ export class DB { this.log.info(`DB: ${databaseFile}`); } - private async run (query : string, args : any[] = null) { + private async run (query : string, args : any[] = []) { return new Promise((resolve : Function, reject : Function) => { return this.db.run(query, args, (err : Error, rows : any[]) => { if (err) return reject(err); @@ -51,7 +53,7 @@ export class DB { }); } - private async all (query : string, args : any[] = null) : Promise { + private async all (query : string, args : any[] = []) : Promise { return new Promise((resolve : Function, reject : Function) => { return this.db.all(query, args, (err : Error, rows : any[]) => { if (err) return reject(err); @@ -119,7 +121,7 @@ export class DB { } public async getAll () : Promise { - const query : string = `SELECT * FROM photos;`; + const query : string = `SELECT * FROM photos ORDER BY score ASC, created DESC;`; let rows : Photo[] = []; try { rows = await this.all(query); diff --git a/src/generate.ts b/src/generate.ts index 0f42d4c..7bf2a7a 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -53,20 +53,12 @@ class Generate { this.log.info(`Generating site: ${new Date()}`); this.db = new DB(); this.s3 = new Files3(envString('S3_BUCKET', 's3bucket'), true); - this.geocode = new Geocode(); + this.geocode = new Geocode(this.db); this.generate(); this.score = args.score; } - private async generate () { - //check version - - //sync - await this.checkInbox(); - //validate - } - - private async checkInbox () { + private async generate () { let inbox : string; let images : string[]; let filename : string; @@ -138,6 +130,7 @@ class Generate { try { await this.db.create(photo); + this.log.info(JSON.stringify(photo, null, '\t')); } catch (err) { this.log.error(`Error inserting photo into database`, err); continue; @@ -178,7 +171,7 @@ class Generate { const filePath : string = await this.mktemp('photosite_exif'); const created : string = moment.unix(photo.created / 1000).format('YYYY:MM:DD HH:mm:ss'); let exif : string = `-Artist=${this.artist} --ImageTitle=${photo.name} +-Title=${photo.description} -ImageUniqueId=${photo.id} -DateTimeOriginal=${created}` const iso : number[] = photo.filmstock.split(' ').filter(el => this.isOnlyNumbers(el)).map(el => parseInt(el)).filter(el => el > 25); @@ -287,6 +280,7 @@ class Generate { return { id : uuid(), name : basename(image), + description : meta.description, original: meta.original, hash, width : dimensions.width, @@ -313,7 +307,7 @@ class Generate { const dest : string = join(this.photos, name); try { - //await rename(image, dest); + await rename(image, dest); this.log.info(`Moved image ${name} to outbox`); } catch (err) { this.log.error(`Error moving image`, err); diff --git a/src/geocode/index.ts b/src/geocode/index.ts index f3dc60f..0068993 100644 --- a/src/geocode/index.ts +++ b/src/geocode/index.ts @@ -7,17 +7,16 @@ import type { Response } from 'node-fetch'; import { createLog } from '../log'; import type { Logger } from 'winston'; import { envString } from '../env'; -import { DB } from '../db'; -import type { LatLng } from '../db'; +import type { DB, LatLng } from '../db'; export class Geocode { private log : Logger = createLog('geocode'); private baseUrl : string = 'https://geocode.maps.co/search'; private apiKey : string = envString('GEOCODE_API_KEY', null); - private db : DB = new DB(); - - constructor () { + private db : DB; + constructor (db : DB) { + this.db = db; } public async query (location : string) : Promise { @@ -56,6 +55,11 @@ export class Geocode { return null; } + if (response.status !== 200) { + this.log.warn(`Invalid response from API [${response.status}]`); + return null; + } + try { json = await response.json(); } catch (err) { diff --git a/views/index.hbs b/views/index.hbs index 2721c14..acebe0f 100644 --- a/views/index.hbs +++ b/views/index.hbs @@ -1,3 +1,3 @@ {{> head}} - {{{body}}} + {{> body }} {{> foot}} \ No newline at end of file diff --git a/views/partials/body.hbs b/views/partials/body.hbs new file mode 100644 index 0000000..f7dd77c --- /dev/null +++ b/views/partials/body.hbs @@ -0,0 +1,7 @@ +
+{{#each photos}} + + {{> photo this}} + +{{/each}} +
\ No newline at end of file diff --git a/views/partials/foot.hbs b/views/partials/foot.hbs index b9de0a2..cb373b8 100644 --- a/views/partials/foot.hbs +++ b/views/partials/foot.hbs @@ -1,5 +1,5 @@ - - +
+ © {{year}} {{artist}} +
\ No newline at end of file diff --git a/views/partials/head.hbs b/views/partials/head.hbs index 899f1d4..578a925 100644 --- a/views/partials/head.hbs +++ b/views/partials/head.hbs @@ -5,5 +5,30 @@ {{title}} + {{#if umami_url}} + + {{/if}} - \ No newline at end of file + +
+
+

{{h1}}

+
+
    +
  • + 16MM +
  • +
  • + CODE +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
\ No newline at end of file diff --git a/views/partials/img.hbs b/views/partials/img.hbs deleted file mode 100644 index 4c3263a..0000000 --- a/views/partials/img.hbs +++ /dev/null @@ -1,3 +0,0 @@ - - {{alt}} - diff --git a/views/partials/photo.hbs b/views/partials/photo.hbs new file mode 100644 index 0000000..da2e2fa --- /dev/null +++ b/views/partials/photo.hbs @@ -0,0 +1,4 @@ + + + {{description}} +