ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

82 lines
1.6 KiB

  1. import { pick } from '@peertube/peertube-core-utils'
  2. import {
  3. VideoChannelsSearchQueryAfterSanitize,
  4. VideoPlaylistsSearchQueryAfterSanitize,
  5. VideosCommonQueryAfterSanitize,
  6. VideosSearchQueryAfterSanitize
  7. } from '@peertube/peertube-models'
  8. function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) {
  9. return pick(query, [
  10. 'start',
  11. 'count',
  12. 'sort',
  13. 'nsfw',
  14. 'isLive',
  15. 'categoryOneOf',
  16. 'licenceOneOf',
  17. 'languageOneOf',
  18. 'privacyOneOf',
  19. 'tagsOneOf',
  20. 'tagsAllOf',
  21. 'isLocal',
  22. 'include',
  23. 'skipCount',
  24. 'hasHLSFiles',
  25. 'hasWebtorrentFiles', // TODO: Remove in v7
  26. 'hasWebVideoFiles',
  27. 'search',
  28. 'excludeAlreadyWatched',
  29. 'autoTagOneOf'
  30. ])
  31. }
  32. function pickSearchVideoQuery (query: VideosSearchQueryAfterSanitize) {
  33. return {
  34. ...pickCommonVideoQuery(query),
  35. ...pick(query, [
  36. 'searchTarget',
  37. 'host',
  38. 'startDate',
  39. 'endDate',
  40. 'originallyPublishedStartDate',
  41. 'originallyPublishedEndDate',
  42. 'durationMin',
  43. 'durationMax',
  44. 'uuids'
  45. ])
  46. }
  47. }
  48. function pickSearchChannelQuery (query: VideoChannelsSearchQueryAfterSanitize) {
  49. return pick(query, [
  50. 'searchTarget',
  51. 'search',
  52. 'start',
  53. 'count',
  54. 'sort',
  55. 'host',
  56. 'handles'
  57. ])
  58. }
  59. function pickSearchPlaylistQuery (query: VideoPlaylistsSearchQueryAfterSanitize) {
  60. return pick(query, [
  61. 'searchTarget',
  62. 'search',
  63. 'start',
  64. 'count',
  65. 'sort',
  66. 'host',
  67. 'uuids'
  68. ])
  69. }
  70. export {
  71. pickCommonVideoQuery,
  72. pickSearchVideoQuery,
  73. pickSearchPlaylistQuery,
  74. pickSearchChannelQuery
  75. }