Skip to content

Commit ecb0fcd

Browse files
committed
better contrib type specifier; a few more notes about update checks
1 parent 64b8a32 commit ecb0fcd

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

app/src/processing/app/UpdateCheck.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2005-15 Ben Fry and Casey Reas
6+
Copyright (c) 2005-23 Ben Fry and Casey Reas
77
88
This program is free software; you can redistribute it and/or modify
99
it under the terms of the GNU General Public License as published by
@@ -36,25 +36,28 @@
3636

3737
/**
3838
* Threaded class to check for updates in the background.
39-
* <P>
39+
* <p/>
4040
* This is the class that handles the mind control and stuff for
4141
* spying on our users and stealing their personal information.
4242
* A random ID number is generated for each user, and hits the server
4343
* to check for updates. Also included is the operating system and
4444
* its version and the version of Java being used to run Processing.
45-
* <P>
45+
* <p/>
46+
* You can read more about this code
47+
* <a href="https://github.com/processing/processing4/wiki/FAQ#checking-for-updates">here</a>.
48+
* <p/>
4649
* Aside from the privacy invasion of knowing that an anonymous Processing
4750
* user opened the software at one time during a 24-hour period somewhere
4851
* in the world, we use the ID number to give us a general idea of how many
4952
* people are using Processing, which helps us when writing grant proposals
5053
* and that kind of thing so that we can keep Processing free. The numbers
51-
* are also sometimes used in ugly charts when Ben and Casey present.
54+
* are also sometimes shown in ugly charts presented by Ben and Casey.
5255
*/
5356
public class UpdateCheck {
5457
private final Base base;
5558

56-
static private final String DOWNLOAD_URL = "http://processing.org/download/";
57-
static private final String LATEST_URL = "http://processing.org/download/latest.txt";
59+
static private final String DOWNLOAD_URL = "https://processing.org/download/";
60+
static private final String LATEST_URL = "https://processing.org/download/latest.txt";
5861

5962
static private final long ONE_DAY = 24 * 60 * 60 * 1000;
6063

app/src/processing/app/contrib/AvailableContribution.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,6 @@ public AvailableContribution(ContributionType type, StringDict params) {
8585
}
8686

8787

88-
static ContributionType matchContribType(String path) {
89-
String filename = path.substring(path.lastIndexOf('/') + 1);
90-
for (ContributionType type : ContributionType.values()) {
91-
if (filename.equals(type.getPropertiesName())) {
92-
return type;
93-
}
94-
}
95-
return null;
96-
}
97-
98-
9988
/**
10089
* Create an AvailableContribution object from the .properties file
10190
* found in the specified zip file. Or return null if no match.
@@ -107,7 +96,7 @@ static private AvailableContribution findContrib(File contribArchive) throws IOE
10796
ZipEntry entry = entries.nextElement();
10897
String entryPath = entry.getName();
10998
if (entryPath.endsWith(".properties")) {
110-
ContributionType type = matchContribType(entryPath);
99+
ContributionType type = ContributionType.fromFilePath(entryPath);
111100
if (type != null) {
112101
String[] lines = PApplet.loadStrings(zf.getInputStream(entry));
113102
if (lines != null) {

app/src/processing/app/contrib/ContributionListing.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,6 @@ public void downloadAvailableList(final Base base,
280280
}
281281

282282

283-
protected boolean isDownloaded() {
284-
return listDownloaded;
285-
}
286-
287-
288283
// Thread: EDT
289284
private void loadAvailableList(File file) {
290285
listingFile = file;
@@ -317,7 +312,7 @@ private void loadAvailableList(File file) {
317312
* Bundles information about what contribs are installed, so that they can
318313
* be reported at the <a href="https://download.processing.org/stats/">stats</a> link.
319314
* (Eventually this may also be used to show relative popularity of contribs.)
320-
* Read more about it <a href="https://github.com/processing/processing4/wiki/FAQ#checking-for-updates-or-why-is-processing-connecting-to-the-network">in the FAQ</a>.</a>
315+
* Read more about it <a href="<a href="https://github.com/processing/processing4/wiki/FAQ#checking-for-updates">here</a>.">in the FAQ</a>.
321316
*/
322317
private byte[] makeContribsBlob(Base base) {
323318
Set<Contribution> contribs = base.getInstalledContribs();

app/src/processing/app/contrib/ContributionType.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,21 @@ static public ContributionType fromName(String s) {
105105
}
106106

107107

108+
/**
109+
* Identify a ContributionType from a .properties file name or path.
110+
* If passed 'blah/potato/library.properties' returns LIBRARY, etc.
111+
*/
112+
static public ContributionType fromFilePath(String path) {
113+
String filename = path.substring(path.lastIndexOf('/') + 1);
114+
for (ContributionType type : ContributionType.values()) {
115+
if (filename.equals(type.getPropertiesName())) {
116+
return type;
117+
}
118+
}
119+
return null;
120+
}
121+
122+
108123
public File getSketchbookFolder() {
109124
return switch (this) {
110125
case LIBRARY -> Base.getSketchbookLibrariesFolder();

0 commit comments

Comments
 (0)