diff --git a/README.md b/README.md index 05c655d..9e9dc8a 100644 --- a/README.md +++ b/README.md @@ -71,12 +71,12 @@ sudo ln -s /usr/local/lib/isn/isn /usr/local/bin/isn set -e # compiler tout dotnet build -c Release -dotnet publish -c Release -f net6.0 src/isnd +dotnet publish -c Release -f net7.0 src/isnd # MAJ du serveur sudo systemctl stop isnd -sudo cp -a src/isnd/bin/Release/net6.0/publish/* /srv/www/isnd +sudo cp -a src/isnd/bin/Release/net7.0/publish/* /srv/www/isnd sudo systemctl start isnd # MAJ du client -sudo cp -a src/isn/bin/Release/net6.0/* /usr/local/lib/isn +sudo cp -a src/isn/bin/Release/net7.0/* /usr/local/lib/isn sudo chown -R root.root /usr/local/lib/isn ```` diff --git a/my-logfile.txt b/my-logfile.txt new file mode 100644 index 0000000..a39035e --- /dev/null +++ b/my-logfile.txt @@ -0,0 +1,196 @@ +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/isn.abst/Constants.cs b/src/isn.abst/Constants.cs index e562734..59ab714 100644 --- a/src/isn.abst/Constants.cs +++ b/src/isn.abst/Constants.cs @@ -5,5 +5,6 @@ namespace isn.abst public const string PaquetFileEstension = "nupkg"; public const string SpecFileEstension = "nuspec"; public const string JsonFileEstension = "json"; + public const string PackageRootServerPrefix = "~/pkgs/"; } } \ No newline at end of file diff --git a/src/isnd/Controllers/Packages/ApiIndex.cs b/src/isnd/Controllers/Packages/ApiIndex.cs index 0264abd..56930cf 100644 --- a/src/isnd/Controllers/Packages/ApiIndex.cs +++ b/src/isnd/Controllers/Packages/ApiIndex.cs @@ -1,35 +1,39 @@ -using System.ComponentModel.DataAnnotations; -using System.IO; -using System.Linq; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using NuGet.Versioning; -using isnd.Data; using isnd.Entities; -using Unleash; using isnd.Services; -using isnd.ViewModels; -using System.Threading.Tasks; -using isnd.Interfaces; using isn.Abstract; using isn.abst; +using isnd.Interfaces; +using Unleash; +using System.Linq; + namespace isnd.Controllers { /// - /// Packages Controller + /// Api Controller /// - public partial class PackagesController : Controller + public class ApiController : Controller { + private readonly IPackageManager packageManager; + private readonly Resource[] resources; + + /// + /// Api Controller Constructor + /// + /// + /// + public ApiController(IPackageManager pm, IUnleash unleashĈlient) + { + packageManager = pm; + resources = packageManager.GetResources(unleashĈlient).ToArray(); + } + /// /// API index /// /// - [HttpGet(_pkgRootPrefix + ApiConfig.IndexDotJson)] + [HttpGet(Constants.PackageRootServerPrefix + ApiConfig.IndexDotJson)] public IActionResult ApiIndex() { return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl + ApiConfig.IndexDotJson){ Version = PackageManager.BASE_API_LEVEL, Resources = resources }); diff --git a/src/isnd/Controllers/Packages/AutoComplete.cs b/src/isnd/Controllers/Packages/PackagesController.AutoComplete.cs similarity index 86% rename from src/isnd/Controllers/Packages/AutoComplete.cs rename to src/isnd/Controllers/Packages/PackagesController.AutoComplete.cs index bb025a5..6f1fbf6 100644 --- a/src/isnd/Controllers/Packages/AutoComplete.cs +++ b/src/isnd/Controllers/Packages/PackagesController.AutoComplete.cs @@ -1,14 +1,15 @@ using isnd.Services; using isnd.Entities; using Microsoft.AspNetCore.Mvc; +using isn.abst; namespace isnd.Controllers { - public partial class PackagesController + public partial class PackagesController { // GET /autocomplete?id=isn.protocol&prerelease=true - [HttpGet(_pkgRootPrefix + ApiConfig.AutoComplete)] + [HttpGet(Constants.PackageRootServerPrefix + ApiConfig.AutoComplete)] public IActionResult AutoComplete( string id, string semVerLevel, diff --git a/src/isnd/Controllers/Packages/Catalog.cs b/src/isnd/Controllers/Packages/PackagesController.Catalog.cs similarity index 82% rename from src/isnd/Controllers/Packages/Catalog.cs rename to src/isnd/Controllers/Packages/PackagesController.Catalog.cs index 8b79352..950291d 100644 --- a/src/isnd/Controllers/Packages/Catalog.cs +++ b/src/isnd/Controllers/Packages/PackagesController.Catalog.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using NuGet.Versioning; using isnd.Data.Packages.Catalog; using isnd.Data.Catalog; +using isn.abst; namespace isnd.Controllers { @@ -15,14 +16,14 @@ namespace isnd.Controllers { // https://docs.microsoft.com/en-us/nuget/api/catalog-resource#versioning - [HttpGet(_pkgRootPrefix + ApiConfig.Catalog)] + [HttpGet(Constants.PackageRootServerPrefix + ApiConfig.Catalog)] public async Task CatalogIndex() { return Ok(await packageManager.GetCatalogIndexAsync()); } - [HttpGet(_pkgRootPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")] + [HttpGet(Constants.PackageRootServerPrefix + "{apiVersion}/" + ApiConfig.Registration + "/{id}/{lower}.json")] public async Task CatalogRegistration(string apiVersion, string id, string lower) { if (lower.Equals("index", System.StringComparison.InvariantCultureIgnoreCase)) @@ -38,7 +39,7 @@ namespace isnd.Controllers return Ok(index); } // return a Package - var leaf = await packageManager.GetCatalogLeafAsync(id, lower, null); + var leaf = await packageManager.GetCatalogEntryAsync(id, lower, null); if (null == leaf) return NotFound(new { id, lower }); return Ok(leaf); diff --git a/src/isnd/Controllers/Packages/Delete.cs b/src/isnd/Controllers/Packages/PackagesController.Delete.cs similarity index 85% rename from src/isnd/Controllers/Packages/Delete.cs rename to src/isnd/Controllers/Packages/PackagesController.Delete.cs index dcb3a7d..74c193e 100644 --- a/src/isnd/Controllers/Packages/Delete.cs +++ b/src/isnd/Controllers/Packages/PackagesController.Delete.cs @@ -5,12 +5,13 @@ using isnd.Entities; using System.ComponentModel.DataAnnotations; using isnd.Attributes; using System.Security.Claims; +using isn.abst; namespace isnd.Controllers { public partial class PackagesController { - [HttpDelete(_pkgRootPrefix + ApiConfig.Delete + "/{id}/{lower?}/{type?}")] + [HttpDelete(Constants.PackageRootServerPrefix + ApiConfig.Delete + "/{id}/{lower?}/{type?}")] public async Task ApiDelete( [FromRoute][SafeName][Required] string id, [FromRoute][SafeName][Required] string lower, diff --git a/src/isnd/Controllers/Packages/Files.cs b/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs similarity index 88% rename from src/isnd/Controllers/Packages/Files.cs rename to src/isnd/Controllers/Packages/PackagesController.GetPackage.cs index 3de8c81..b044ae7 100644 --- a/src/isnd/Controllers/Packages/Files.cs +++ b/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs @@ -11,7 +11,7 @@ namespace isnd.Controllers public partial class PackagesController { // Web get the paquet - [HttpGet(_pkgRootPrefix + ApiConfig.GetPackage + "/{id}/{lower}/{idf}-{lowerf}." + [HttpGet(Constants.PackageRootServerPrefix + ApiConfig.GetPackage + "/{id}/{lower}/{idf}-{lowerf}." + Constants.PaquetFileEstension)] public IActionResult GetPackage( [FromRoute][SafeName][Required] string id, @@ -32,7 +32,7 @@ namespace isnd.Controllers } // Web get spec - [HttpGet(_pkgRootPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}-{lowerf}." + [HttpGet(Constants.PackageRootServerPrefix + Constants.SpecFileEstension + "/{id}/{lower}/{idf}-{lowerf}." + Constants.SpecFileEstension)] public IActionResult GetNuspec( [FromRoute][SafeName][Required] string id, diff --git a/src/isnd/Controllers/Packages/GetVersions.cs b/src/isnd/Controllers/Packages/PackagesController.GetVersions.cs similarity index 89% rename from src/isnd/Controllers/Packages/GetVersions.cs rename to src/isnd/Controllers/Packages/PackagesController.GetVersions.cs index dc66721..5cdda12 100644 --- a/src/isnd/Controllers/Packages/GetVersions.cs +++ b/src/isnd/Controllers/Packages/PackagesController.GetVersions.cs @@ -7,7 +7,7 @@ namespace isnd.Controllers { public partial class PackagesController { - [HttpGet(_pkgRootPrefix + ApiConfig.GetVersion + "/{id}/{lower}/" + ApiConfig.IndexDotJson)] + [HttpGet(Constants.PackageRootServerPrefix + ApiConfig.GetVersion + "/{id}/{lower}/" + ApiConfig.IndexDotJson)] public IActionResult GetVersions( string id, string lower, diff --git a/src/isnd/Controllers/Packages/Put.cs b/src/isnd/Controllers/Packages/PackagesController.Put.cs similarity index 99% rename from src/isnd/Controllers/Packages/Put.cs rename to src/isnd/Controllers/Packages/PackagesController.Put.cs index 7f502fe..f1570e8 100644 --- a/src/isnd/Controllers/Packages/Put.cs +++ b/src/isnd/Controllers/Packages/PackagesController.Put.cs @@ -25,7 +25,7 @@ namespace isnd.Controllers public partial class PackagesController { // TODO [Authorize(Policy = IsndConstants.RequireValidApiKey)] - [HttpPut(_pkgRootPrefix + ApiConfig.Publish)] + [HttpPut(Constants.PackageRootServerPrefix + ApiConfig.Publish)] public async Task Put() { try diff --git a/src/isnd/Controllers/Packages/Search.cs b/src/isnd/Controllers/Packages/PackagesController.Search.cs similarity index 87% rename from src/isnd/Controllers/Packages/Search.cs rename to src/isnd/Controllers/Packages/PackagesController.Search.cs index 2bf3ada..8a67c63 100644 --- a/src/isnd/Controllers/Packages/Search.cs +++ b/src/isnd/Controllers/Packages/PackagesController.Search.cs @@ -3,6 +3,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using isnd.Entities; +using isn.abst; namespace isnd.Controllers { @@ -10,7 +11,7 @@ namespace isnd.Controllers public partial class PackagesController { // GET {@id}?q={QUERY}&skip={SKIP}&take={TAKE}&prerelease={PRERELEASE}&semVerLevel={SEMVERLEVEL}&packageType={PACKAGETYPE} - [HttpGet(_pkgRootPrefix + ApiConfig.Search)] + [HttpGet(Constants.PackageRootServerPrefix + ApiConfig.Search)] public IActionResult Search( string q, int skip = 0, diff --git a/src/isnd/Controllers/Packages/WebViews.cs b/src/isnd/Controllers/Packages/PackagesController.WebViews.cs similarity index 100% rename from src/isnd/Controllers/Packages/WebViews.cs rename to src/isnd/Controllers/Packages/PackagesController.WebViews.cs diff --git a/src/isnd/Controllers/Packages/Ctor.cs b/src/isnd/Controllers/Packages/PackagesController.cs similarity index 97% rename from src/isnd/Controllers/Packages/Ctor.cs rename to src/isnd/Controllers/Packages/PackagesController.cs index 3c6a9a5..ddf9e69 100644 --- a/src/isnd/Controllers/Packages/Ctor.cs +++ b/src/isnd/Controllers/Packages/PackagesController.cs @@ -31,7 +31,6 @@ namespace isnd.Controllers readonly ApplicationDbContext dbContext; private readonly IPackageManager packageManager; private readonly IUnleash unleashĈlient; - const string _pkgRootPrefix = "~/"; public PackagesController( ILoggerFactory loggerFactory, diff --git a/src/isnd/Data/Catalog/CatalogEntry.cs b/src/isnd/Data/Catalog/CatalogEntry.cs index 89581c8..be8c858 100644 --- a/src/isnd/Data/Catalog/CatalogEntry.cs +++ b/src/isnd/Data/Catalog/CatalogEntry.cs @@ -38,7 +38,7 @@ namespace isnd.Data.Catalog [JsonProperty("@type")] - public string[] RefType { get; set; } + public string[] RefType { get; protected set; } = new string[] { "PackageDetail" }; [JsonProperty("commitId")] public string CommitId { get; set; } diff --git a/src/isnd/Interfaces/IPackageManager.cs b/src/isnd/Interfaces/IPackageManager.cs index 12a9d96..8e5c2b2 100644 --- a/src/isnd/Interfaces/IPackageManager.cs +++ b/src/isnd/Interfaces/IPackageManager.cs @@ -24,8 +24,8 @@ namespace isnd.Interfaces Task DeletePackageAsync(string pkgid, string version, string type); Task UserAskForPackageDeletionAsync(string userid, string pkgId, string lower, string type); Task GetPackageAsync(string pkgid, string version, string type); - Task GetCatalogLeafAsync(string pkgId, string version, string pkgType); - IEnumerable SearchById(string pkgId, string semver, string pkgType); + Task GetCatalogEntryAsync(string pkgId, string version, string pkgType); + IEnumerable SearchCatalogEntriesById(string pkgId, string semver, string pkgType); Task GetCatalogIndexAsync(); Task GetPackageRegistrationIndexAsync(RegistrationPageIndexQuery query); diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs index d9f79cb..2dc301e 100644 --- a/src/isnd/Services/PackageManager.cs +++ b/src/isnd/Services/PackageManager.cs @@ -234,7 +234,7 @@ namespace isnd.Services ); } - public async Task GetCatalogLeafAsync(string pkgId, string semver = null, string pkgType = null) + public async Task GetCatalogEntryAsync(string pkgId, string semver = null, string pkgType = null) { return (await dbContext.PackageVersions .Include(v => v.Package) @@ -258,7 +258,7 @@ namespace isnd.Services public string BID { get => $"{extUrl}v3.4.0/{ApiConfig.Registration}"; } - public IEnumerable SearchById(string pkgId, string semver, string pkgType) + public IEnumerable SearchCatalogEntriesById(string pkgId, string semver, string pkgType) { return dbContext.PackageVersions