Skip to content
This repository has been archived by the owner on Dec 25, 2023. It is now read-only.

Merge gallery, view and frame Into a Unified Frontend #323

Merged
merged 50 commits into from
Nov 26, 2022
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
911fd09
Created unified HTML and Gulp task
nagmat84 Sep 17, 2022
022a71e
Remove CSS class "view".
nagmat84 Sep 18, 2022
5da16c0
Add path for view mode to lychee.load
nagmat84 Sep 18, 2022
287203a
Fixed invocation of prettier
nagmat84 Sep 18, 2022
6350c9c
Removed "view" from build script and sources.
nagmat84 Sep 18, 2022
2e35054
Remove page from scripts and styles
nagmat84 Sep 18, 2022
6f34176
Removed unnecessary variables from gulpfile
nagmat84 Sep 18, 2022
b2262ce
Removed resolved TODOs from html
nagmat84 Sep 18, 2022
03c3d67
Fix localization of info panel
nagmat84 Sep 18, 2022
2b85a1b
Fixed translation and visibility of elements for gallery and view mode.
nagmat84 Sep 18, 2022
a017486
Fixed NSFW warning.
nagmat84 Sep 18, 2022
065b01d
Injecting SVG into HTML
nagmat84 Sep 18, 2022
1b8862d
Removed resolved TODO for view mode
nagmat84 Sep 18, 2022
5a78a8a
Enabled frame mode within frontend.
nagmat84 Sep 18, 2022
6ddf88e
Enabled frame mode (leaving frame mode doesn't work).
nagmat84 Sep 19, 2022
1bc6a0d
Cleaned up Gulp file
nagmat84 Sep 19, 2022
b302344
Make frame mode leavable again.
nagmat84 Sep 20, 2022
6a57359
Check whether frame mode is enabled
nagmat84 Sep 20, 2022
b35a6c8
Enforce non-executable compilation results
nagmat84 Sep 20, 2022
7a44af3
Make pretty
nagmat84 Sep 20, 2022
894fbdf
Re-enable TV styles
nagmat84 Sep 21, 2022
52f2ecc
Update dependencies
nagmat84 Oct 18, 2022
ce312bf
Apply spelling and grammer corrections from code review
nagmat84 Oct 21, 2022
2fc41d0
Apply suggestions from code review (remove `else`-branch)
nagmat84 Oct 21, 2022
2d00083
Fixed background colors
nagmat84 Oct 21, 2022
924af90
Merge branch 'master' into merge_modes
nagmat84 Oct 21, 2022
3b3de96
Removed alert box and added TODO comment
nagmat84 Oct 21, 2022
ef55351
Update metadata programmatically
nagmat84 Oct 22, 2022
b6b162e
Make NSFW customizable
nagmat84 Oct 22, 2022
c170c2f
Moved compiled frontend.html to dist-folder
nagmat84 Oct 22, 2022
c5075f4
Removed Larapass
nagmat84 Oct 22, 2022
146108e
Merge branch 'master' into merge_modes
nagmat84 Oct 23, 2022
ff17767
Removed device configuration from backend
nagmat84 Oct 23, 2022
d1b208c
Added WebAuthn
nagmat84 Oct 23, 2022
3acd822
Added RSS feeds
nagmat84 Oct 23, 2022
04973e7
Pre-render HTML header on server-side
nagmat84 Oct 23, 2022
7c1e657
Merge branch 'master' into merge_modes
nagmat84 Oct 27, 2022
acd3b71
Fixed photo toolbar in view mode
nagmat84 Oct 27, 2022
237aedf
Ensure that title is non-editable in public mode
nagmat84 Oct 27, 2022
46704a9
Added helper method to add a click and touch listener
nagmat84 Oct 27, 2022
4a01803
Remove direct style "visibility" from html tag
nagmat84 Oct 28, 2022
3a17fe5
Add visibility tweak again
nagmat84 Oct 28, 2022
6e395bc
2nd attempt to fix single view and photo view
nagmat84 Nov 1, 2022
38c5244
Merge branch 'master' into merge_modes
nagmat84 Nov 5, 2022
f6cfc97
Merge branch 'master' into merge_modes
nagmat84 Nov 6, 2022
8deda77
Fix focus
nagmat84 Nov 6, 2022
ce91549
Remove harmful checks of is_share_button_visible
kamil4 Nov 6, 2022
9ce9812
fix conflicts
ildyria Nov 21, 2022
c10b3cb
minor transparency added back
ildyria Nov 21, 2022
9dfebff
Merge branch 'master' into merge_modes
ildyria Nov 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 38 additions & 198 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
let gulp = require("gulp"),
plugins = require("gulp-load-plugins")(),
cleanCSS = require("gulp-clean-css"),
chmod = require("gulp-chmod"),
del = require("del"),
sass = require("gulp-sass")(require("sass")),
paths = {};
Expand All @@ -12,78 +13,9 @@ const catchError = function (err) {
this.emit("end");
};

/* View ----------------------------------------- */
/* Frontend ----------------------------------------- */

paths.view = {
php: ["../view.php"],
js: [
"./scripts/api.js",
"./scripts/csrf_protection.js",
"./scripts/view/main.js",
"./scripts/main/build.js",
"./scripts/main/header.js",
"./scripts/main/visible.js",
"./scripts/main/sidebar.js",
"./scripts/main/mapview.js",
"./scripts/main/lychee_locale.js",
"./scripts/main/tabindex.js",
"./scripts/3rd-party/backend.js",
],
scripts: [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/lazysizes/lazysizes.min.js",
"node_modules/sprintf-js/dist/sprintf.min.js",
"node_modules/@lychee-org/basiccontext/dist/basicContext.min.js",
"../dist/_view--javascript.js",
],
svg: ["./images/iconic.svg", "./images/ionicons.svg"],
};

gulp.task("view--js", function () {
const babel = plugins.babel({
presets: ["env"],
});

return gulp
.src(paths.view.js)
.pipe(plugins.concat("_view--javascript.js", { newLine: "\n" }))
.pipe(babel)
.on("error", catchError)
.pipe(gulp.dest("../dist/"));
});

gulp.task(
"view--scripts",
gulp.series("view--js", function () {
return (
gulp
.src(paths.view.scripts)
.pipe(plugins.concat("view.js", { newLine: "\n" }))
// .pipe(plugins.uglify())
.on("error", catchError)
.pipe(gulp.dest("../dist/"))
);
})
);

gulp.task("view--svg", function () {
return gulp
.src(paths.view.php, { allowEmpty: true })
.pipe(
plugins.inject(gulp.src(paths.view.svg), {
starttag: "<!-- inject:svg -->",
transform: function (filePath, _file) {
return _file.contents.toString("utf8");
},
})
)
.pipe(gulp.dest("../"));
});

/* Main ----------------------------------------- */

paths.main = {
html: ["../index.html"],
paths.frontend = {
js: ["./scripts/*.js", "./scripts/main/*.js", "./scripts/3rd-party/backend.js"],
scripts: [
"node_modules/jquery/dist/jquery.min.js",
Expand All @@ -101,9 +33,10 @@ paths.main = {
"node_modules/livephotoskit/livephotoskit.js",
"node_modules/qr-creator/dist/qr-creator.min.js",
"node_modules/sprintf-js/dist/sprintf.min.js",
"node_modules/stackblur-canvas/dist/stackblur.min.js",
"node_modules/@lychee-org/leaflet.photo/Leaflet.Photo.js",
"node_modules/@lychee-org/basiccontext/dist/basicContext.min.js",
"../dist/_main--javascript.js",
"../dist/_frontend--javascript.js",
],
scss: ["./styles/main/*.scss"],
styles: [
Expand All @@ -115,123 +48,68 @@ paths.main = {
"node_modules/leaflet.markercluster/dist/MarkerCluster.css",
"node_modules/@lychee-org/leaflet.photo/Leaflet.Photo.css",
],
html: "./html/frontend.html",
svg: ["./images/iconic.svg", "./images/ionicons.svg"],
};

gulp.task("main--js", function () {
gulp.task("frontend--js", function () {
const babel = plugins.babel({
presets: ["env"],
});

return gulp
.src(paths.main.js)
.pipe(plugins.concat("_main--javascript.js", { newLine: "\n" }))
.src(paths.frontend.js)
.pipe(plugins.concat("_frontend--javascript.js", { newLine: "\n" }))
.pipe(babel)
.pipe(chmod({execute: false}))
.on("error", catchError)
.pipe(gulp.dest("../dist/"));
});

gulp.task(
"main--scripts",
gulp.series("main--js", function () {
return (
gulp
.src(paths.main.scripts)
.pipe(plugins.concat("main.js", { newLine: "\n" }))
// .pipe(plugins.uglify())
.on("error", catchError)
.pipe(gulp.dest("../dist/"))
);
"frontend--scripts",
gulp.series("frontend--js", function () {
return gulp
.src(paths.frontend.scripts)
.pipe(plugins.concat("frontend.js", { newLine: "\n" }))
.pipe(chmod({execute: false}))
.on("error", catchError)
.pipe(gulp.dest("../dist/"));
})
);

gulp.task("main--styles", function () {
gulp.task("frontend--styles", function () {
return gulp
.src(paths.main.styles)
.src(paths.frontend.styles)
.pipe(sass().on("error", catchError))
.pipe(plugins.concat("main.css", { newLine: "\n" }))
.pipe(plugins.concat("frontend.css", { newLine: "\n" }))
.pipe(plugins.autoprefixer("last 4 versions", "> 5%"))
.pipe(cleanCSS({ level: 2 }))
.pipe(chmod({execute: false}))
.pipe(gulp.dest("../dist/"));
});

gulp.task("main--svg", function () {
gulp.task("frontend--html", function () {
return gulp
.src(paths.main.html, { allowEmpty: true })
.pipe(
plugins.inject(gulp.src(paths.main.svg), {
.src(paths.frontend.html)
.pipe(plugins.inject(
gulp.src(paths.frontend.svg), {
starttag: "<!-- inject:svg -->",
transform: function (filePath, _file) {
return _file.contents.toString("utf8");
},
})
)
.pipe(gulp.dest("../"));
});

/* Frame ----------------------------------------- */

paths.frame = {
js: ["./scripts/api.js", "./scripts/csrf_protection.js", "./scripts/frame/main.js", "./scripts/3rd-party/backend.js"],
scss: ["./styles/frame/*.scss"],
styles: ["./styles/frame/frame.scss"],
scripts: [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/lazysizes/lazysizes.min.js",
"node_modules/stackblur-canvas/dist/stackblur.min.js",
"../dist/_frame--javascript.js",
],
};

gulp.task("frame--js", function () {
const babel = plugins.babel({
presets: ["env"],
});

return gulp
.src(paths.frame.js)
.pipe(plugins.concat("_frame--javascript.js", { newLine: "\n" }))
.pipe(babel)
}
))
.pipe(chmod({execute: false}))
.on("error", catchError)
.pipe(gulp.dest("../dist/"));
});

gulp.task("frame--styles", function () {
return gulp
.src(paths.frame.styles)
.pipe(sass().on("error", catchError))
.pipe(plugins.concat("frame.css", { newLine: "\n" }))
.pipe(plugins.autoprefixer("last 4 versions", "> 5%"))
.pipe(cleanCSS({ level: 2 }))
.pipe(gulp.dest("../dist/"));
});

gulp.task(
"frame--scripts",
gulp.series("frame--js", function () {
return (
gulp
.src(paths.frame.scripts)
.pipe(plugins.concat("frame.js", { newLine: "\n" }))
// .pipe(plugins.uglify())
.on("error", catchError)
.pipe(gulp.dest("../dist/"))
);
})
);

/* Landing ----------------------------------------- */

paths.landing = {
js: ["./scripts/landing/*.js"],
scripts: ["node_modules/jquery/dist/jquery.min.js", "node_modules/lazysizes/lazysizes.min.js", "../dist/_landing--javascript.js"],
scss: [
"./styles/landing/*.scss",
"./styles/page/fonts.scss",
"./styles/page/menu.scss",
"./styles/page/social.scss",
"./styles/page/animate.scss",
],
styles: ["./styles/landing/landing.scss"],
};

Expand All @@ -244,6 +122,7 @@ gulp.task("landing--js", function () {
.src(paths.landing.js)
.pipe(plugins.concat("_landing--javascript.js", { newLine: "\n" }))
.pipe(babel)
.pipe(chmod({execute: false}))
.on("error", catchError)
.pipe(gulp.dest("../dist/"));
});
Expand All @@ -256,6 +135,7 @@ gulp.task(
.src(paths.landing.scripts)
.pipe(plugins.concat("landing.js", { newLine: "\n" }))
// .pipe(plugins.uglify())
.pipe(chmod({execute: false}))
.on("error", catchError)
.pipe(gulp.dest("../dist/"))
);
Expand All @@ -270,44 +150,11 @@ gulp.task("landing--styles", function () {
.pipe(plugins.concat("landing.css", { newLine: "\n" }))
.pipe(plugins.autoprefixer("last 4 versions", "> 5%"))
// .pipe(cleanCSS({level: 2}))
.pipe(chmod({execute: false}))
.pipe(gulp.dest("../dist/"))
);
});

/* Page ----------------------------------------- */

paths.page = {
scss: ["./styles/page/*.scss", "./styles/page/*.scss"],
styles: ["./styles/page/page.scss"],
};

gulp.task("page--styles", function () {
return (
gulp
.src(paths.page.styles)
.pipe(sass().on("error", catchError))
.pipe(plugins.concat("page.css", { newLine: "\n" }))
.pipe(plugins.autoprefixer("last 4 versions", "> 5%"))
// .pipe(cleanCSS({level: 2}))
.pipe(gulp.dest("../dist/"))
);
});

/* Page ----------------------------------------- */

paths.TVCSS = {
src: ["./styles/devices/TV.scss"],
};

gulp.task("TVCSS--styles", function () {
return gulp
.src(paths.TVCSS.src)
.on("error", catchError)
.pipe(plugins.concat("TV.css", { newLine: "\n" }))
.pipe(plugins.autoprefixer("last 4 versions", "> 5%"))
.pipe(gulp.dest("../dist/"));
});

/* Images ----------------------------------------- */

paths.images = {
Expand Down Expand Up @@ -348,17 +195,11 @@ gulp.task(
"default",
gulp.series(
gulp.parallel(
"view--svg",
"view--scripts",
"main--svg",
"main--scripts",
"main--styles",
"frame--scripts",
"frame--styles",
"frontend--scripts",
"frontend--styles",
"frontend--html",
"landing--scripts",
"landing--styles",
"page--styles",
"TVCSS--styles",
"images--copy",
"leafletMarkerclusterMapFile--copy",
"leafletMarkerclusterSourceFiles--copy"
Expand All @@ -370,9 +211,8 @@ gulp.task(
gulp.task(
"watch",
gulp.series("default", function () {
gulp.watch(paths.frame.js, gulp.series("frame--scripts"));
gulp.watch(paths.view.js, gulp.series("view--scripts"));
gulp.watch(paths.main.js, gulp.series("main--scripts"));
gulp.watch(paths.main.scss, gulp.series("main--styles"));
gulp.watch(paths.frontend.js, gulp.series("frontend--scripts"));
gulp.watch(paths.frontend.scss, gulp.series("frontend--styles"));
gulp.watch(paths.frontend.html, gulp.series("frontend--html"))
})
);
Loading