add sidebar link
This commit is contained in:
		| @ -7,7 +7,6 @@ async function register({ | ||||
|   peertubeHelpers, | ||||
|   registerClientRoute, | ||||
| }) { | ||||
|    | ||||
|   /** | ||||
|    * Add link admin page | ||||
|    */ | ||||
| @ -39,6 +38,44 @@ async function register({ | ||||
|     }, | ||||
|   }); | ||||
|  | ||||
|   registerHook({ | ||||
|     target: "filter:left-menu.links.create.result", | ||||
|     handler: (links) => { | ||||
|       if (!Array.isArray(links)) { | ||||
|         return links; | ||||
|       } | ||||
|       let myLibraryLinks; | ||||
|       // Searching the 'in-my-library' entry. | ||||
|       for (const link of links) { | ||||
|         if (typeof link !== "object") { | ||||
|           continue; | ||||
|         } | ||||
|         if (!("key" in link)) { | ||||
|           continue; | ||||
|         } | ||||
|         if (link.key === "in-my-library" || link.key === "my-video-space") { | ||||
|           myLibraryLinks = link; | ||||
|           break; | ||||
|         } | ||||
|       } | ||||
|       if (!myLibraryLinks) { | ||||
|         return links; | ||||
|       } | ||||
|       if (!Array.isArray(myLibraryLinks.links)) { | ||||
|         return links; | ||||
|       } | ||||
|  | ||||
|       const label = "NCTV Storage"; | ||||
|       myLibraryLinks.links.unshift({ | ||||
|         label, | ||||
|         shortLabel: label, | ||||
|         path: "/p/ncd-my-subscription", | ||||
|         icon: "trending", | ||||
|       }); | ||||
|       return links; | ||||
|     }, | ||||
|   }); | ||||
|  | ||||
|   // Register routes | ||||
|   registerClientRoute({ | ||||
|     route: "ncd-my-subscription", | ||||
|  | ||||
		Reference in New Issue
	
	Block a user