-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Added support for custom Anki Server URL (SYNC_BASE). #680
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
Conversation
|
I just want to add my support that such an improvement be incorporated. Several wanted this and it makes a big difference, and costs only a user preference. |
|
Thanks for your contribution! Am I correct that anki-sync-server is I also think that the preference should be in the advanced section On Wed, Dec 31, 2014, at 04:34 PM, tomzx wrote:
|
|
Hi @agrueneberg, I'm currently in the process of writing another alternative to AnkiWeb in PHP (not yet available) as I'm not comfortable enough fixing anki-sync-server. My end goal is to use AnkiDroid with my alternate service, so I did this change in order to easily change between ankiweb, my local development server and my production server addresses. I agree with you that since there are not many API-compatible alternatives to AnkiWeb, this preference could go in the advanced section. Let me know if you want me to move it to the advanced section, and if so, where it would make the most sense. Thanks for the feedback 😄 |
|
I agree on advanced section, disagree on wait. It's a simple configurable url -- leaves the world open to do it when and how they want. |
|
Definitely advanced section. And it's unreasonable to assume the url ends After those changes we can merge into develop for inclusion in 2.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the constant from Consts.java instead of hard-coding it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah nice Houssam
On 01/01/2015 12:42 pm, "Houssam Salem" [email protected] wrote:
In AnkiDroid/src/main/java/com/ichi2/libanki/sync/HttpSyncer.java
#680 (diff)
:@@ -445,9 +444,12 @@ public HttpResponse register(String user, String pw) throws UnknownHttpResponseE
return null;
}
- public String syncBase() {
return AnkiDroidApp.getApplicationPrefs().getString("syncBaseUrl", "https://ankiweb.net/");Please use the constant from Consts.java instead of hard-coding it here.
—
Reply to this email directly or view it on GitHub
https://github.com/ankidroid/Anki-Android/pull/680/files#r22397930.
|
For the generic case, it is likely better to leave off an automatic end slash. Not all urls require a slash, it's not a "sync requirement", and urls that end in a querystring never contain a final slash. Most, thought not all urls, that use a final slash don't require the user to supply it (though web server "browse directory" services often require it, and perhaps others). But always adding a slash breaks the generic case. |
No slash breaks |
|
Oh, I see, because the current code forces the appending of "sync/" and On Thu, Jan 1, 2015 at 12:56 AM, Tim Rae [email protected] wrote:
|
|
Is there any chance that this pullrequest gets merged? @tomzx Great work btw!, but could you resolve the conflicts? |
f68ef87 to
3e09e12
Compare
3e09e12 to
6b51fed
Compare
|
I've moved the Preference in the |
|
Sorry there were actually three changes requested... the other one being to remove the requirement for the user to terminate the URL with a /. Also, I had forgotten... the media sync server is now handled by a separate URL (#755), so this won't work anymore - and it currently still has merge conflicts. I'm a bit uncomfortable about having two new preferences just for this though... Maybe you could have a window pop-up in the preferences which lets the user add the two URLs? |
|
@tomzx Would you be willing to host an APK with this patch somewhere? |
|
@fmap https://github.com/tomzx/Anki-Android/releases/tag/v2.5dev, download |
|
Cheers. |
|
+1 For this PR. |
|
I just had an idea; what do people think about having the custom base urls for sync server and media server not be exposed in the AnkiDroid user settings, but settable via the Anki Desktop debug console? E.g. like the number of backups in Anki mobile: http://ankisrs.net/docs/am-manual.html#automatic-backups I'd be in favor of including something like that in 2.5 |
|
That seems like an unnecessary inconvenience for those that would want to use this setting. Striving for a near-moratorium on new settings is the wrong solution to the problems created by unchecked settings proliferation. |
|
You're saying that you think we should add two new settings for a feature
|
|
Hi all, I've been following this conversation since almost day one and I agree with @jshevek on this. If there's more than one user asking for this feature, I do not understand why such a reluctance in adding it? Would be possible to simply accept the request and rework it in the future if deemed necessary? Thanks |
With me here are now 11 participants with github accounts in this discussion. Those two people that want this can build their own version. That would be simple. |
|
Personally I don't like the feature because I don't want to deal with the support requests that result from misbehaving custom servers. However, the most starred issue on our issue tracker is for this feature, so I'm not against putting in a setting for it based just on that alone. Regardless of what I think, this feature is not going anywhere because as I understand it there are currently no custom Anki servers that are compatible with the current sync protocol. That is, fixing this PR and exposing the setting would achieve nothing because there are no 3rd party services that can currently sync. |
|
Was there not https://github.com/dsnopek/anki-sync-server as a compatible substitute for AnkiWeb? |
@timrae Yes. I think that keeping the most often viewed preference screens simple for casual and new users is important, and that's why I'd support burying rarely used preferences like this. But I don't see any valid reasons related to 'protecting against preference proliferation' to bury them so far that they aren't even accessible within the app, requiring the debug console route. |
|
@RunasSudo Please read the third and fourth posts on this PR. The service exists but is broken for any recent version of Anki (and by extension AnkiDroid). |
|
@timrae From a support request standpoint would naming such a section "developer settings" help? Perhaps a message basically saying "by entering these settings, you're on your own"? As far as workload and code maintenance, I have absolutely nothing to suggest often than to thank those who made and maintain this app. It's been extremely useful to me. |
|
@unode @GivHug @hssm @everyone |
|
Alternatively we could just tell users to build a custom version, as @ospalh said... I'd probably be willing to write a tutorial on how to do this |
In this case, because of the "support requests that result from misbehaving custom servers" that @hssm mentioned, I see an additional benefit to explicitly making this setting hard for naive users to access. But I see this discussion through the lens of 'how should the project handle rarely used settings in general?'. I think there is a wider need for an in-app method of accommodating a range of less common settings. Too many suggestions made on the mailing list have been needlessly shot down on the basis of 'settings proliferation is bad'. Imo, this project needs a place to put new settings without raising these concerns. I like @GivHug 's thoughts. The 'developer' section could also go under the 'advanced' section. It could require clicking through a warning dialog. It could even be hidden easter-egg style, requiring an overtly counter-intuitive action to access (like the way phones are put into developer mode by clicking the build number a bunch of times). |
|
Sure, I think that a developer settings or similar section in the Making a decision on the most appropriate way of doing something is usually
|
|
By the way, @tomzx is already hosting a custom build with this patch included (linked to previously)... is anyone using it? |
b18764b to
12b1c86
Compare
|
One drawback to not enabling this feature is that this app is pushing users towards one specific service. At the moment, the main AnkiWeb server is free and relatively stable, but it's also single-point failure. Nobody is developing a working stable server, so nobody is developing a client that can easily be used with one, but clients are hard to use with different servers, so ... we're stuck in this unstable situation, hoping that AnkiWeb doesn't go down. |
|
Superseded by #4026 |
Hi,
This is a small PR that adds the ability for users to specify a custom SYNC_BASE url in the preferences. The default is the https://ankiweb.net/ URL.
Would anyone have a suggestion as how to replicate the functionality I added in AndroidApp.getApplicationPrefs() so it may not be necessary?
This also does not verify if the given URL ends with a slash. It is currently left to the user to format this url properly.