mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Cloud storage: rethink the terminology used
Cloud storage makes more sense that remote storage - at least I assume that more people are used to thinking about "storing things in the cloud". Don't use PIN or passphrase, call it a password everywhere. Don't use copy_string() to copy the password - the git credentials routine asserts that password is not NULL, so make sure we at least have a pointer to an empty string here. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									97ef9d0ee8
								
							
						
					
					
						commit
						a6b6674780
					
				
					 5 changed files with 31 additions and 33 deletions
				
			
		|  | @ -77,7 +77,7 @@ int credential_ssh_cb(git_cred **out, | |||
| 		  void *payload) | ||||
| { | ||||
| 	const char *priv_key = format_string("%s/%s", system_default_directory(), "ssrf_remote.key"); | ||||
| 	const char *passphrase = copy_string(prefs.passphrase); | ||||
| 	const char *passphrase = prefs.cloud_storage_password ? strdup(prefs.cloud_storage_password) : strdup(""); | ||||
| 	return git_cred_ssh_key_new(out, username_from_url, NULL, priv_key, passphrase); | ||||
| } | ||||
| 
 | ||||
|  | @ -88,7 +88,7 @@ int credential_https_cb(git_cred **out, | |||
| 			void *payload) | ||||
| { | ||||
| 	const char *username = "ssrftest"; | ||||
| 	const char *password = copy_string(prefs.passphrase); | ||||
| 	const char *password = prefs.cloud_storage_password ? strdup(prefs.cloud_storage_password) : strdup(""); | ||||
| 	return git_cred_userpass_plaintext_new(out, username, password); | ||||
| } | ||||
| #endif | ||||
|  |  | |||
							
								
								
									
										6
									
								
								pref.h
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								pref.h
									
										
									
									
									
								
							|  | @ -90,9 +90,9 @@ struct preferences { | |||
| 	bool show_pictures_in_profile; | ||||
| 	bool use_default_file; | ||||
| 	facebook_prefs_t facebook; | ||||
| 	char *passphrase; | ||||
| 	char *remote_storage_email; | ||||
| 	bool save_PIN_local; | ||||
| 	char *cloud_storage_password; | ||||
| 	char *cloud_storage_email; | ||||
| 	bool save_password_local; | ||||
| }; | ||||
| enum unit_system_values { | ||||
| 	METRIC, | ||||
|  |  | |||
|  | @ -205,11 +205,9 @@ void PreferencesDialog::setUiFromPrefs() | |||
| 	ui.proxyType->setCurrentIndex(ui.proxyType->findData(prefs.proxy_type)); | ||||
| 	ui.btnUseDefaultFile->setChecked(prefs.use_default_file); | ||||
| 
 | ||||
| 	s.beginGroup("RemoteStorage"); | ||||
| 	ui.remote_storage_email->setText(prefs.remote_storage_email); | ||||
| 	ui.remote_storage_pin->setText(prefs.passphrase); | ||||
| 	ui.save_PIN_local->setChecked(prefs.save_PIN_local); | ||||
| 	s.endGroup(); | ||||
| 	ui.cloud_storage_email->setText(prefs.cloud_storage_email); | ||||
| 	ui.cloud_storage_password->setText(prefs.cloud_storage_password); | ||||
| 	ui.save_password_local->setChecked(prefs.save_password_local); | ||||
| } | ||||
| 
 | ||||
| void PreferencesDialog::restorePrefs() | ||||
|  | @ -361,13 +359,13 @@ void PreferencesDialog::syncSettings() | |||
| 	s.setValue("proxy_pass", ui.proxyPassword->text()); | ||||
| 	s.endGroup(); | ||||
| 
 | ||||
| 	s.beginGroup("RemoteStorage"); | ||||
| 	SAVE_OR_REMOVE("remote_storage_email", default_prefs.remote_storage_email, ui.remote_storage_email->text()); | ||||
| 	SAVE_OR_REMOVE("save_PIN_local", default_prefs.save_PIN_local, ui.save_PIN_local->isChecked()); | ||||
| 	if (ui.save_PIN_local->isChecked()) | ||||
| 		SAVE_OR_REMOVE("passphrase", default_prefs.passphrase, ui.remote_storage_pin->text()); | ||||
| 	s.beginGroup("CloudStorage"); | ||||
| 	SAVE_OR_REMOVE("email", default_prefs.cloud_storage_email, ui.cloud_storage_email->text()); | ||||
| 	SAVE_OR_REMOVE("save_password_local", default_prefs.save_password_local, ui.save_password_local->isChecked()); | ||||
| 	if (ui.save_password_local->isChecked()) | ||||
| 		SAVE_OR_REMOVE("password", default_prefs.cloud_storage_password, ui.cloud_storage_password->text()); | ||||
| 	else | ||||
| 		s.remove("passphrase"); | ||||
| 		s.remove("password"); | ||||
| 	s.endGroup(); | ||||
| 	loadSettings(); | ||||
| 	emit settingsChanged(); | ||||
|  | @ -480,10 +478,10 @@ void PreferencesDialog::loadSettings() | |||
| 	GET_TXT("proxy_pass", proxy_pass); | ||||
| 	s.endGroup(); | ||||
| 
 | ||||
| 	s.beginGroup("RemoteStorage"); | ||||
| 	GET_TXT("passphrase", passphrase); | ||||
| 	GET_TXT("remote_storage_email", remote_storage_email); | ||||
| 	GET_BOOL("save_PIN_local", save_PIN_local); | ||||
| 	s.beginGroup("CloudStorage"); | ||||
| 	GET_TXT("password", cloud_storage_password); | ||||
| 	GET_TXT("email", cloud_storage_email); | ||||
| 	GET_BOOL("save_password_local", save_password_local); | ||||
| 	s.endGroup(); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -420,7 +420,7 @@ | |||
|              <item row="0" column="0"> | ||||
|               <widget class="QLabel" name="label_16b"> | ||||
|                <property name="toolTip"> | ||||
|                 <string extracomment="Email address used for the Subsurface remote storage infrastructure"/> | ||||
|                 <string extracomment="Email address used for the Subsurface cloud storage infrastructure"/> | ||||
|                </property> | ||||
|                <property name="text"> | ||||
|                 <string>Email address</string> | ||||
|  | @ -430,24 +430,24 @@ | |||
|              <item row="0" column="1"> | ||||
|               <widget class="QLabel" name="label_16c"> | ||||
|                <property name="text"> | ||||
|                 <string>PIN</string> | ||||
|                 <string>Password</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="1" column="0"> | ||||
|               <widget class="QLineEdit" name="remote_storage_email"> | ||||
|               <widget class="QLineEdit" name="cloud_storage_email"> | ||||
|                <property name="toolTip"> | ||||
|                 <string extracomment="Email address used for the Subsurface remote storage infrastructure"/> | ||||
|                 <string extracomment="Email address used for the Subsurface cloud storage infrastructure"/> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="1" column="1"> | ||||
|               <widget class="QLineEdit" name="remote_storage_pin"/> | ||||
|               <widget class="QLineEdit" name="cloud_storage_password"/> | ||||
|              </item> | ||||
|              <item row="2" column="1"> | ||||
|               <widget class="QCheckBox" name="save_PIN_local"> | ||||
|               <widget class="QCheckBox" name="save_password_local"> | ||||
|                <property name="text"> | ||||
|                 <string>Save PIN locally?</string> | ||||
|                 <string>Save Password locally?</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|  | @ -1733,13 +1733,13 @@ | |||
|   </connection> | ||||
|  </connections> | ||||
|  <buttongroups> | ||||
|   <buttongroup name="buttonGroup_7"/> | ||||
|   <buttongroup name="buttonGroup_4"/> | ||||
|   <buttongroup name="buttonGroup_2"/> | ||||
|   <buttongroup name="buttonGroup_5"/> | ||||
|   <buttongroup name="buttonGroup_6"/> | ||||
|   <buttongroup name="verticalSpeed"/> | ||||
|   <buttongroup name="buttonGroup_4"/> | ||||
|   <buttongroup name="buttonGroup_3"/> | ||||
|   <buttongroup name="buttonGroup_5"/> | ||||
|   <buttongroup name="buttonGroup"/> | ||||
|   <buttongroup name="buttonGroup_6"/> | ||||
|   <buttongroup name="buttonGroup_7"/> | ||||
|   <buttongroup name="verticalSpeed"/> | ||||
|  </buttongroups> | ||||
| </ui> | ||||
|  |  | |||
|  | @ -248,7 +248,7 @@ void free_prefs(void) | |||
| 	free((void*)prefs.default_filename); | ||||
| 	free((void*)prefs.default_cylinder); | ||||
| 	free((void*)prefs.divelist_font); | ||||
| 	free((void*)prefs.passphrase); | ||||
| 	free((void*)prefs.cloud_storage_password); | ||||
| 	free(prefs.proxy_host); | ||||
| 	free(prefs.proxy_user); | ||||
| 	free(prefs.proxy_pass); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue