├── OpenBulletAdminPanel
├── settings.json
├── OBlogoIcon.ico
├── packages.config
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Settings.cs
├── App.xaml
├── App.xaml.cs
├── User.cs
├── CreateUser.xaml
├── CreateUser.xaml.cs
├── MainWindow.xaml
├── OpenBulletAdminPanel.csproj
└── MainWindow.xaml.cs
├── README.md
├── LICENSE
├── OpenBulletAdminPanel.sln
└── .gitignore
/OpenBulletAdminPanel/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ApiUrl": "https://example.com",
3 | "SecretKey": "MySuperSecretPassword"
4 | }
5 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/OBlogoIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openbullet/openbullet-adminpanel/HEAD/OpenBulletAdminPanel/OBlogoIcon.ico
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OpenBullet Admin Panel
2 | Admin Panel for the OpenBullet API.
3 |
4 | Go [here](https://openbullet.github.io/ob1/remote.html) to learn how to use this.
5 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/Settings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace OpenBulletAdminPanel
8 | {
9 | public class Settings
10 | {
11 | public string ApiUrl { get; set; }
12 | public string SecretKey { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace OpenBulletAdminPanel
10 | {
11 | ///
12 | /// Logica di interazione per App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/User.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace OpenBulletAdminPanel
8 | {
9 | public class User
10 | {
11 | public string Key { get; set; }
12 | public string[] Groups { get; set; }
13 | public string[] IPs { get; set; }
14 |
15 | public string GroupsString { get { return Groups == null ? "" : string.Join(",", Groups); } }
16 | public string IPsString { get { return IPs == null ? "" : string.Join(",", IPs); } }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace OpenBulletAdminPanel.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.2041
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenBulletAdminPanel", "OpenBulletAdminPanel\OpenBulletAdminPanel.csproj", "{C4D1123B-22BA-4A10-9F35-AC63316154E4}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {C4D1123B-22BA-4A10-9F35-AC63316154E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {C4D1123B-22BA-4A10-9F35-AC63316154E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {C4D1123B-22BA-4A10-9F35-AC63316154E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {C4D1123B-22BA-4A10-9F35-AC63316154E4}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {AFF59C14-4A1B-424D-AD74-B51CA42FDDF3}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/CreateUser.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/CreateUser.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Security.Cryptography;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace OpenBulletAdminPanel
17 | {
18 | ///
19 | /// Logica di interazione per CreateUser.xaml
20 | ///
21 | public partial class CreateUser : Window
22 | {
23 | object Caller;
24 | bool Edit = false;
25 |
26 | public CreateUser(object caller, bool edit = false, User user = null)
27 | {
28 | InitializeComponent();
29 |
30 | if (user != null)
31 | {
32 | apiKeyTextbox.Text = user.Key;
33 | groupsTextbox.Text = user.GroupsString;
34 | ipsTextbox.Text = user.IPsString;
35 | }
36 |
37 | Edit = edit;
38 | Caller = caller;
39 | }
40 |
41 | private void GenerateKeyButton_Click(object sender, RoutedEventArgs e)
42 | {
43 | var key = new byte[32];
44 | using (var generator = RandomNumberGenerator.Create())
45 | generator.GetBytes(key);
46 | string apiKey = BitConverter.ToString(key).Replace("-", "").ToLower().Substring(0, 32);
47 | apiKeyTextbox.Text = apiKey;
48 | }
49 |
50 | private void AcceptButton_Click(object sender, RoutedEventArgs e)
51 | {
52 | var user = new User() {
53 | Key = apiKeyTextbox.Text,
54 | Groups = groupsTextbox.Text.Split(',').Select(g => g.Trim()).Where(g => g != "").ToArray(),
55 | IPs = ipsTextbox.Text.Split(',').Select(i => i.Trim()).Where(i => i != "").ToArray()
56 | };
57 |
58 | if (Edit) (Caller as MainWindow).UpdateUser(user);
59 | else (Caller as MainWindow).AddUser(user);
60 |
61 | Close();
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Le informazioni generali relative a un assembly sono controllate dal seguente
8 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
9 | // associate a un assembly.
10 | [assembly: AssemblyTitle("OpenBulletAdminPanel")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("OpenBulletAdminPanel")]
15 | [assembly: AssemblyCopyright("Copyright © 2019")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
20 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
21 | // COM, impostare su true l'attributo ComVisible per tale tipo.
22 | [assembly: ComVisible(false)]
23 |
24 | //Per iniziare a creare applicazioni localizzabili, impostare
25 | //CultureYouAreCodingWith nel file .csproj
26 | //all'interno di un . Ad esempio, se si utilizza l'inglese (Stati Uniti)
27 | //nei file di origine, impostare su en-US. Rimuovere quindi il commento dall'attributo
28 | //NeutralResourceLanguage riportato di seguito. Aggiornare "en-US" nella
29 | //riga sottostante in modo che corrisponda all'impostazione UICulture nel file di progetto.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //dove si trovano i dizionari delle risorse specifiche del tema
36 | //(da usare se nella pagina non viene trovata una risorsa,
37 | // oppure nei dizionari delle risorse dell'applicazione)
38 | ResourceDictionaryLocation.SourceAssembly //dove si trova il dizionario delle risorse generiche
39 | //(da usare se nella pagina non viene trovata una risorsa,
40 | // nell'applicazione o nei dizionari delle risorse specifiche del tema)
41 | )]
42 |
43 |
44 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
45 | //
46 | // Versione principale
47 | // Versione secondaria
48 | // Numero di build
49 | // Revisione
50 | //
51 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
52 | // usando l'asterisco '*' come illustrato di seguito:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Codice generato da uno strumento.
4 | // Versione runtime:4.0.30319.42000
5 | //
6 | // Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se
7 | // il codice viene rigenerato.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace OpenBulletAdminPanel.Properties
12 | {
13 |
14 |
15 | ///
16 | /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
17 | ///
18 | // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder
19 | // tramite uno strumento quale ResGen o Visual Studio.
20 | // Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen
21 | // con l'opzione /str oppure ricompilare il progetto VS.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenBulletAdminPanel.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte
56 | /// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/OpenBulletAdminPanel.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C4D1123B-22BA-4A10-9F35-AC63316154E4}
8 | WinExe
9 | OpenBulletAdminPanel
10 | OpenBulletAdminPanel
11 | v4.7.2
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 | true
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 | OBlogoIcon.ico
39 |
40 |
41 |
42 | ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | 4.0
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | MSBuild:Compile
62 | Designer
63 |
64 |
65 | CreateUser.xaml
66 |
67 |
68 |
69 |
70 | Designer
71 | MSBuild:Compile
72 |
73 |
74 | MSBuild:Compile
75 | Designer
76 |
77 |
78 | App.xaml
79 | Code
80 |
81 |
82 | MainWindow.xaml
83 | Code
84 |
85 |
86 |
87 |
88 | Code
89 |
90 |
91 | True
92 | True
93 | Resources.resx
94 |
95 |
96 | True
97 | Settings.settings
98 | True
99 |
100 |
101 | ResXFileCodeGenerator
102 | Resources.Designer.cs
103 |
104 |
105 |
106 | SettingsSingleFileGenerator
107 | Settings.Designer.cs
108 |
109 |
110 | PreserveNewest
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015/2017 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # Visual Studio 2017 auto generated files
33 | Generated\ Files/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | # NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | # Benchmark Results
49 | BenchmarkDotNet.Artifacts/
50 |
51 | # .NET Core
52 | project.lock.json
53 | project.fragment.lock.json
54 | artifacts/
55 | **/Properties/launchSettings.json
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_i.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *.log
81 | *.vspscc
82 | *.vssscc
83 | .builds
84 | *.pidb
85 | *.svclog
86 | *.scc
87 |
88 | # Chutzpah Test files
89 | _Chutzpah*
90 |
91 | # Visual C++ cache files
92 | ipch/
93 | *.aps
94 | *.ncb
95 | *.opendb
96 | *.opensdf
97 | *.sdf
98 | *.cachefile
99 | *.VC.db
100 | *.VC.VC.opendb
101 |
102 | # Visual Studio profiler
103 | *.psess
104 | *.vsp
105 | *.vspx
106 | *.sap
107 |
108 | # Visual Studio Trace Files
109 | *.e2e
110 |
111 | # TFS 2012 Local Workspace
112 | $tf/
113 |
114 | # Guidance Automation Toolkit
115 | *.gpState
116 |
117 | # ReSharper is a .NET coding add-in
118 | _ReSharper*/
119 | *.[Rr]e[Ss]harper
120 | *.DotSettings.user
121 |
122 | # JustCode is a .NET coding add-in
123 | .JustCode
124 |
125 | # TeamCity is a build add-in
126 | _TeamCity*
127 |
128 | # DotCover is a Code Coverage Tool
129 | *.dotCover
130 |
131 | # AxoCover is a Code Coverage Tool
132 | .axoCover/*
133 | !.axoCover/settings.json
134 |
135 | # Visual Studio code coverage results
136 | *.coverage
137 | *.coveragexml
138 |
139 | # NCrunch
140 | _NCrunch_*
141 | .*crunch*.local.xml
142 | nCrunchTemp_*
143 |
144 | # MightyMoose
145 | *.mm.*
146 | AutoTest.Net/
147 |
148 | # Web workbench (sass)
149 | .sass-cache/
150 |
151 | # Installshield output folder
152 | [Ee]xpress/
153 |
154 | # DocProject is a documentation generator add-in
155 | DocProject/buildhelp/
156 | DocProject/Help/*.HxT
157 | DocProject/Help/*.HxC
158 | DocProject/Help/*.hhc
159 | DocProject/Help/*.hhk
160 | DocProject/Help/*.hhp
161 | DocProject/Help/Html2
162 | DocProject/Help/html
163 |
164 | # Click-Once directory
165 | publish/
166 |
167 | # Publish Web Output
168 | *.[Pp]ublish.xml
169 | *.azurePubxml
170 | # Note: Comment the next line if you want to checkin your web deploy settings,
171 | # but database connection strings (with potential passwords) will be unencrypted
172 | *.pubxml
173 | *.publishproj
174 |
175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
176 | # checkin your Azure Web App publish settings, but sensitive information contained
177 | # in these scripts will be unencrypted
178 | PublishScripts/
179 |
180 | # NuGet Packages
181 | *.nupkg
182 | # The packages folder can be ignored because of Package Restore
183 | **/[Pp]ackages/*
184 | # except build/, which is used as an MSBuild target.
185 | !**/[Pp]ackages/build/
186 | # Uncomment if necessary however generally it will be regenerated when needed
187 | #!**/[Pp]ackages/repositories.config
188 | # NuGet v3's project.json files produces more ignorable files
189 | *.nuget.props
190 | *.nuget.targets
191 |
192 | # Microsoft Azure Build Output
193 | csx/
194 | *.build.csdef
195 |
196 | # Microsoft Azure Emulator
197 | ecf/
198 | rcf/
199 |
200 | # Windows Store app package directories and files
201 | AppPackages/
202 | BundleArtifacts/
203 | Package.StoreAssociation.xml
204 | _pkginfo.txt
205 | *.appx
206 |
207 | # Visual Studio cache files
208 | # files ending in .cache can be ignored
209 | *.[Cc]ache
210 | # but keep track of directories ending in .cache
211 | !*.[Cc]ache/
212 |
213 | # Others
214 | ClientBin/
215 | ~$*
216 | *~
217 | *.dbmdl
218 | *.dbproj.schemaview
219 | *.jfm
220 | *.pfx
221 | *.publishsettings
222 | orleans.codegen.cs
223 |
224 | # Including strong name files can present a security risk
225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
226 | #*.snk
227 |
228 | # Since there are multiple workflows, uncomment next line to ignore bower_components
229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
230 | #bower_components/
231 |
232 | # RIA/Silverlight projects
233 | Generated_Code/
234 |
235 | # Backup & report files from converting an old project file
236 | # to a newer Visual Studio version. Backup files are not needed,
237 | # because we have git ;-)
238 | _UpgradeReport_Files/
239 | Backup*/
240 | UpgradeLog*.XML
241 | UpgradeLog*.htm
242 | ServiceFabricBackup/
243 | *.rptproj.bak
244 |
245 | # SQL Server files
246 | *.mdf
247 | *.ldf
248 | *.ndf
249 |
250 | # Business Intelligence projects
251 | *.rdl.data
252 | *.bim.layout
253 | *.bim_*.settings
254 | *.rptproj.rsuser
255 |
256 | # Microsoft Fakes
257 | FakesAssemblies/
258 |
259 | # GhostDoc plugin setting file
260 | *.GhostDoc.xml
261 |
262 | # Node.js Tools for Visual Studio
263 | .ntvs_analysis.dat
264 | node_modules/
265 |
266 | # Visual Studio 6 build log
267 | *.plg
268 |
269 | # Visual Studio 6 workspace options file
270 | *.opt
271 |
272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
273 | *.vbw
274 |
275 | # Visual Studio LightSwitch build output
276 | **/*.HTMLClient/GeneratedArtifacts
277 | **/*.DesktopClient/GeneratedArtifacts
278 | **/*.DesktopClient/ModelManifest.xml
279 | **/*.Server/GeneratedArtifacts
280 | **/*.Server/ModelManifest.xml
281 | _Pvt_Extensions
282 |
283 | # Paket dependency manager
284 | .paket/paket.exe
285 | paket-files/
286 |
287 | # FAKE - F# Make
288 | .fake/
289 |
290 | # JetBrains Rider
291 | .idea/
292 | *.sln.iml
293 |
294 | # CodeRush
295 | .cr/
296 |
297 | # Python Tools for Visual Studio (PTVS)
298 | __pycache__/
299 | *.pyc
300 |
301 | # Cake - Uncomment if you are using it
302 | # tools/**
303 | # !tools/packages.config
304 |
305 | # Tabs Studio
306 | *.tss
307 |
308 | # Telerik's JustMock configuration file
309 | *.jmconfig
310 |
311 | # BizTalk build output
312 | *.btp.cs
313 | *.btm.cs
314 | *.odx.cs
315 | *.xsd.cs
316 |
317 | # OpenCover UI analysis results
318 | OpenCover/
319 |
320 | # Azure Stream Analytics local run output
321 | ASALocalRun/
322 |
323 | # MSBuild Binary and Structured Log
324 | *.binlog
325 |
326 | # NVidia Nsight GPU debugger configuration file
327 | *.nvuser
328 |
329 | # MFractors (Xamarin productivity tool) working folder
330 | .mfractor/
331 |
--------------------------------------------------------------------------------
/OpenBulletAdminPanel/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using Newtonsoft.Json;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Net;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Controls;
12 | using System.Windows.Data;
13 | using System.Windows.Documents;
14 | using System.Windows.Input;
15 | using System.Windows.Media;
16 | using System.Windows.Media.Imaging;
17 | using System.Windows.Navigation;
18 | using System.Windows.Shapes;
19 |
20 | namespace OpenBulletAdminPanel
21 | {
22 | ///
23 | /// Logica di interazione per MainWindow.xaml
24 | ///
25 | public partial class MainWindow : Window
26 | {
27 | Settings settings;
28 |
29 | public Uri UsersUri
30 | {
31 | get
32 | {
33 | var baseUrl = settings.ApiUrl;
34 | if (baseUrl.EndsWith("/")) baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
35 | return new Uri($"{baseUrl}/api/users");
36 | }
37 | }
38 |
39 | public Uri ConfigsUri
40 | {
41 | get
42 | {
43 | var baseUrl = settings.ApiUrl;
44 | if (baseUrl.EndsWith("/")) baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
45 | return new Uri($"{baseUrl}/api/configs");
46 | }
47 | }
48 |
49 | private Uri UserUri(string key)
50 | {
51 | var baseUrl = settings.ApiUrl;
52 | if (baseUrl.EndsWith("/")) baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
53 | return new Uri($"{baseUrl}/api/users/{key}");
54 | }
55 |
56 | public MainWindow()
57 | {
58 | InitializeComponent();
59 |
60 | settings = JsonConvert.DeserializeObject(File.ReadAllText("settings.json"));
61 | apiTextbox.Text = settings.ApiUrl;
62 | secretKeyTextbox.Text = settings.SecretKey;
63 | }
64 |
65 | private void refreshUsersButton_Click(object sender, RoutedEventArgs e)
66 | {
67 | if (settings.ApiUrl != "https://example.com")
68 | {
69 | try
70 | {
71 | usersListView.Items.Clear();
72 | WebClient wc = new WebClient();
73 | wc.Headers.Add(HttpRequestHeader.Authorization, settings.SecretKey);
74 | var users = wc.DownloadString(UsersUri);
75 | foreach (var user in JsonConvert.DeserializeObject(users))
76 | {
77 | usersListView.Items.Add(user);
78 | }
79 | }
80 | catch (Exception ex) { MessageBox.Show($"Failed to contact the API: {ex.Message}"); }
81 | }
82 | }
83 |
84 | private void addUserButton_Click(object sender, RoutedEventArgs e)
85 | {
86 | new CreateUser(this).ShowDialog();
87 | }
88 |
89 | public void AddUser(User user)
90 | {
91 | try
92 | {
93 | WebClient wc = new WebClient();
94 | wc.Headers.Add(HttpRequestHeader.Authorization, settings.SecretKey);
95 | wc.Headers.Add(HttpRequestHeader.ContentType, "application/json");
96 | wc.UploadString(UsersUri, JsonConvert.SerializeObject(user));
97 | usersListView.Items.Add(user);
98 | }
99 | catch (Exception ex) { MessageBox.Show($"Failed to add the user: {ex.Message}"); }
100 | }
101 |
102 | private void ApiTextbox_TextChanged(object sender, TextChangedEventArgs e)
103 | {
104 | settings.ApiUrl = apiTextbox.Text;
105 | File.WriteAllText("settings.json", JsonConvert.SerializeObject(settings));
106 | }
107 |
108 | private void SecretKeyTextbox_TextChanged(object sender, TextChangedEventArgs e)
109 | {
110 | settings.SecretKey = secretKeyTextbox.Text;
111 | File.WriteAllText("settings.json", JsonConvert.SerializeObject(settings));
112 | }
113 |
114 | private void EditUserMenuItem_Click(object sender, RoutedEventArgs e)
115 | {
116 | new CreateUser(this, true, usersListView.SelectedItem as User).ShowDialog();
117 | }
118 |
119 | public void UpdateUser(User user)
120 | {
121 | try
122 | {
123 | WebClient wc = new WebClient();
124 | wc.Headers.Add(HttpRequestHeader.Authorization, settings.SecretKey);
125 | wc.Headers.Add(HttpRequestHeader.ContentType, "application/json");
126 | wc.UploadString(UserUri(user.Key), "PUT", JsonConvert.SerializeObject(user));
127 | usersListView.Items.Remove(usersListView.SelectedItem);
128 | usersListView.Items.Add(user);
129 | }
130 | catch (Exception ex) { MessageBox.Show($"Failed to delete the user: {ex.Message}"); }
131 | }
132 |
133 | private void DeleteUserMenuItem_Click(object sender, RoutedEventArgs e)
134 | {
135 | try
136 | {
137 | var user = usersListView.SelectedItem as User;
138 | WebClient wc = new WebClient();
139 | wc.Headers.Add(HttpRequestHeader.Authorization, settings.SecretKey);
140 | wc.UploadString(UserUri(user.Key), "DELETE", "");
141 | usersListView.Items.Remove(user);
142 | }
143 | catch (Exception ex) { MessageBox.Show($"Failed to delete the user: {ex.Message}"); }
144 | }
145 |
146 | private void CopyApiKeyMenuItem_Click(object sender, RoutedEventArgs e)
147 | {
148 | try { Clipboard.SetText((usersListView.SelectedItem as User).Key); }
149 | catch { }
150 | }
151 |
152 | private void SearchConfigButton_Click(object sender, RoutedEventArgs e)
153 | {
154 | OpenFileDialog ofd = new OpenFileDialog();
155 | ofd.Filter = "loli files (*.loli)|*.loli";
156 | ofd.ShowDialog();
157 | if (!string.IsNullOrEmpty(ofd.FileName)) configPathTextbox.Text = ofd.FileName;
158 | }
159 |
160 | private void UploadConfigButton_Click(object sender, RoutedEventArgs e)
161 | {
162 | if (configGroupTextbox.Text.Trim() == "")
163 | {
164 | MessageBox.Show("Group cannot be empty");
165 | return;
166 | }
167 |
168 | if (configPathTextbox.Text.Trim() == "")
169 | {
170 | MessageBox.Show("Path cannot be empty");
171 | return;
172 | }
173 |
174 | try
175 | {
176 | WebClient wc = new WebClient();
177 | wc.Headers.Add(HttpRequestHeader.Authorization, settings.SecretKey);
178 | wc.Headers.Add("Group", configGroupTextbox.Text);
179 | wc.Headers.Add("Name", System.IO.Path.GetFileName(configPathTextbox.Text));
180 | wc.UploadFile(ConfigsUri, configPathTextbox.Text);
181 | MessageBox.Show("Sent!");
182 | }
183 | catch (Exception ex) { MessageBox.Show($"Failed to upload the config: {ex.Message}"); }
184 | }
185 | }
186 | }
187 |
--------------------------------------------------------------------------------