use constants for index.xml and index.jar throughout the code
This commit is contained in:
parent
e8ec045c55
commit
e0d6371147
@ -17,6 +17,7 @@ import android.util.Log;
|
||||
import org.fdroid.fdroid.FDroidApp;
|
||||
import org.fdroid.fdroid.Hasher;
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.Apk;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
@ -103,7 +104,7 @@ public final class LocalRepoManager {
|
||||
repoDir = new SanitizedFile(fdroidDir, "repo");
|
||||
repoDirCaps = new SanitizedFile(fdroidDirCaps, "REPO");
|
||||
iconsDir = new SanitizedFile(repoDir, "icons");
|
||||
xmlIndexJar = new SanitizedFile(repoDir, "index.jar");
|
||||
xmlIndexJar = new SanitizedFile(repoDir, RepoUpdater.SIGNED_FILE_NAME);
|
||||
xmlIndexJarUnsigned = new SanitizedFile(repoDir, "index.unsigned.jar");
|
||||
|
||||
if (!fdroidDir.exists() && !fdroidDir.mkdir()) {
|
||||
@ -481,7 +482,7 @@ public final class LocalRepoManager {
|
||||
public void writeIndexJar() throws IOException, XmlPullParserException, LocalRepoKeyStore.InitException {
|
||||
BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(xmlIndexJarUnsigned));
|
||||
JarOutputStream jo = new JarOutputStream(bo);
|
||||
JarEntry je = new JarEntry("index.xml");
|
||||
JarEntry je = new JarEntry(RepoUpdater.DATA_FILE_NAME);
|
||||
jo.putNextEntry(je);
|
||||
new IndexXmlBuilder().build(context, apps, jo);
|
||||
jo.close();
|
||||
|
@ -83,6 +83,9 @@ import java.util.jar.JarFile;
|
||||
public class RepoUpdater {
|
||||
private static final String TAG = "RepoUpdater";
|
||||
|
||||
public static final String SIGNED_FILE_NAME = "index.jar";
|
||||
public static final String DATA_FILE_NAME = "index.xml";
|
||||
|
||||
final String indexUrl;
|
||||
|
||||
@NonNull
|
||||
@ -205,7 +208,7 @@ public class RepoUpdater {
|
||||
FDroidApp.disableBouncyCastleOnLollipop();
|
||||
|
||||
JarFile jarFile = new JarFile(downloadedFile, true);
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry("index.xml");
|
||||
JarEntry indexEntry = (JarEntry) jarFile.getEntry(RepoUpdater.DATA_FILE_NAME);
|
||||
indexInputStream = new ProgressBufferedInputStream(jarFile.getInputStream(indexEntry),
|
||||
processIndexListener, repo.address, (int) indexEntry.getSize());
|
||||
|
||||
|
@ -55,6 +55,7 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import org.fdroid.fdroid.FDroidApp;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.RepoUpdater;
|
||||
import org.fdroid.fdroid.UpdateService;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.compat.CursorAdapterCompat;
|
||||
@ -567,7 +568,7 @@ public class ManageReposActivity extends AppCompatActivity
|
||||
return addressWithoutIndex;
|
||||
}
|
||||
|
||||
final Uri uri = builder.appendPath("index.jar").build();
|
||||
final Uri uri = builder.appendPath(RepoUpdater.SIGNED_FILE_NAME).build();
|
||||
|
||||
try {
|
||||
if (checkForRepository(uri)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user