Compare commits

...

16 Commits

Author SHA1 Message Date
Mario
762d402dea Merge branch 'dev' 2024-12-26 09:00:33 +00:00
Mario
051cef79fc changelog 2024-12-26 09:00:02 +00:00
Mario
b05a440f03 version 10.0.4 2024-12-26 08:58:46 +00:00
Mario
9bb4988eda Merge branch 'dev' 2024-12-26 08:55:36 +00:00
Mario
f66f0e398b missing argument name 2024-12-26 08:54:58 +00:00
Mario
49cb73c8c7 version 10.0.3 2024-12-26 08:04:05 +00:00
Mario
2a00bd9a28 Merge branch 'dev' 2024-12-26 08:03:26 +00:00
Mario
553b3f6faa changelog and bump version 2024-12-26 08:02:29 +00:00
Mario
2980827925 fix another possible loop 2024-12-26 07:55:08 +00:00
Mario
45a78dcbc0 this should fix the infinite loop caused by a regression in Daemon/Expire 2024-12-25 20:53:32 +00:00
Mario
5813b65aed hotfix release version 10.0.2 2024-12-25 12:03:43 +00:00
Mario
f8acd1d3a5 Merge branch 'dev' 2024-12-25 12:02:32 +00:00
Mario
c9ebb23b69 hotfix for loop caused in Daemon/Expire 2024-12-25 12:00:27 +00:00
Mario
bc998eacd0 bump version 2024-12-22 17:40:41 +00:00
Mario
648979467a do not allow a new zid to override an existing remote login - otherwise a prfactored request with an added zid can log us out 2024-12-22 17:39:58 +00:00
Mario
5c0ff6f584 once more improved imagesLoaded() 2024-12-22 17:35:25 +00:00
8 changed files with 49 additions and 38 deletions

View File

@@ -1,3 +1,17 @@
Hubzilla 10.0.4 (2024-12-26)
- Fix missing argument name
Hubzilla 10.0.3 (2024-12-26)
- Fix regression in Daemon/Channel_purge which could cause a possible infinite loop
- Fix regression in Daemon/Expire which could cause a infinite loop
Hubzilla 10.0.2 (2024-12-25)
- Hotfix comment out Daemon/Expire
- Fix zid parameter allowed to override an existing remote login
- Slightly improved imagesLoaded()
Hubzilla 10.0.1 (2024-12-22)
- Revert removing of openid library
- Fix SQL query in Daemon/Importdoc

View File

@@ -24,7 +24,7 @@ class Channel_purge {
);
if ($r) {
foreach ($r as $rv) {
drop_item($rv['id']);
drop_item($rv['id'], uid: $channel_id);
}
}
} while ($r);

View File

@@ -23,13 +23,13 @@ class Expire {
// perform final cleanup on previously delete items
$r = q("select id from item where item_deleted = 1 and item_pending_remove = 0 and changed < %s - INTERVAL %s",
$r = q("select id, uid from item where item_deleted = 1 and item_pending_remove = 0 and changed < %s - INTERVAL %s",
db_utcnow(),
db_quoteinterval('10 DAY')
);
if ($r) {
foreach ($r as $rr) {
drop_item($rr['id'], DROPITEM_PHASE2);
drop_item($rr['id'], DROPITEM_PHASE2, uid: $rr['uid']);
}
}

View File

@@ -61,7 +61,7 @@ class WebServer {
if (x($_GET,'zid') && $installed) {
\App::$query_string = strip_zids(\App::$query_string);
if(! local_channel()) {
if (!isset($_SESSION['my_address']) || $_SESSION['my_address'] != $_GET['zid']) {
if (!isset($_SESSION['my_address'])) {
$_SESSION['my_address'] = Text::escape_tags($_GET['zid']);
$_SESSION['authenticated'] = 0;
}

View File

@@ -66,7 +66,7 @@ require_once('include/security.php');
define('PLATFORM_NAME', 'hubzilla');
define('STD_VERSION', '10.0.1');
define('STD_VERSION', '10.0.4');
define('ZOT_REVISION', '6.0');
define('DB_UPDATE_VERSION', 1263);

View File

@@ -3861,7 +3861,7 @@ function item_expire($uid,$days,$comment_days = 7) {
if ($r) {
foreach ($r as $item) {
drop_item($item['id'], expire: true);
drop_item($item['id'], uid: $uid);
}
}
@@ -3922,7 +3922,7 @@ function drop_item($id, $stage = DROPITEM_NORMAL, $force = false, $uid = 0, $obs
$ok_to_delete = true;
}
// remote delete when nobody is authenticated (called from Libzot)
// remote delete when nobody is authenticated (called from Libzot and Daemons)
if ($uid && intval($uid) === intval($item['uid'])) {
$ok_to_delete = true;
}

View File

@@ -793,48 +793,51 @@ function imagesLoaded(elements, callback) {
let loadedCount = 0;
let totalImages = 0;
let timeoutId;
let timeout = 10000;
let processed = [];
const timeout = 10000;
const processed = new Set(); // Use a Set for efficient lookup
// Helper function to extract img elements from an HTML string
function extractImagesFromHtml(htmlString) {
let tempDiv = document.createElement('div');
const tempDiv = document.createElement('div');
tempDiv.innerHTML = htmlString;
return tempDiv.querySelectorAll('.wall-item-body img, .wall-photo-item img');
}
function checkComplete(src) {
// Track processed images to not count images multiple times if load event is emited from multiple sources
if (processed.includes(src)) {
return;
}
// Skip processing if image has already been processed
if (processed.has(src)) return;
processed.push(src);
processed.add(src);
loadedCount++;
document.getElementById('image_counter').innerHTML = Math.round((loadedCount * 100) / totalImages) + '%';
// Update progress
const progress = Math.round((loadedCount * 100) / totalImages);
document.getElementById('image_counter').innerText = `${progress}%`;
// If all images are loaded, trigger the callback
if (loadedCount === totalImages) {
document.getElementById('image_counter').innerHTML = '';
document.getElementById('image_counter').innerText = '';
clearTimeout(timeoutId);
callback();
}
}
// If the elements is an HTML string, convert it to img elements
// Convert HTML string to img elements if necessary
if (typeof elements === 'string') {
elements = extractImagesFromHtml(elements);
}
// If elements is not a valid array-like object, or is empty, exit early
// Exit early if there are no images to load
if (!elements || elements.length === 0) {
callback(); // No images to load, immediately call the callback
callback();
return;
}
let images = Array.from(elements)
.filter(element => element.tagName && element.tagName.toLowerCase() === 'img' && element.src)
// Filter valid image elements (only img with src attribute)
const images = Array.from(elements)
.filter((element) => element.tagName.toLowerCase() === 'img' && element.src)
.filter((element, index, self) =>
index === self.findIndex(e => e.src === element.src)
index === self.findIndex(e => e.src === element.src) // Avoid duplicates
);
// If no images are found, call the callback immediately
@@ -843,29 +846,24 @@ function imagesLoaded(elements, callback) {
return;
}
// Set timeout
totalImages = images.length;
// Set timeout for the loading process
timeoutId = setTimeout(() => {
console.warn(`Image loading timed out after ${timeout}ms`);
callback(false);
}, timeout);
totalImages = images.length;
// Iterate through images to add load and error event listeners
images.forEach((img) => {
// Otherwise it will not load until visible
img.loading = 'eager';
img.loading = 'eager'; // Preload the image
if (img.complete && img.naturalHeight !== 0) {
// Image is already loaded successfully
//console.log(`Image cached: ${img.src}`);
if (img.complete && img.naturalHeight > 0) {
// Image is already loaded, handle immediately
checkComplete(img.src);
} else {
// Add event listeners for load and error events
img.addEventListener('load', () => {
//console.log(`Image loaded: ${img.src}`);
checkComplete(img.src);
});
img.addEventListener('load', () => checkComplete(img.src));
img.addEventListener('error', () => {
console.log(`Image failed to load: ${img.src}`);
checkComplete(img.src);
@@ -874,7 +872,6 @@ function imagesLoaded(elements, callback) {
});
}
function updateRelativeTime(selector) {
// Get all elements with the given selector
const timeElements = document.querySelectorAll(selector);

View File

@@ -5,7 +5,7 @@
* * Description: Hubzilla standard theme
* * Version: 2.2
* * MinVersion: 8.9
* * MaxVersion: 10.0
* * MaxVersion: 11.0
* * Author: Fabrixxm
* * Maintainer: Mike Macgirvin
* * Maintainer: Mario Vavti