mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-07-17 10:38:26 +01:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
31b373b34a | |||
8665ab431c | |||
1b528a4277 | |||
6210b5de7d | |||
ab32c8032c | |||
43ce8e1b89 | |||
826e91e7e2 | |||
98f7a87005 | |||
bc933c2308 | |||
d5c4d54041 | |||
ba9b4b8bd4 | |||
7f78912829 | |||
33404c7a37 |
@ -1,19 +1,24 @@
|
||||
[tool.bumpversion]
|
||||
current_version = "0.2.7"
|
||||
current_version = "0.2.14"
|
||||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
||||
serialize = ["{major}.{minor}.{patch}"]
|
||||
search = "{current_version}"
|
||||
replace = "{new_version}"
|
||||
regex = false
|
||||
ignore_missing_version = false
|
||||
ignore_missing_files = false
|
||||
tag = true
|
||||
sign_tags = false
|
||||
tag_name = "{new_version}"
|
||||
tag_message = "Bump version: {current_version} → {new_version}"
|
||||
allow_dirty = false
|
||||
commit = true
|
||||
message = "Bump version: {current_version} → {new_version}"
|
||||
tag_name = "{new_version}"
|
||||
tag_message = "Bump version: {current_version} → {new_version}"
|
||||
|
||||
[[tool.bumpversion.files]]
|
||||
filename = ".bumpversion.toml"
|
||||
search = 'current_version = "{current_version}"'
|
||||
replace = 'current_version = "{new_version}"'
|
||||
|
||||
[[tool.bumpversion.files]]
|
||||
filename = "Dockerfile"
|
||||
search = 'ARG VERSION="{current_version}"'
|
||||
replace = 'ARG VERSION="{new_version}"'
|
||||
moveable_tags = []
|
||||
commit_args = ""
|
||||
setup_hooks = []
|
||||
|
@ -3,10 +3,14 @@ FROM python:3.11-slim
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
# Set version label
|
||||
ARG VERSION="0.2.14"
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Copy project files into the container
|
||||
COPY . /app
|
||||
|
||||
|
||||
# Install dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
|
@ -51,10 +51,22 @@ def load_config() -> configparser.ConfigParser:
|
||||
def rename_image() -> str | None:
|
||||
"""Renames 'image.png' in the output folder to a timestamped filename if it exists."""
|
||||
old_path = os.path.join(user_config["comfyui"]["output_dir"], "image.png")
|
||||
favourites_file = "./favourites.json"
|
||||
|
||||
if os.path.exists(old_path):
|
||||
new_filename = f"{str(time.time())}.png"
|
||||
new_path = os.path.join(user_config["comfyui"]["output_dir"], new_filename)
|
||||
|
||||
# Check if image.png is a favourite
|
||||
if os.path.exists(favourites_file):
|
||||
with open(favourites_file, 'r') as f:
|
||||
favourites = json.load(f)
|
||||
if "image.png" in favourites:
|
||||
favourites.remove("image.png")
|
||||
favourites.append(new_filename)
|
||||
with open(favourites_file, 'w') as f:
|
||||
json.dump(favourites, f)
|
||||
|
||||
os.rename(old_path, new_path)
|
||||
generate_thumbnail(new_path)
|
||||
print(f"Renamed 'image.png' to '{new_filename}'")
|
||||
|
@ -31,28 +31,20 @@ def gallery():
|
||||
def get_favourites_route():
|
||||
return jsonify(get_favourites())
|
||||
|
||||
@bp.route("/favourites/add", methods=["POST"])
|
||||
def add_favourite():
|
||||
data = request.get_json()
|
||||
filename = data.get("filename")
|
||||
if not filename:
|
||||
return jsonify({"status": "error", "message": "Filename missing"}), 400
|
||||
|
||||
favourites = get_favourites()
|
||||
if filename not in favourites:
|
||||
favourites.append(filename)
|
||||
save_favourites(favourites)
|
||||
return jsonify({"status": "success"})
|
||||
|
||||
@bp.route("/favourites/remove", methods=["POST"])
|
||||
def remove_favourite():
|
||||
@bp.route("/favourites/toggle", methods=["POST"])
|
||||
def toggle_favourite():
|
||||
data = request.get_json()
|
||||
filename = data.get("filename")
|
||||
if not filename:
|
||||
return jsonify({"status": "error", "message": "Filename missing"}), 400
|
||||
|
||||
favourites = get_favourites()
|
||||
is_favourited = False
|
||||
if filename in favourites:
|
||||
favourites.remove(filename)
|
||||
else:
|
||||
favourites.append(filename)
|
||||
is_favourited = True
|
||||
|
||||
save_favourites(favourites)
|
||||
return jsonify({"status": "success"})
|
||||
return jsonify({"status": "success", "favourited": is_favourited})
|
||||
|
@ -204,7 +204,7 @@
|
||||
<div class="gallery" id="gallery"></div>
|
||||
|
||||
<!-- Lightbox -->
|
||||
<div class="lightbox" id="lightbox">
|
||||
<div class="lightbox" id="lightbox" tabindex="-1" onkeyup="handleLightboxKeys(event)">
|
||||
<span class="close" onclick="closeLightbox()">×</span>
|
||||
<span class="favourite-heart" id="favourite-heart" onclick="toggleFavourite()">♡</span>
|
||||
<span class="arrow left" onclick="prevImage()">❮</span>
|
||||
@ -297,7 +297,9 @@
|
||||
const images = getGalleryImages();
|
||||
currentIndex = images.indexOf(imgEl);
|
||||
showImageAndLoadDetails(currentIndex);
|
||||
document.getElementById("lightbox").style.display = "flex";
|
||||
const lightbox = document.getElementById("lightbox");
|
||||
lightbox.style.display = "flex";
|
||||
lightbox.focus();
|
||||
}
|
||||
|
||||
function updateFavouriteHeart(isFavourited) {
|
||||
@ -310,10 +312,8 @@
|
||||
const images = getGalleryImages();
|
||||
const imgEl = images[currentIndex];
|
||||
const filename = imgEl.dataset.filename;
|
||||
let isFavourited = imgEl.dataset.favourited === 'true';
|
||||
|
||||
const url = isFavourited ? '/favourites/remove' : '/favourites/add';
|
||||
fetch(url, {
|
||||
fetch('/favourites/toggle', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ filename: filename })
|
||||
@ -321,14 +321,19 @@
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.status === 'success') {
|
||||
isFavourited = !isFavourited;
|
||||
const isFavourited = data.favourited;
|
||||
imgEl.dataset.favourited = isFavourited;
|
||||
updateFavouriteHeart(isFavourited);
|
||||
// Update the main image list
|
||||
|
||||
const originalImage = allImages.find(img => img.filename === filename);
|
||||
if (originalImage) {
|
||||
originalImage.favourited = isFavourited;
|
||||
}
|
||||
|
||||
if (showingFavourites) {
|
||||
filteredImages = allImages.filter(img => img.favourited);
|
||||
renderGallery();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -404,6 +409,18 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleLightboxKeys(e) {
|
||||
if (e.key === 'f') {
|
||||
toggleFavourite();
|
||||
} else if (e.key === 'Escape') {
|
||||
closeLightbox();
|
||||
} else if (e.key === 'ArrowLeft') {
|
||||
prevImage();
|
||||
} else if (e.key === 'ArrowRight') {
|
||||
nextImage();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user