Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca1399c60c | ||
|
|
1acf1da00d | ||
|
|
55c811adb7 | ||
|
|
0bbb876a84 | ||
|
|
8b15d1113b | ||
|
|
ff35ad61ab | ||
|
|
b8fd099d5c | ||
|
|
795435ff4b |
No files matched your search
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.23.6] - 2024-05-23
|
||||
|
||||
### Added
|
||||
|
||||
- A dev setting to clear the cache
|
||||
|
||||
### Fixed
|
||||
|
||||
- A bug where bookmarked channels can be duplicated
|
||||
- A bug where video cast from web app would not play if there's an error dialog on screen
|
||||
- failed to create media player error, by waiting for previous video to stop before starting a new one
|
||||
|
||||
### Changed
|
||||
|
||||
- Font weight to be less bold
|
||||
|
||||
## [0.23.5] - 2024-05-19
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
||||
|
||||
info:
|
||||
title: Playlet Web API
|
||||
version: 0.23.5
|
||||
version: 0.23.6
|
||||
description:
|
||||
Playlet Web API is a RESTful API for controlling the Playlet app on
|
||||
Roku devices. The API is intended to be used by the Playlet web app, but can
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"hasInstallScript": true,
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.21",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.21",
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.23.5"
|
||||
"version": "0.23.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf ../build/playlet-app",
|
||||
|
||||
@@ -33,7 +33,7 @@ end function
|
||||
|
||||
function GetLoadingMessagesFromCache() as object
|
||||
messagesFile = ReadAsciiFile("cachefs:/loading_messages_v1.json")
|
||||
if messagesFile = invalid or messagesFile = ""
|
||||
if messagesFile = ""
|
||||
return invalid
|
||||
end if
|
||||
return ParseJson(messagesFile)
|
||||
|
||||
@@ -3,7 +3,7 @@ title=Playlet
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=23
|
||||
build_version=00005
|
||||
build_version=00006
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.23.5"
|
||||
"version": "0.23.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf ../build/playlet-lib",
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</interface>
|
||||
<children>
|
||||
<Font id="normalFont" uri="font:SystemFontFile" size="24" />
|
||||
<Font id="boldFont" uri="font:BoldSystemFontFile" size="24" />
|
||||
<Font id="boldFont" uri="font:MediumSystemFontFile" size="24" />
|
||||
<Group id="anchor">
|
||||
<Poster
|
||||
id="background"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
horizAlign="center"
|
||||
width="400"
|
||||
translation="[0, 380]">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="18" />
|
||||
</Label>
|
||||
</StdDlgSideCardArea>
|
||||
</children>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
width="500"
|
||||
maxLines="3"
|
||||
wrap="true">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="36" />
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="36" />
|
||||
</Label>
|
||||
<Label
|
||||
id="subtitleLabel"
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
width="200"
|
||||
horizAlign="center"
|
||||
translation="[0,210]">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="26" />
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="26" />
|
||||
</Label>
|
||||
<Label
|
||||
id="ServerLabel"
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
</interface>
|
||||
<children>
|
||||
<Font id="normalFont" uri="font:SystemFontFile" size="24" />
|
||||
<Font id="boldFont" uri="font:BoldSystemFontFile" size="26" />
|
||||
<Font id="boldFont" uri="font:MediumSystemFontFile" size="24" />
|
||||
|
||||
<Group translation="[20,50]">
|
||||
<Group
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
id="WifiNameLabel"
|
||||
color="#4287f5"
|
||||
translation="[0,250]">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="28" />
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="28" />
|
||||
</Label>
|
||||
</LayoutGroup>
|
||||
</Group>
|
||||
@@ -150,7 +150,7 @@
|
||||
id="LinkCodeLabel"
|
||||
font="font:LargeBoldSystemFont"
|
||||
color="#4287f5">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="48" />
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="48" />
|
||||
</Label>
|
||||
</LayoutGroup>
|
||||
</Group>
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
color="#000000"
|
||||
opacity="0.5">
|
||||
</Rectangle>
|
||||
<Font id="HeaderFont" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Font id="HeaderFont" uri="font:MediumSystemFontFile" size="18" />
|
||||
<Font id="ItemFont" uri="font:SystemFontFile" size="18" />
|
||||
<Font id="ItemFocusedFont" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Font id="ItemFocusedFont" uri="font:MediumSystemFontFile" size="18" />
|
||||
<Rectangle
|
||||
width="1200"
|
||||
height="543"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/utils/CacheUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
|
||||
function Init()
|
||||
m.top.focusable = true
|
||||
m.top.itemSpacings = [8]
|
||||
m.button = m.top.findNode("Button")
|
||||
m.button.observeField("buttonSelected", FuncName(OnButtonSelected))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
end if
|
||||
NodeSetFocus(m.button, true)
|
||||
end function
|
||||
|
||||
function BindPreference(_preferences as object, _key as string)
|
||||
' Do nothing
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
CacheUtils.Clear()
|
||||
DialogUtils.ShowDialog(Tr(Locale.Settings.CacheCleared), Tr(Locale.Generic.Success))
|
||||
end function
|
||||
@@ -0,0 +1,19 @@
|
||||
<component name="ClearCacheControl" extends="LayoutGroup" includes="Focus">
|
||||
<interface>
|
||||
<field id="displayText" type="string" alias="Button.text" />
|
||||
<field id="description" type="string" alias="DescriptionLabel.text" />
|
||||
<function name="BindPreference" />
|
||||
</interface>
|
||||
<children>
|
||||
<Button
|
||||
id="Button"
|
||||
minWidth="340"
|
||||
showFocusFootprint="true" />
|
||||
<Label id="DescriptionLabel"
|
||||
width="450"
|
||||
color="0xb4b4b4ff"
|
||||
wrap="true">
|
||||
<Font role="font" uri="font:SystemFontFile" size="18" />
|
||||
</Label>
|
||||
</children>
|
||||
</component>
|
||||
@@ -11,7 +11,7 @@
|
||||
</interface>
|
||||
<children>
|
||||
<Font id="smallestSystemFont" uri="font:SystemFontFile" size="18" />
|
||||
<Font id="smallestBoldSystemFont" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Font id="smallestBoldSystemFont" uri="font:MediumSystemFontFile" size="18" />
|
||||
|
||||
<LayoutGroup
|
||||
itemSpacings="[24,5,5]">
|
||||
|
||||
@@ -222,13 +222,13 @@ function InitContent() as void
|
||||
node: m.top
|
||||
feeds: m.top.feeds
|
||||
}, OnVideoRowListContentTaskResult)
|
||||
m.pendingLoadTasks[task.id] = task
|
||||
m.pendingLoadTasks[task.id] = { task: task }
|
||||
end function
|
||||
|
||||
function CancelCurrentTasks()
|
||||
pendingLoadTasks = m.pendingLoadTasks
|
||||
for each id in pendingLoadTasks
|
||||
task = pendingLoadTasks[id]
|
||||
task = pendingLoadTasks[id].task
|
||||
task.cancel = true
|
||||
end for
|
||||
m.pendingLoadTasks = {}
|
||||
@@ -287,7 +287,16 @@ function GetRowsToLoad() as object
|
||||
return subContentNodes
|
||||
end function
|
||||
|
||||
function LoadRowContent(contentNode as object)
|
||||
function LoadRowContent(contentNode as object) as void
|
||||
' Do not spin up multiple tasks for the same content node
|
||||
for each id in m.pendingLoadTasks
|
||||
pendingTask = m.pendingLoadTasks[id]
|
||||
if contentNode.isSameNode(pendingTask.content) and pendingTask.task.state = "run"
|
||||
LogInfo("Row content already loading:", contentNode.title)
|
||||
return
|
||||
end if
|
||||
end for
|
||||
|
||||
LogInfo("Loading row content:", contentNode.title)
|
||||
|
||||
contentNode.loadState = FeedLoadState.Loading
|
||||
@@ -296,7 +305,7 @@ function LoadRowContent(contentNode as object)
|
||||
feedContentNode: contentNode
|
||||
invidious: m.invidious
|
||||
}, OnVideoRowListRowContentTaskResult)
|
||||
m.pendingLoadTasks[task.id] = task
|
||||
m.pendingLoadTasks[task.id] = { task: task, content: contentNode }
|
||||
end function
|
||||
|
||||
function OnVideoRowListRowContentTaskResult(output as object) as void
|
||||
|
||||
@@ -48,7 +48,7 @@ function Init()
|
||||
end if
|
||||
|
||||
httpAgent = m.top.getHttpAgent()
|
||||
httpAgent.AddHeader("User-Agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0")
|
||||
httpAgent.AddHeader("User-Agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0")
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
@@ -155,20 +155,60 @@ function OnVideoContentTaskResults(output as object) as void
|
||||
end if
|
||||
end if
|
||||
|
||||
m.top.control = "play"
|
||||
PlayAfterPreviousPlayerHasStopped()
|
||||
|
||||
if hasTimestamp and timestamp > 0
|
||||
m.top.seek = content.timestamp
|
||||
end if
|
||||
end function
|
||||
|
||||
function PlayAfterPreviousPlayerHasStopped() as void
|
||||
previousPlayer = m.top.previousPlayer
|
||||
m.top.previousPlayer = invalid
|
||||
|
||||
if previousPlayer = invalid
|
||||
m.top.control = "play"
|
||||
return
|
||||
end if
|
||||
|
||||
previousPlayerState = previousPlayer.state
|
||||
LogInfo("Previous player state:", previousPlayerState)
|
||||
|
||||
if previousPlayerState = "stopping"
|
||||
previousPlayer.observeFieldScoped("state", FuncName(OnPreviousPlayerState))
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.control = "play"
|
||||
end function
|
||||
|
||||
function OnPreviousPlayerState(event as object) as void
|
||||
previousPlayer = event.getRoSGNode()
|
||||
|
||||
if m.onCloseCalled = true
|
||||
previousPlayer.unobserveFieldScoped("state")
|
||||
return
|
||||
end if
|
||||
|
||||
previousPlayerState = previousPlayer.state
|
||||
LogInfo("Previous player state change:", previousPlayerState)
|
||||
|
||||
if previousPlayerState = "stopped" or previousPlayerState = "error" or previousPlayerState = "finished" or previousPlayerState = "none"
|
||||
previousPlayer.unobserveFieldScoped("state")
|
||||
|
||||
m.top.control = "play"
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVideoContentTaskErrorDialogResponse(event as object)
|
||||
dialog = event.getRoSGNode()
|
||||
dialog.unobserveFieldScoped("wasClosed")
|
||||
shouldPlayNext = dialog.actualButtonSelected = 0
|
||||
|
||||
if not shouldPlayNext or not VideoQueueUtils.PlayNext(m.videoQueue, m.invidious, m.preferences)
|
||||
m.videoQueue.closePlayer = true
|
||||
if m.top.isSameNode(m.videoQueue.player)
|
||||
m.videoQueue.closePlayer = true
|
||||
end if
|
||||
end if
|
||||
|
||||
Lounge.SendOnStateChange()
|
||||
@@ -183,7 +223,11 @@ function MarkVideoWatched(videoId as string)
|
||||
end if
|
||||
end function
|
||||
|
||||
function Close(_unused as dynamic)
|
||||
function OnClose()
|
||||
m.onCloseCalled = true
|
||||
|
||||
m.top.previousPlayer = invalid
|
||||
|
||||
if m.videoContentTask <> invalid
|
||||
m.videoContentTask.cancel = true
|
||||
m.videoContentTask = invalid
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
<field id="invidious" type="node" bind="../../Invidious" />
|
||||
<field id="webServer" type="node" bind="../../WebServer" />
|
||||
<field id="loungeService" type="node" bind="../../LoungeService" />
|
||||
<field id="previousPlayer" type="node" />
|
||||
<field id="minRect" type="rect2D" value="[834,460,426,240]" />
|
||||
<field id="maxRect" type="rect2D" value="[0,0,1280,720]" />
|
||||
<field id="chapter" type="string" alias="chapterLabel.text" />
|
||||
<field id="showFullScreenHint" type="boolean" alwaysNotify="true" onChange="OnShowFullScreenHint" />
|
||||
<field id="close" type="boolean" alwaysNotify="true" onChange="OnClose" />
|
||||
<function name="PlayWithContent" />
|
||||
<function name="Close" />
|
||||
</interface>
|
||||
<children>
|
||||
<Label id="chapterLabel" width="350" height="25" horizAlign="center" vertAlign="center" font="font:SmallestSystemFont" />
|
||||
|
||||
@@ -59,14 +59,16 @@ function OnVideoContentTaskResults(output as object) as void
|
||||
end if
|
||||
error = ErrorUtils.Format(error)
|
||||
LogError(error)
|
||||
Close(invalid)
|
||||
m.top.close = true
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.control = "play"
|
||||
end function
|
||||
|
||||
function Close(_unused as dynamic)
|
||||
function OnClose()
|
||||
m.top.previousPlayer = invalid
|
||||
|
||||
if m.videoContentTask <> invalid
|
||||
m.videoContentTask.cancel = true
|
||||
m.videoContentTask = invalid
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
<interface>
|
||||
<field id="videoQueue" type="node" bind="../../VideoQueue" />
|
||||
<field id="invidious" type="node" bind="../../Invidious" />
|
||||
<field id="previousPlayer" type="node" />
|
||||
<field id="close" type="boolean" alwaysNotify="true" onChange="OnClose" />
|
||||
<function name="PlayWithContent" />
|
||||
<function name="Close" />
|
||||
</interface>
|
||||
<children>
|
||||
<SimpleLabel
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
horizAlign="center"
|
||||
color="0x262626ff"
|
||||
text="Added to queue">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="22" />
|
||||
</Label>
|
||||
<Label
|
||||
id="line1Label"
|
||||
|
||||
@@ -88,8 +88,9 @@ function OnClosePlayer() as void
|
||||
return
|
||||
end if
|
||||
|
||||
player@.Close()
|
||||
player.close = true
|
||||
m.top.player = invalid
|
||||
m.previousPlayer = player
|
||||
|
||||
m.top.appController@.FocusTopScreen()
|
||||
end function
|
||||
@@ -365,6 +366,7 @@ function CreateVideoPlayer() as object
|
||||
container = m.top.videoContainer
|
||||
videoPlayer = container.createChild(playerComponent)
|
||||
videoPlayer.id = "VideoPlayer"
|
||||
videoPlayer.previousPlayer = m.previousPlayer
|
||||
videoPlayer@.BindNode()
|
||||
|
||||
if container.fullscreen
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import "pkg:/source/utils/CacheUtils.bs"
|
||||
|
||||
namespace Http
|
||||
|
||||
class CacheRouter extends HttpRouter
|
||||
|
||||
function new()
|
||||
super()
|
||||
end function
|
||||
|
||||
@delete("/api/cache")
|
||||
function ClearCache(context as object) as boolean
|
||||
response = context.response
|
||||
|
||||
CacheUtils.Clear()
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -1,5 +1,6 @@
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/BookmarksRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/CacheRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/DashRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/DialRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/HomeLayoutRouter.bs"
|
||||
@@ -50,6 +51,7 @@ function SetupRoutes(server as object)
|
||||
server.UseRouter(new Http.SearchHistoryRouter(server))
|
||||
server.UseRouter(new Http.PlayletLibUrlsRouter(server))
|
||||
server.UseRouter(new Http.DialRouter(server))
|
||||
server.UseRouter(new Http.CacheRouter())
|
||||
|
||||
etags = new Http.EtagUtils()
|
||||
server.UseRouter(new Http.HttpStaticFilesRouter("/", "libpkg:/www", etags, { staticFiles: true }))
|
||||
|
||||
@@ -207,6 +207,20 @@
|
||||
visibility: "web",
|
||||
svelteComponent: "PlayletLibVersionControl",
|
||||
},
|
||||
{
|
||||
displayText: "Clear cache",
|
||||
key: "dev.clear_cache",
|
||||
description: "Clear cache from cachefs: and tmp:",
|
||||
visibility: "web",
|
||||
svelteComponent: "ClearCacheControl",
|
||||
},
|
||||
{
|
||||
displayText: "Clear cache",
|
||||
key: "dev.clear_cache",
|
||||
description: "Clear cache from cachefs: and tmp:",
|
||||
visibility: "tv",
|
||||
rokuComponent: "ClearCacheControl",
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -1256,5 +1256,17 @@
|
||||
<source>Rating</source>
|
||||
<translation>Rating</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear cache</source>
|
||||
<translation>Clear cache</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear cache from cachefs: and tmp:</source>
|
||||
<translation>Clear cache from cachefs: and tmp:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cache cleared.</source>
|
||||
<translation>Cache cleared.</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
@@ -3,7 +3,7 @@ title=PlayletLib
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=23
|
||||
build_version=00005
|
||||
build_version=00006
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
|
||||
@@ -739,7 +739,7 @@ namespace HttpClientCache
|
||||
|
||||
cacheLocation = GetLocation(request)
|
||||
cacheText = ReadAsciiFile(cacheLocation)
|
||||
if cacheText = invalid
|
||||
if cacheText = ""
|
||||
return invalid
|
||||
end if
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
|
||||
namespace CacheUtils
|
||||
|
||||
function Clear()
|
||||
AsyncTask.Start(Tasks.ClearCacheTask, invalid)
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -0,0 +1,33 @@
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
|
||||
@asynctask
|
||||
function ClearCacheTask() as object
|
||||
fs = CreateObject("roFileSystem")
|
||||
if fs = invalid
|
||||
LogError("Failed to create roFileSystem object")
|
||||
return invalid
|
||||
end if
|
||||
|
||||
ClearVolume(fs, "tmp:/")
|
||||
ClearVolume(fs, "cachefs:/")
|
||||
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function ClearVolume(fs as object, volume as string)
|
||||
items = fs.GetDirectoryListing(volume)
|
||||
for each item in items
|
||||
fullpath = volume + item
|
||||
|
||||
' Skip logs directory
|
||||
if fullpath = "cachefs:/logs"
|
||||
continue for
|
||||
end if
|
||||
|
||||
if not fs.Delete(fullpath)
|
||||
LogError("Failed to delete:", fullpath)
|
||||
end if
|
||||
end for
|
||||
|
||||
LogInfo("Cleared:", volume)
|
||||
end function
|
||||
@@ -283,6 +283,9 @@ namespace Locale
|
||||
UseDevVideoPlayerDescription = "Enable the dev video player. This is an unfinished video player for testing purposes."
|
||||
PlayletLibraryVersion = "Playlet Library version"
|
||||
PlayletLibraryVersionDescription = "The version of Playlet Lib to use. These correspond to tagged releases on Github. Releases that do not have a playlet-lib.zip file are disabled."
|
||||
ClearCache = "Clear cache"
|
||||
ClearCacheDescription = "Clear cache from cachefs: and tmp:"
|
||||
CacheCleared = "Cache cleared."
|
||||
end enum
|
||||
|
||||
@locale
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-web",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^3.1.0",
|
||||
"@tailwindcss/typography": "^0.5.13",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.23.5",
|
||||
"version": "0.23.6",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -265,6 +265,15 @@ export class InvidiousApi {
|
||||
}
|
||||
}
|
||||
|
||||
public static clearCache() {
|
||||
for (let i = localStorage.length - 1; i >= 0; i--) {
|
||||
const key = localStorage.key(i);
|
||||
if (key && key.startsWith("v1:")) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO:P2 use more appropriate cache storage
|
||||
private getCache(url: string, cacheSeconds: number) {
|
||||
const cacheKey = this.getCacheKey(url);
|
||||
|
||||
@@ -132,6 +132,10 @@ export class PlayletApi {
|
||||
return await fetch(`${PlayletApi.host()}/api/search-history`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
static async clearCache() {
|
||||
return await fetch(`${PlayletApi.host()}/api/cache`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
static async getBookmarkFeeds() {
|
||||
const response = await fetch(`${PlayletApi.host()}/api/bookmarks/feeds`);
|
||||
return await response.json();
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr } from "lib/Stores";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
export let displayText: string = "";
|
||||
// svelte-ignore unused-export-let
|
||||
export let key: string = "";
|
||||
export let description: string = "";
|
||||
export let level: number = 0;
|
||||
|
||||
async function clearCache() {
|
||||
await PlayletApi.clearCache();
|
||||
InvidiousApi.clearCache();
|
||||
|
||||
alert(get(tr)("Cache cleared."));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<button class="btn m-1" on:click={clearCache}>{$tr("Clear cache")}</button>
|
||||
</div>
|
||||
@@ -7,6 +7,7 @@
|
||||
import StringControl from "lib/Screens/Settings/SettingControls/StringControl.svelte";
|
||||
import NumberControl from "./SettingControls/NumberControl.svelte";
|
||||
import { tr } from "lib/Stores";
|
||||
import ClearCacheControl from "./SettingControls/ClearCacheControl.svelte";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -30,6 +31,7 @@
|
||||
|
||||
const customComponents = {
|
||||
ClearSearchHistoryControl,
|
||||
ClearCacheControl,
|
||||
EditHomeScreenControl,
|
||||
PlayletLibVersionControl,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user