Password-protected preferences or other solution?

My Reddit Videos channel returns links to videos submitted to reddit.  I'm guessing that some families might actually use the channel, and some of the links that are returned are nsfw.  I'm able to filter out those links if the user chooses to do so through DefaultPrefs, but I'm wondering what would stop someone from just changing back the value.  

 

I'm imagining a father taking off the nsfw option, and a young kid putting it back whenever he wants.

 

Maybe I need to put a password in for the channel in DefaultPrefs, and the only way to access the DefaultsPref is through a manual entry to match the password?

 

Not sure if that solution would work, but does anyone have any other ideas?

There's nothing in the framework that I know of that will allow you to do this.  What I've done for other channels (that I wanted to end up on the official channel store) is that I hard coded the family filter to being on (but left a simple way that people with a bit more knowledge can modify the channel to disable it if that's their preference).  I don't know of any other way to lock things down like that.

There's nothing in the framework that I know of that will allow you to do this.  What I've done for other channels (that I wanted to end up on the official channel store) is that I hard coded the family filter to being on (but left a simple way that people with a bit more knowledge can modify the channel to disable it if that's their preference).  I don't know of any other way to lock things down like that.

Pwd field in prefs, that must eq. "I fell dirty" to make it enabled.

And after watching a channel, reset it again following this doc:

https://forums.plex.tv/topic/87348-undocumented-functionality-and-tips-tricks/?p=506039

/T

This is the defaultspref
 
[
  {
        "id": "hide_nsfw",
        "type": "bool",
        "label": "Hide nsfw (not safe for work) videos?",
        "default": "false"
  },
  {
        "id": "show_domains",
        "type": "bool",
        "label": "Show the Domains menu?",
        "default": "true"
  },
  {
        "id": "channel_password",
        "label": "Set your password for changing channel preferences.",
        "type": "text",
        "option": "hidden",
        "default": " ",
        "secure": "true"
  }
 
]
 
in my top menu I have this:
# Preferences (This should only show until a new password has been set)
    Log('Starting the channel and the password should be')
    Log(Prefs['channel_password'])
    if Prefs['channel_password'] == " ":
        oc.add(PrefsObject
            (title='Change channel settings'))
 
    # Enter password for preferences (This should show once the default password has been changed)
    if Prefs['channel_password'] != " ":
        oc.add(InputDirectoryObject
            (key=Callback(verify_prefs_password),
             title='Change settings',
             summary='You need to enter a password to change the settings for this channel.',
             prompt="Enter the channel's password."))
 
And here's the function
 
 
def verify_prefs_password(query):
    if query == Prefs['channel_password']:
        Log('1. The query matched the prefs password with')
        Log(Prefs['channel_password'])
        oc = ObjectContainer()
        oc.add(PrefsObject(title='Change channel settings'))
#
# The problem seems to be right here.  The PrefsObject shows up again, but when I put in a new password, the log shows
# the same old password from before.  
        return oc
    elif Prefs['channel_password'] == " ":
        Log('2. The channel password is set to the default with')
        Log(Prefs['channel_password'])
        return ObjectContainer(header="Channel Settings",
                               message="You need to set a password in the channel preferences.")
    else:
        Log('3. The channel password and the query did not match')
        Log(Prefs['channel_password'])
        Log(query)
        return ObjectContainer(header="Channel Settings",
                               message="You entered the wrong password for changing channel settings.")

Pwd field in prefs, that must eq. "I fell dirty" to make it enabled.

And after watching a channel, reset it again following this doc:

https://forums.plex.tv/topic/87348-undocumented-functionality-and-tips-tricks/?p=506039

/T

Looking at this function, it seems I could use this to set my preferences, but why isn't my new defaultspref object that's raised when the query from an input directory menu matches the channel's password setting a new password?  From my logs I can see it's just returning the same old channel password.

@route(PREFIX + '/ResetValidExtensions')

def ResetValidExtensions():

   myHTTPPrefix = 'http://localhost:32400/:/plugins/com.plexapp.plugins.findUnmatch/prefs/'

   myURL = myHTTPPrefix + 'set?RESET=0'

   Log.Debug('Prefs Sending : ' + myURL)

   HTTP.Request(myURL, immediate=True)

   myURL = myHTTPPrefix + 'set?COOL_STUFF=Barkley is the coolest'

   Log.Debug('Prefs Sending : ' + myURL)

   HTTP.Request(myURL, immediate=True)

Not sure you can trap stuff from the Prefs Object, but you could put that into a function named ValidatePrefs(), that is called by the framework when saving new prefs

/T

Not sure you can trap stuff from the Prefs Object, but you could put that into a function named ValidatePrefs(), that is called by the framework when saving new prefs

/T

I'm trying your way, just the weird thing is when the DefaultsPref object is raised by the query matching the pref's password, the other changes to the preferences object do get saved.  I have an option to turn off one menu item, called domains.  If I change that, it actually does disappear and reappear based on the setting.  If I change the password, it never gets reset.  I even tried taking off the secure flag and that didn't help for the password field.

I'm thinking that only the booleans register.  I couldn't get the other method with http requests to work because it said I can't access the server internally.

I could use the dictionary to store a password, but even if that's not secure, I'd have no idea how a user could reset it without my help.

it said I can't access the server internally.

Add this to your info.plist

    PlexPluginCodePolicy
    Elevated

/Tommy

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.