Skip to content

feat(clapper): prepare for 0.10 #1435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

GeopJr
Copy link
Owner

@GeopJr GeopJr commented May 23, 2025

fix: #1431

@@ -121,6 +129,47 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {
}
}

#if CLAPPER_0_10
private bool enhancer_check (string scheme, string? t_host = null) {
if (!Clapper.WITH_ENHANCERS_LOADER) return false;
Copy link
Contributor

@Rafostar Rafostar May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for information, this is fine cause it might save you from calling .substring (4) below in a (I guess rare) situation where Clapper is compiled without this option, so you can leave it as-is. But other than that (including compiled with but none installed) it is perfectly safe for applications to call Clapper.get_global_enhancer_proxies() - in this case returned GListModel will simply have zero elements and for loop would not execute.

@GeopJr
Copy link
Owner Author

GeopJr commented May 23, 2025

extra_data_lists_value

Ohhh, I didn't read the description, I just assumed it would only check the whole value and not treat them as a list, so I dismissed it instantly 😔... Much better than splitting and all!


It doesn't look like it matters and it's too early to do optimizations since the API is not done, but I do wonder if it's worth keeping some sort of 'cache'.

E.g.

"https", "youtube.com": passed
"peertube", null: failed

Keep that in memory and next time those combinations of scheme and host are checked, instantly return whether it's supported from memory instead of checking all plugins again

@Rafostar
Copy link
Contributor

It doesn't look like it matters and it's too early to do optimizations since the API is not done, but I do wonder if it's worth keeping some sort of 'cache'.

I thought about this too, but unsure how much of a boost you would get here to be worth it. These strings are read during init, then stored in enhancer proxy object, so there is no string dup/free going on. Just saving the amount of time it takes to iterate (currently) up to 3 elements array.

GeopJr and others added 2 commits May 24, 2025 04:32
Co-authored-by: Rafał Dzięgiel <[email protected]>
Co-authored-by: Rafał Dzięgiel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clapper_enhancer_check is deprecated
2 participants