From e8eee642c2235e617a225b6b148973df1ac94a64 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 8 Apr 2023 13:36:58 +0100 Subject: [PATCH] code cleanup --- my-logfile.txt | 196 ------------------ src/isnd/Services/EmailSender.cs | 14 +- src/isnd/Startup.cs | 21 +- .../RegistrationPageIndexQueryAndResult.cs | 0 4 files changed, 13 insertions(+), 218 deletions(-) delete mode 100644 my-logfile.txt rename src/isnd/{Services => ViewModels}/RegistrationPageIndexQueryAndResult.cs (100%) diff --git a/my-logfile.txt b/my-logfile.txt deleted file mode 100644 index a39035e..0000000 --- a/my-logfile.txt +++ /dev/null @@ -1,196 +0,0 @@ -0.000006 main (2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST: -0.000038 main (2): gphoto2 2.5.27 -0.000043 main (2): gphoto2 has been compiled with the following options: -0.000046 main (2): + gcc (C compiler used) -0.000050 main (2): + popt (mandatory, for handling command-line parameters) -0.000053 main (2): + exif (for displaying EXIF information) -0.000056 main (2): + cdk (for accessing configuration options) -0.000059 main (2): + aa (for displaying live previews) -0.000062 main (2): + jpeg (for displaying live previews in JPEG format) -0.000065 main (2): + readline (for easy navigation in the shell) -0.000069 main (2): libgphoto2 2.5.27 -0.000072 main (2): libgphoto2 has been compiled with the following options: -0.000076 main (2): + standard camlib set (ax203 canon digigr8 dimagev directory docupen jl2005a jl2005c kodak_dc240 lumix mars pentax ptp2 ricoh_g3 sierra sonix sq905 st2205 topfield tp6801) -0.000083 main (2): + gcc (C compiler used) -0.000086 main (2): + ltdl (for portable loading of camlibs) -0.000089 main (2): + EXIF (for special handling of EXIF files) -0.000094 main (2): libgphoto2_port 0.12.0 -0.000098 main (2): libgphoto2_port has been compiled with the following options: -0.000101 main (2): + iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi -0.000104 main (2): + gcc (C compiler used) -0.000107 main (2): + ltdl (for portable loading of iolibs) -0.000110 main (2): + EXIF (for vusb) -0.000114 main (2): + USB (libusb1, for USB cameras) -0.000117 main (2): + serial (for serial cameras) -0.000120 main (2): + no resmgr (serial port access and locking) -0.000123 main (2): + no ttylock (serial port locking) -0.000126 main (2): + no lockdev (serial port locking) -0.000130 main (2): CAMLIBS env var not set, using compile-time default instead -0.000133 main (2): IOLIBS env var not set, using compile-time default instead -0.000136 main (2): invoked with following arguments: -0.000140 main (2): --debug -0.000143 main (2): --debug-logfile=my-logfile.txt -0.000146 main (2): --summary -0.000158 load_settings (2): Creating gphoto config directory ('/home/paul/.gphoto') -0.000189 load_settings (2): Loading settings from file '/home/paul/.gphoto/settings'. -0.000288 main (2): The user has not specified both a model and a port. Try to figure them out. -0.000297 gp_port_info_list_load (2): Using ltdl to load io-drivers from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0'... -0.000345 foreach_func (2): Called for filename '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/disk'. -0.000443 gp_port_library_list (2): found fstab fsname /dev/mapper/lua-root -0.000457 gp_port_library_list (2): found fstab fsname UUID=b7824e21-2a8c-4527-9e3f-eefa30abc2a1 -0.000466 gp_port_library_list (2): found fstab fsname UUID=59A2-17DD -0.000476 gp_port_library_list (2): found fstab fsname /dev/mapper/lua-home -0.000483 gp_port_library_list (2): found fstab fsname /dev/mapper/lua-tmp -0.000490 gp_port_library_list (2): found fstab fsname /dev/mapper/lua-usr -0.000497 gp_port_library_list (2): found fstab fsname /dev/mapper/lua-var -0.000506 gp_port_library_list (2): found fstab fsname /dev/mapper/lua-swap_1 -0.000513 gp_port_library_list (2): found fstab fsname /dev/sr0 -0.000528 gp_port_library_list (2): found fstab fsname /boot -0.000586 gp_port_library_list (2): found mtab fsname sysfs -0.000595 gp_port_library_list (2): found mtab fsname proc -0.000599 gp_port_library_list (2): found mtab fsname udev -0.000609 gp_port_library_list (2): found mtab fsname devpts -0.000614 gp_port_library_list (2): found mtab fsname tmpfs -0.000623 gp_port_library_list (2): found mtab fsname /dev/mapper/lua-root -0.000630 gp_port_library_list (2): found mtab fsname /dev/mapper/lua-usr -0.000637 gp_port_library_list (2): found mtab fsname securityfs -0.000642 gp_port_library_list (2): found mtab fsname tmpfs -0.000651 gp_port_library_list (2): found mtab fsname tmpfs -0.000661 gp_port_library_list (2): found mtab fsname cgroup2 -0.000666 gp_port_library_list (2): found mtab fsname pstore -0.000676 gp_port_library_list (2): found mtab fsname efivarfs -0.000686 gp_port_library_list (2): found mtab fsname none -0.000716 gp_port_library_list (2): found mtab fsname systemd-1 -0.000722 gp_port_library_list (2): found mtab fsname hugetlbfs -0.000732 gp_port_library_list (2): found mtab fsname debugfs -0.000740 gp_port_library_list (2): found mtab fsname mqueue -0.000745 gp_port_library_list (2): found mtab fsname tracefs -0.000752 gp_port_library_list (2): found mtab fsname fusectl -0.000757 gp_port_library_list (2): found mtab fsname configfs -0.000767 gp_port_library_list (2): found mtab fsname sunrpc -0.000777 gp_port_library_list (2): found mtab fsname /dev/sda5 -0.000785 gp_port_library_list (2): found mtab fsname /dev/sda5 -0.000792 gp_port_library_list (2): found mtab fsname /dev/mapper/lua-var -0.000798 gp_port_library_list (2): found mtab fsname /dev/mapper/lua-tmp -0.000804 gp_port_library_list (2): found mtab fsname /dev/sdb1 -0.000812 gp_port_library_list (2): found mtab fsname /dev/sdb1 -0.000820 gp_port_library_list (2): found mtab fsname /dev/loop4 -0.000843 gp_port_library_list (2): found mtab fsname /dev/loop1 -0.000852 gp_port_library_list (2): found mtab fsname /dev/mapper/lua-home -0.000859 gp_port_library_list (2): found mtab fsname /dev/loop3 -0.000867 gp_port_library_list (2): found mtab fsname /dev/loop2 -0.000874 gp_port_library_list (2): found mtab fsname binfmt_misc -0.000888 gp_port_library_list (2): found mtab fsname tmpfs -0.000901 gp_port_library_list (2): found mtab fsname gvfsd-fuse -0.000906 gp_port_library_list (2): found mtab fsname portal -0.000910 gp_port_library_list (2): found mtab fsname /dev/loop6 -0.000916 gp_port_library_list (2): found mtab fsname /dev/loop5 -0.000944 foreach_func (2): Loaded '' ('^disk:') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/disk'. -0.000951 foreach_func (2): Called for filename '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/ptpip'. -0.001028 foreach_func (2): Loaded 'PTP/IP Connection' ('ptpip:') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/ptpip'. -0.001039 foreach_func (2): Loaded '' ('^ptpip:') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/ptpip'. -0.001043 foreach_func (2): Loaded 'IP Connection' ('ip:') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/ptpip'. -0.001047 foreach_func (2): Loaded '' ('^ip:') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/ptpip'. -0.001050 foreach_func (2): Called for filename '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/serial'. -0.001185 foreach_func (2): Loaded 'Serial Port 0' ('serial:/dev/ttyS0') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/serial'. -0.001195 foreach_func (2): Loaded 'Serial Port 1' ('serial:/dev/ttyS1') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/serial'. -0.001199 foreach_func (2): Loaded 'Serial Port 2' ('serial:/dev/ttyS2') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/serial'. -0.001209 foreach_func (2): Loaded 'Serial Port 3' ('serial:/dev/ttyS3') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/serial'. -0.001213 foreach_func (2): Loaded 'Serial Port Device' ('serial:') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/serial'. -0.001217 foreach_func (2): Loaded '' ('^serial:') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/serial'. -0.001220 foreach_func (2): Called for filename '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/usb1'. -0.004838 foreach_func (2): Loaded '' ('^usb:') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/usb1'. -0.004854 foreach_func (2): Loaded 'Universal Serial Bus' ('usb:004,085') from '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/usb1'. -0.004858 foreach_func (2): Called for filename '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/usbdiskdirect'. -0.005001 foreach_func (2): Called for filename '/usr/lib/x86_64-linux-gnu/libgphoto2_port/0.12.0/usbscsi'. -0.005143 gp_port_info_list_count (2): Counting entries (13 available)... -0.005153 gp_port_info_list_count (2): 8 regular entries available. -0.005162 gp_abilities_list_load_dir (2): Using ltdl to load camera libraries from '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27'... -0.005195 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/ax203'. -0.005201 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/canon'. -0.005204 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/digigr8'. -0.005207 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/dimagev'. -0.005210 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/directory'. -0.005213 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/docupen'. -0.005216 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/jl2005a'. -0.005218 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/jl2005c'. -0.005221 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/kodak_dc240'. -0.005224 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/lumix'. -0.005227 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/mars'. -0.005230 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/pentax'. -0.005233 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/ptp2'. -0.005236 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/ricoh_g3'. -0.005238 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/sierra'. -0.005241 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/sonix'. -0.005244 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/sq905'. -0.005247 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/st2205'. -0.005250 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/topfield'. -0.005253 foreach_func (2): Found '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/tp6801'. -0.005257 gp_abilities_list_load_dir (2): Found 20 camera drivers. -0.027068 gp_port_info_list_count (2): Counting entries (13 available)... -0.027097 gp_port_info_list_count (2): 8 regular entries available. -0.027115 gp_port_new (2): Creating new device... -0.027119 gp_port_info_list_get_info (2): Getting info of entry 0 (13 available)... -0.027240 gp_port_set_settings (2): Setting settings... -0.027263 gp_port_info_list_get_info (2): Getting info of entry 1 (13 available)... -0.027324 gp_port_set_settings (2): Setting settings... -0.027333 gp_port_info_list_get_info (2): Getting info of entry 2 (13 available)... -0.027445 gp_port_set_timeout (2): Setting port timeout to 500 milliseconds. -0.027465 gp_port_set_settings (2): Setting settings... -0.027469 gp_port_info_list_get_info (2): Getting info of entry 3 (13 available)... -0.027542 gp_port_set_timeout (2): Setting port timeout to 500 milliseconds. -0.027550 gp_port_set_settings (2): Setting settings... -0.027554 gp_port_info_list_get_info (2): Getting info of entry 4 (13 available)... -0.027609 gp_port_set_timeout (2): Setting port timeout to 500 milliseconds. -0.027619 gp_port_set_settings (2): Setting settings... -0.027622 gp_port_info_list_get_info (2): Getting info of entry 5 (13 available)... -0.027677 gp_port_set_timeout (2): Setting port timeout to 500 milliseconds. -0.027682 gp_port_set_settings (2): Setting settings... -0.027685 gp_port_info_list_get_info (2): Getting info of entry 6 (13 available)... -0.027739 gp_port_set_timeout (2): Setting port timeout to 500 milliseconds. -0.027746 gp_port_set_settings (2): Setting settings... -0.027749 gp_port_info_list_get_info (2): Getting info of entry 7 (13 available)... -0.031226 gp_port_set_timeout (2): Setting port timeout to 5000 milliseconds. -0.031261 gp_port_set_settings (2): Setting settings... -0.031272 gp_libusb1_update (2): (old int=0, conf=-1, alt=-1) port usb:004,085, (new int=0, conf=-1, alt=-1) port usb:004,085 -0.031275 gp_libusb1_update (2): lowlevel libusb1 port not yet opened, no need for libusb changes -0.031279 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras... -0.031399 gp_libusb1_find_device_lib (2): Looking for USB device (vendor 0x4a9, product 0x31cf)... found. -0.031462 gp_libusb1_find_device_lib (2): Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01 -0.031469 gp_abilities_list_detect_usb(2): Found 'Canon EOS 500D' (0x4a9,0x31cf) -0.031491 gp_port_free (2): Freeing port... -0.031496 gp_port_close (2): Closing port... -0.031679 gp_camera_set_abilities (2): Setting abilities ('Canon EOS 500D')... -0.031705 gp_setting_set (2): Setting key 'model' to value 'Canon EOS 500D' (gphoto2) -0.031710 save_settings (2): Saving 3 setting(s) to file "/home/paul/.gphoto/settings" -0.031807 gp_port_info_list_lookup_path(2): Looking for path 'usb:004,085' (13 entries available)... -0.031817 gp_port_info_list_get_info (2): Getting info of entry 7 (13 available)... -0.031822 gp_camera_set_port_info (2): Setting port info for port 'Universal Serial Bus' at 'usb:004,085'... -0.035436 gp_port_set_timeout (2): Setting port timeout to 5000 milliseconds. -0.035454 gp_port_set_settings (2): Setting settings... -0.035481 gp_libusb1_update (2): (old int=0, conf=-1, alt=-1) port usb:004,085, (new int=0, conf=-1, alt=-1) port usb:004,085 -0.035485 gp_libusb1_update (2): lowlevel libusb1 port not yet opened, no need for libusb changes -0.035489 gp_setting_set (2): Setting key 'port' to value 'usb:004,085' (gphoto2) -0.035494 save_settings (2): Saving 3 setting(s) to file "/home/paul/.gphoto/settings" -0.035623 gp_camera_init (2): Initializing camera... -0.035662 gp_libusb1_find_device_lib (2): Looking for USB device (vendor 0x4a9, product 0x31cf)... found. -0.035692 gp_libusb1_find_device_lib (2): Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01 -0.035710 gp_camera_init (2): Loading '/usr/lib/x86_64-linux-gnu/libgphoto2/2.5.27/ptp2'... -0.036520 gp_port_open (2): Opening USB port... -0.036531 gp_libusb1_open (2): () -0.036606 gp_libusb1_open (2): claiming interface 0 -0.036614 gp_libusb1_open [libusb1.c:437](0): 'libusb_claim_interface (port->pl->dh, port->settings.usb.interface)' failed: Resource busy (-6) -0.036637 gp_port_set_error [gphoto2-port.c:1190](0): Could not claim interface 0 (Device or resource busy). Make sure no other program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. -0.036743 gp_context_error (0): An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Device or resource busy). Make sure no other program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. -0.037144 gp_camera_free (2): Freeing camera... -0.037153 gp_port_free (2): Freeing port... -0.037156 gp_port_close (2): Closing port... -0.038265 gp_port_set_error [gphoto2-port.c:1190](0): Could not release interface 0 (Device or resource busy). -0.038357 gp_filesystem_reset (2): resetting filesystem -0.038367 gp_filesystem_lru_clear (2): Clearing fscache LRU list... -0.038370 gp_filesystem_lru_clear (2): fscache LRU list already empty -0.038374 delete_all_folders (2): Internally deleting all folders from '/'... -0.038377 lookup_folder (2): Lookup folder '/'... -0.038381 lookup_folder (2): Found! / is 0x55556a5ad960 -0.038384 recurse_delete_folder (2): Recurse delete folder 0x55556a5ad960// -0.038387 delete_all_files (2): Delete all files in folder 0x55556a5ad960// diff --git a/src/isnd/Services/EmailSender.cs b/src/isnd/Services/EmailSender.cs index 238afda..31b85e7 100644 --- a/src/isnd/Services/EmailSender.cs +++ b/src/isnd/Services/EmailSender.cs @@ -42,18 +42,8 @@ namespace isnd.Services using (var client = new SmtpClient()) { client.ServerCertificateValidationCallback = (s,c,h,e)=>true; - if (Env.IsDevelopment() || Options.UserName == null) - { - await client.ConnectAsync(Options.Server, Options.Port, MailKit.Security.SecureSocketOptions.None); - } - else - { - await client.ConnectAsync(Options.Server); - } - if (Options.UserName != null) - { - await client.AuthenticateAsync(Options.UserName, Options.Password); - } + await client.ConnectAsync(Options.Server); + await client.AuthenticateAsync(Options.UserName, Options.Password); await client.SendAsync(message); await client.DisconnectAsync(true); } diff --git a/src/isnd/Startup.cs b/src/isnd/Startup.cs index 6f29b48..7c000a3 100644 --- a/src/isnd/Startup.cs +++ b/src/isnd/Startup.cs @@ -58,14 +58,14 @@ namespace isnd .AddDbContext(options => options.UseNpgsql( Configuration.GetConnectionString("DefaultConnection"))) - .AddIdentity() + .AddIdentity() .AddRoles() .AddEntityFrameworkStores() - .AddSignInManager() - .AddDefaultUI() - .AddDefaultTokenProviders(); + .AddSignInManager() + .AddDefaultUI() + .AddDefaultTokenProviders(); - services.AddMvc(o=>o.EnableEndpointRouting = false); + services.AddMvc(o => o.EnableEndpointRouting = false); services.AddDataProtection(); @@ -106,9 +106,10 @@ namespace isnd }); services.AddControllersWithViews() - .AddNewtonsoftJson(s => { - s.SerializerSettings.ReferenceResolverProvider = () => new NSJWebApiReferenceResolver(); - } ); + .AddNewtonsoftJson(s => + { + s.SerializerSettings.ReferenceResolverProvider = () => new NSJWebApiReferenceResolver(); + }); services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo @@ -136,8 +137,8 @@ namespace isnd // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, - ApplicationDbContext dbContext, - IOptions isnSettingsOption ) + ApplicationDbContext dbContext, + IOptions isnSettingsOption) { if (env.IsDevelopment()) { diff --git a/src/isnd/Services/RegistrationPageIndexQueryAndResult.cs b/src/isnd/ViewModels/RegistrationPageIndexQueryAndResult.cs similarity index 100% rename from src/isnd/Services/RegistrationPageIndexQueryAndResult.cs rename to src/isnd/ViewModels/RegistrationPageIndexQueryAndResult.cs