commit
c1b62da1c5
1
.github/AUTHORS.md
vendored
1
.github/AUTHORS.md
vendored
|
@ -20,6 +20,7 @@ Code:
|
||||||
Luis Cordova <cordoval@gmail.com>
|
Luis Cordova <cordoval@gmail.com>
|
||||||
Łukasz Jernaś <deejay1@srem.org>
|
Łukasz Jernaś <deejay1@srem.org>
|
||||||
Markus Stoll <post@mstoll.de>
|
Markus Stoll <post@mstoll.de>
|
||||||
|
Malte Kiefer <malte.kiefer@mailgermania.de>
|
||||||
Michael Monreal <michael.monreal@gmail.com>
|
Michael Monreal <michael.monreal@gmail.com>
|
||||||
Nick Richards <nick@nickr.org>
|
Nick Richards <nick@nickr.org>
|
||||||
Oleg Khlystov <pktfag@gmail.com>
|
Oleg Khlystov <pktfag@gmail.com>
|
||||||
|
|
|
@ -32,10 +32,11 @@ namespace SparkleShare
|
||||||
static List<string> skipped_avatars = new List<string> ();
|
static List<string> skipped_avatars = new List<string> ();
|
||||||
|
|
||||||
|
|
||||||
public static string GetAvatar (string email, int size, string target_path)
|
public static string GetAvatar (string email, int size, string target_path, string provider)
|
||||||
{
|
{
|
||||||
#if __MonoCS__
|
#if __MonoCS__
|
||||||
ServicePointManager.ServerCertificateValidationCallback = GetAvatarValidationCallBack;
|
if (provider == "gravatar")
|
||||||
|
ServicePointManager.ServerCertificateValidationCallback = GetGravatarValidationCallBack;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
email = email.ToLower ();
|
email = email.ToLower ();
|
||||||
|
@ -68,7 +69,12 @@ namespace SparkleShare
|
||||||
}
|
}
|
||||||
|
|
||||||
var client = new WebClient ();
|
var client = new WebClient ();
|
||||||
string url = "https://gravatar.com/avatar/" + email.MD5 () + ".png?s=" + size + "&d=404";
|
string url = "";
|
||||||
|
|
||||||
|
if (provider == "libravatar")
|
||||||
|
url = "https://seccdn.libravatar.org/avatar/" + email.MD5 () + ".png?s=" + size + "&d=404";
|
||||||
|
else
|
||||||
|
url = "https://secure.gravatar.com/avatar/" + email.MD5 () + ".png?s=" + size + "&d=404";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
byte [] buffer = client.DownloadData (url);
|
byte [] buffer = client.DownloadData (url);
|
||||||
|
@ -107,7 +113,7 @@ namespace SparkleShare
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static bool GetAvatarValidationCallBack (Object sender,
|
private static bool GetGravatarValidationCallBack (Object sender,
|
||||||
X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
|
X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
|
||||||
{
|
{
|
||||||
X509Certificate2 certificate2 = new X509Certificate2 (certificate.GetRawCertData ());
|
X509Certificate2 certificate2 = new X509Certificate2 (certificate.GetRawCertData ());
|
||||||
|
@ -115,9 +121,9 @@ namespace SparkleShare
|
||||||
// On some systems (mostly Linux) we can't assume the needed certificates are
|
// On some systems (mostly Linux) we can't assume the needed certificates are
|
||||||
// available, so we have to check the certificate's SHA-1 fingerprint manually.
|
// available, so we have to check the certificate's SHA-1 fingerprint manually.
|
||||||
//
|
//
|
||||||
// SHA1 fingerprinter obtained from https://www.gravatar.com/ on Oct 16 2015
|
// SHA1 fingerprinter obtained from https://www.gravatar.com/ on Feb 14 2020
|
||||||
// Set to expire on Oct 14 2018
|
// Set to expire on Sep 05 2020
|
||||||
string gravatar_cert_fingerprint = "1264B3F00814C6077D3853238771EE67FB6321C9";
|
string gravatar_cert_fingerprint = "3011C8954A672A01557E804AFF2F3D006D9BBD7C";
|
||||||
|
|
||||||
if (!certificate2.Thumbprint.Equals (gravatar_cert_fingerprint)) {
|
if (!certificate2.Thumbprint.Equals (gravatar_cert_fingerprint)) {
|
||||||
Logger.LogInfo ("Avatars", "Invalid certificate for https://www.gravatar.com/");
|
Logger.LogInfo ("Avatars", "Invalid certificate for https://www.gravatar.com/");
|
||||||
|
|
|
@ -153,6 +153,16 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string AvatarsProvider {
|
||||||
|
get {
|
||||||
|
string avatars_provider_string = Config.GetConfigOption ("avatars_provider");
|
||||||
|
|
||||||
|
if (avatars_provider_string == null)
|
||||||
|
return "gravatar";
|
||||||
|
|
||||||
|
return avatars_provider_string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Path where the plugins are kept
|
// Path where the plugins are kept
|
||||||
public abstract string PresetsPath { get; }
|
public abstract string PresetsPath { get; }
|
||||||
|
@ -451,8 +461,16 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
repo.NewChangeSet += delegate (ChangeSet change_set) {
|
repo.NewChangeSet += delegate (ChangeSet change_set) {
|
||||||
if (AvatarsEnabled)
|
if (AvatarsEnabled) {
|
||||||
change_set.User.AvatarFilePath = Avatars.GetAvatar (change_set.User.Email, 48, Config.DirectoryPath);
|
string provider = "gravatar";
|
||||||
|
|
||||||
|
if (AvatarsProvider == "libravatar")
|
||||||
|
provider = AvatarsProvider;
|
||||||
|
|
||||||
|
|
||||||
|
change_set.User.AvatarFilePath = Avatars.GetAvatar (change_set.User.Email, 48, Config.DirectoryPath, provider);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
NotificationRaised (change_set);
|
NotificationRaised (change_set);
|
||||||
};
|
};
|
||||||
|
|
|
@ -598,7 +598,7 @@ namespace SparkleShare {
|
||||||
if (!SparkleShare.Controller.AvatarsEnabled)
|
if (!SparkleShare.Controller.AvatarsEnabled)
|
||||||
return "<!-- $pixmaps-path -->/user-icon-default.png";
|
return "<!-- $pixmaps-path -->/user-icon-default.png";
|
||||||
|
|
||||||
string fetched_avatar = Avatars.GetAvatar (user.Email, 48, SparkleShare.Controller.Config.DirectoryPath);
|
string fetched_avatar = Avatars.GetAvatar (user.Email, 48, SparkleShare.Controller.Config.DirectoryPath, SparkleShare.Controller.AvatarsProvider);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty (fetched_avatar))
|
if (!string.IsNullOrEmpty (fetched_avatar))
|
||||||
return "file://" + fetched_avatar.Replace ("\\", "/");
|
return "file://" + fetched_avatar.Replace ("\\", "/");
|
||||||
|
|
|
@ -39,8 +39,7 @@ namespace SparkleShare {
|
||||||
SparkleShare.Controller.ShowNoteWindowEvent += OnNoteWindowEvent;
|
SparkleShare.Controller.ShowNoteWindowEvent += OnNoteWindowEvent;
|
||||||
|
|
||||||
if (SparkleShare.Controller.AvatarsEnabled && !SparkleShare.Controller.FirstRun)
|
if (SparkleShare.Controller.AvatarsEnabled && !SparkleShare.Controller.FirstRun)
|
||||||
AvatarFilePath = Avatars.GetAvatar (SparkleShare.Controller.CurrentUser.Email,
|
AvatarFilePath = Avatars.GetAvatar (SparkleShare.Controller.CurrentUser.Email, 48, SparkleShare.Controller.Config.DirectoryPath, SparkleShare.Controller.AvatarsProvider);
|
||||||
48, SparkleShare.Controller.Config.DirectoryPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
void ResumeWithNote (string note)
|
void ResumeWithNote (string note)
|
||||||
{
|
{
|
||||||
BaseRepository repo = SparkleShare.Controller.GetRepoByName (CurrentProject);
|
BaseRepository repo = SparkleShare.Controller.GetRepoByName (CurrentProject);
|
||||||
repo.Resume (note);
|
repo.Resume (note);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
|
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU Lesser General Public License as
|
// it under the terms of the GNU Lesser General Public License as
|
||||||
// published by the Free Software Foundation, either version 3 of the
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
// License, or (at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
@ -32,10 +32,10 @@ namespace Sparkles {
|
||||||
app_data_path = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".config");
|
app_data_path = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".config");
|
||||||
|
|
||||||
string config_path = Path.Combine (app_data_path, "org.sparkleshare.SparkleShare");
|
string config_path = Path.Combine (app_data_path, "org.sparkleshare.SparkleShare");
|
||||||
|
|
||||||
return new Configuration (config_path, "projects.xml");
|
return new Configuration (config_path, "projects.xml");
|
||||||
});
|
});
|
||||||
|
|
||||||
public static Configuration DefaultConfiguration { get { return ConfigLazy.Value; } }
|
public static Configuration DefaultConfiguration { get { return ConfigLazy.Value; } }
|
||||||
public static bool DebugMode = true;
|
public static bool DebugMode = true;
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ namespace Sparkles {
|
||||||
public readonly string FilePath;
|
public readonly string FilePath;
|
||||||
public readonly string TmpPath;
|
public readonly string TmpPath;
|
||||||
public readonly string BinPath;
|
public readonly string BinPath;
|
||||||
|
public string AvatarProvider;
|
||||||
|
|
||||||
public readonly string LogFilePath;
|
public readonly string LogFilePath;
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ namespace Sparkles {
|
||||||
get {
|
get {
|
||||||
if (InstallationInfo.OperatingSystem == OS.Windows)
|
if (InstallationInfo.OperatingSystem == OS.Windows)
|
||||||
return Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
|
return Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
|
||||||
|
|
||||||
return Environment.GetFolderPath (Environment.SpecialFolder.Personal);
|
return Environment.GetFolderPath (Environment.SpecialFolder.Personal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,9 +60,9 @@ namespace Sparkles {
|
||||||
|
|
||||||
public string FoldersPath {
|
public string FoldersPath {
|
||||||
get {
|
get {
|
||||||
if (GetConfigOption ("folders_path") != null)
|
if (GetConfigOption ("folders_path") != null)
|
||||||
return GetConfigOption ("folders_path");
|
return GetConfigOption ("folders_path");
|
||||||
|
|
||||||
return Path.Combine (HomePath, "SparkleShare");
|
return Path.Combine (HomePath, "SparkleShare");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,15 +337,15 @@ namespace Sparkles {
|
||||||
{
|
{
|
||||||
return SelectSingleNode (string.Format ("/sparkleshare/folder[name=\"{0}\"]", name));
|
return SelectSingleNode (string.Format ("/sparkleshare/folder[name=\"{0}\"]", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string FolderValueByKey (string name, string key)
|
string FolderValueByKey (string name, string key)
|
||||||
{
|
{
|
||||||
XmlNode folder = FolderByName(name);
|
XmlNode folder = FolderByName(name);
|
||||||
|
|
||||||
if ((folder != null) && (folder [key] != null))
|
if ((folder != null) && (folder [key] != null))
|
||||||
return folder [key].InnerText;
|
return folder [key].InnerText;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue