-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add identicon avatars and render urls
- Loading branch information
Showing
9 changed files
with
136 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"type": "code", | ||
"name": "Matterbridge API Connector", | ||
"modid": "matterbridge", | ||
"version": "0.0.6", | ||
|
||
"description" : "A matterbridge api connector for VS server", | ||
"website": "https://github.com/NikkyAI/vs-matterbridge", | ||
"authors": [ "NikkyAI" ], | ||
|
||
"side": "Server", | ||
"requiredOnClient": false, | ||
|
||
"dependencies": { | ||
"game": "1.8.0", | ||
"survival": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
namespace Matterbridge | ||
{ | ||
public class Identicon | ||
{ | ||
public static string GenerateUrl(string username) | ||
{ | ||
string usernameHash = GetHashString(username); | ||
return $"https://identicon-api.herokuapp.com/{usernameHash}/256?format=png"; | ||
} | ||
private static byte[] GetHash(string inputString) | ||
{ | ||
using (HashAlgorithm algorithm = SHA256.Create()) | ||
return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString)); | ||
} | ||
|
||
private static string GetHashString(string inputString) | ||
{ | ||
StringBuilder sb = new StringBuilder(); | ||
foreach (byte b in GetHash(inputString)) | ||
sb.Append(b.ToString("X2")); | ||
|
||
return sb.ToString(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters