ElderDrivers / EdXposedManager

Companion Android application for EdXposed
https://edxp.meowcat.org/
GNU General Public License v3.0
1.76k stars 247 forks source link

Adding own repo #166

Open Mikanoshi opened 3 years ago

Mikanoshi commented 3 years ago

I can see that multiple repos are already supported: https://github.com/ElderDrivers/EdXposedManager/blob/master/app/src/main/java/org/meowcat/edxposed/manager/util/RepoLoader.java#L88 Adding my own there works, but how partial XMLs should be formatted and why does repo.xposed.info just return a full XML on any partial request?

Mikanoshi commented 3 years ago

Also why does this trigger reload without cache? https://github.com/ElderDrivers/EdXposedManager/blob/master/app/src/main/java/org/meowcat/edxposed/manager/DownloadFragment.java#L81 It is triggered every single time Download page is opened, no matter connected to internet or not.

mario0318 commented 3 years ago

I probably should not piggy back off this issue but since I'm not sure if it's known to be one or not I'll start here.

Not so much having an issue with adding repos though I like that idea, but the xposed repo modules download list doesn't appear to update at all. I've been sitting at recently updated modules on the list posted for Nov 30, a whole month and a half! And I'm not sure this began with me installing EdxM pre 4.6.0 (45759) as I installed that on Dec 15. The list was simply not updating in any way even while on stable manager 4.5.7.

Maybe addressing this issue of adding repos as well as the issue with the list triggering a repo update from the web instead of using a cache of sorts for faster loading performance can lead to figuring out why the list on my end is stuck since November 30?

Mikanoshi commented 3 years ago

@mario0318 There is nothing to update since November 30, because official Xposed repo login is broken since XDA forum update on December 1. That's exactly why I wanted to add my own repo. And I did :) Prepend repo url to default repos:

Helpers.findAndHookMethod("org.meowcat.edxposed.manager.util.RepoLoader", lpparam.classLoader, "refreshRepositories", new MethodHook() {
    @Override
    protected void before(MethodHookParam param) throws Throwable {
        String DEFAULT_REPOSITORIES = (String)XposedHelpers.getStaticObjectField(param.thisObject.getClass(), "DEFAULT_REPOSITORIES");
        if (!DEFAULT_REPOSITORIES.contains(Helpers.xposedRepo))
        XposedHelpers.setStaticObjectField(param.thisObject.getClass(), "DEFAULT_REPOSITORIES", Helpers.xposedRepo + "|" + DEFAULT_REPOSITORIES);
    }
});

Prevent inserting duplicate modules into cache db (my module only):

Helpers.hookAllMethods("org.meowcat.edxposed.manager.repo.RepoDb", lpparam.classLoader, "insertModule", new MethodHook() {
    @Override
    protected void before(MethodHookParam param) throws Throwable {
        String pkgName = (String)XposedHelpers.getObjectField(param.args[1], "packageName");
        if (!Helpers.modulePkg.equals(pkgName)) return;
        SQLiteDatabase sDb = (SQLiteDatabase)XposedHelpers.getStaticObjectField(findClass("org.meowcat.edxposed.manager.repo.RepoDb", lpparam.classLoader), "sDb");
        Cursor query = sDb.query("modules", new String[]{ "repo_id" }, "pkgname = ?", new String[]{ Helpers.modulePkg }, null, null, null, "1");
        if (query.getCount() > 0) param.setResult(null);
        query.close();
    }
});

1095092984 commented 3 years ago

请问怎么添加,有教程吗?

Mikanoshi commented 3 years ago

@1095092984 Logic to manage multiple repos is there, but no UI for it. You have to modify Manager sources or use Xposed hooks. I've encountered an issue though, above hooks cause Manager to stop working because of some EdXposed Framework bug. It only affects SendHook version. I tried on 0.4.x.x, but not on 0.5.x.x.

XspeedPL commented 3 years ago

@Mikanoshi the official repo login works as far as I can tell.

Regarding this issue, imo it would be best to have an official option in the UI to change used repo URL. If no one is up for it, I could look into making a PR later.

Mikanoshi commented 3 years ago

@XspeedPL Seriously? Now you are telling this when it was down for more than a month and was fixed just a week ago.

used repo URL

used repo URLs

1095092984 commented 3 years ago

据我所知,@ Mikanoshi的官方repo登录有效。

关于此问题,imo最好在UI中有一个官方选项来更改使用的仓库URL。 如果没有人支持,我稍后可以考虑进行PR。

我支持你,最好教教我

1095092984 commented 3 years ago

@XspeedPL认真吗?现在,您要告诉它何时关闭了一个多月,并且仅在一周前已修复。

使用的回购网址

使用的回购网址

您可以试试

Mikanoshi commented 3 years ago

Even though official repo's login is fixed it is still not working like it should. I updated my module there a week ago, still no updates are visible in Manager. I can see on traffic meter that it downloads full xml, I can see in log its URL and that there were no download errors, I can see that module page hangs for a while to parse this new xml, but new versions just do not appear. No idea why, it's just not working. I tried removing cache db and all download cache prefs, still nothing. Alternative link also does not help. But as soon as I add my own repo it works perfectly.

yujincheng08 commented 3 years ago

That repo website is down. 404 for all new uploaded mofules. And that xml file cannot update anymore.

We are considiering to build our own repo based on Github like how Maigsk is doing with some bots.

However, @MlgmXyysd doesnt seem to have much time in mataining this. The manager still has a lots of bugs to fix...

Mikanoshi commented 3 years ago

I'd like some open source repo that anyone can host on their own server, and an ability to add multiple repos in Manager. I'm hosting my module on my own for now :) http://code.highspec.ru/repo/full.xml.gz

XspeedPL commented 3 years ago

In case some of you don't know, there is a thread on XDA on this issue: https://forum.xda-developers.com/t/what-is-the-replacement-of-xposed-module-repository.4031087/

MlgmXyysd commented 3 years ago

I noticed this problem a long time ago and waited for xda to fix it. It now appears that they are not planning to fix it. :(

In this regard, I plan to build my own module repo. Unfortunately I am approaching the final exam. Once I have free time, I will start to do it.

XspeedPL commented 3 years ago

Own hosting? Maybe do it like Magisk and host data on GitHub. But then, if the auth changes to GitHub as well, how do we map XDA logins to GitHub logins, so that developers keep access to their modules? Quite a lot of stuff to consider

MlgmXyysd commented 3 years ago

Own hosting?

Yes, I am looking for available server providers.

But then, if the auth changes to GitHub as well, how do we map XDA logins to GitHub logins, so that developers keep access to their modules?

Unfortunately, I don't have the original xposed repo permission to migrate these data.

XspeedPL commented 3 years ago

Just having the metadata would be enough, original repo could be used as a backup download location for unmigrated files. I mean, starting the repo from scratch would be pretty painful for everyone involved.

MlgmXyysd commented 3 years ago

Just having the metadata would be enough, original repo could be used as a backup download location for unmigrated files. I mean, starting the repo from scratch would be pretty painful for everyone involved.

I can migrate from the current list to the new repo, but I cannot directly assign the owner. If the author is willing to use the new repo, they can use the account in xda to pm me, and I will assign the permissions.

Of course, everything has to wait for the new repo to be activated.