Changeset 6076 in josm
- Timestamp:
- 2013-07-19T21:52:17+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r6069 r6076 1632 1632 */ 1633 1633 public void removeObsolete() { 1634 /* update the data with old consumer key*/ 1635 if(getInteger("josm.version", Version.getInstance().getVersion()) < 6076) { 1636 if(!get("oauth.access-token.key").isEmpty() && get("oauth.settings.consumer-key").isEmpty()) { 1637 put("oauth.settings.consumer-key", "AdCRxTpvnbmfV8aPqrTLyA"); 1638 put("oauth.settings.consumer-secret", "XmYOiGY9hApytcBC3xCec3e28QBqOWz5g6DSb5UpE"); 1639 } 1640 } 1641 1634 1642 String[] obsolete = { 1635 1643 "downloadAlong.downloadAlongTrack.distance", // 07/2013 - can be removed mid-2014. Replaced by downloadAlongWay.distance -
trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
r6069 r6076 29 29 static public final String DEFAULT_JOSM_CONSUMER_SECRET = "rIkjpPcBNkMQxrqzcOvOC4RRuYupYr7k8mfP13H5"; 30 30 /** 31 * The old default JOSM OAuth consumer key.32 */33 static public final String OLD_JOSM_CONSUMER_KEY = "AdCRxTpvnbmfV8aPqrTLyA";34 /**35 * The old default JOSM OAuth consumer secret.36 */37 static public final String OLD_JOSM_CONSUMER_SECRET = "XmYOiGY9hApytcBC3xCec3e28QBqOWz5g6DSb5UpE";38 /**39 31 * The default OSM OAuth request token URL. 40 32 */ … … 71 63 static public OAuthParameters createDefault(String apiUrl) { 72 64 OAuthParameters parameters = new OAuthParameters(); 73 parameters.setConsumerKey(OLD_JOSM_CONSUMER_KEY); 74 parameters.setConsumerSecret(OLD_JOSM_CONSUMER_SECRET); 75 if (apiUrl == null || apiUrl.isEmpty() || apiUrl.equals(OsmApi.DEFAULT_API_URL)) { 76 parameters.setRequestTokenUrl(DEFAULT_REQUEST_TOKEN_URL); 77 parameters.setAccessTokenUrl(DEFAULT_ACCESS_TOKEN_URL); 78 parameters.setAuthoriseUrl(DEFAULT_AUTHORISE_URL); 79 } else { 65 parameters.setConsumerKey(DEFAULT_JOSM_CONSUMER_KEY); 66 parameters.setConsumerSecret(DEFAULT_JOSM_CONSUMER_SECRET); 67 parameters.setRequestTokenUrl(DEFAULT_REQUEST_TOKEN_URL); 68 parameters.setAccessTokenUrl(DEFAULT_ACCESS_TOKEN_URL); 69 parameters.setAuthoriseUrl(DEFAULT_AUTHORISE_URL); 70 if(!apiUrl.equals(OsmApi.DEFAULT_API_URL)) { 80 71 try { 81 72 String host = new URL(apiUrl).getHost(); … … 99 90 */ 100 91 static public OAuthParameters createFromPreferences(Preferences pref) { 101 boolean useDefault = pref.getBoolean("oauth.settings.use-default", true ); 102 if (useDefault) 103 return createDefault(pref.get("osm-server.url")); 104 OAuthParameters parameters = new OAuthParameters(); 105 parameters.setConsumerKey(pref.get("oauth.settings.consumer-key", "")); 106 parameters.setConsumerSecret(pref.get("oauth.settings.consumer-secret", "")); 107 parameters.setRequestTokenUrl(pref.get("oauth.settings.request-token-url", "")); 108 parameters.setAccessTokenUrl(pref.get("oauth.settings.access-token-url", "")); 109 parameters.setAuthoriseUrl(pref.get("oauth.settings.authorise-url", "")); 92 OAuthParameters parameters = createDefault(pref.get("osm-server.url")); 93 parameters.setConsumerKey(pref.get("oauth.settings.consumer-key", DEFAULT_JOSM_CONSUMER_KEY)); 94 parameters.setConsumerSecret(pref.get("oauth.settings.consumer-secret", DEFAULT_JOSM_CONSUMER_SECRET)); 95 parameters.setRequestTokenUrl(pref.get("oauth.settings.request-token-url", parameters.getRequestTokenUrl())); 96 parameters.setAccessTokenUrl(pref.get("oauth.settings.access-token-url", parameters.getAccessTokenUrl())); 97 parameters.setAuthoriseUrl(pref.get("oauth.settings.authorise-url", parameters.getAuthoriseUrl())); 110 98 return parameters; 111 }112 113 /**114 * Clears the preferences for OAuth parameters115 *116 * @param pref the preferences in which keys related to OAuth parameters are117 * removed118 */119 static public void clearPreferences(Preferences pref) {120 pref.put("oauth.settings.consumer-key", null);121 pref.put("oauth.settings.consumer-secret", null);122 pref.put("oauth.settings.request-token-url", null);123 pref.put("oauth.settings.access-token-url", null);124 pref.put("oauth.settings.authorise-url", null);125 99 } 126 100 … … 265 239 */ 266 240 public void saveToPreferences(Preferences pref) { 267 if (this.equals(createDefault(pref.get("osm-server.url")))) {268 pref.put("oauth.settings.use-default", true );269 clearPreferences(pref);270 return;271 }272 pref.put("oauth.settings.use-default", false);273 241 pref.put("oauth.settings.consumer-key", consumerKey); 274 242 pref.put("oauth.settings.consumer-secret", consumerSecret);
Note:
See TracChangeset
for help on using the changeset viewer.