SpigotMC / XenforoResourceManagerAPI

Exposes resource/author information via a simple JSON REST API
BSD 3-Clause "New" or "Revised" License
77 stars 6 forks source link

Ability to get a list of users that has purchased your resources #8

Open PeachesMLG opened 4 years ago

PeachesMLG commented 4 years ago

Ability to get a list of users that has purchased your resources

MrIvanPlays commented 4 years ago

I agree, but you would want to implement an api key for that.

File14 commented 4 years ago

+1. A personal API key is needed.

jacobsandersen commented 4 years ago

Already being considered but will need us to get API keys done first.

demengc commented 4 years ago

Add = Free cookies 🍪🍪🍪🍪🍪

Ty :)

DrOreo002 commented 4 years ago

+1

Andre601 commented 3 years ago

Maybe an alternative option would be to instead get a user through an action like getPurchases and it lists the purchased Resources? Not sure how this would be in terms of requiring an API key or similar...

For example, using https://api.spigotmc.org/simple/0.2/index.php?action=getPurchases&id=56829 would return a JSON response like this:

[
  {
    "id": "1277",
    "title": "DeluxeChat",
    "tag": "The original \"json\" chat formatting plugin",
    "current_version": "1.16.22",
    "native_minecraft_version": "",
    "supported_minecraft_versions": [
      "1.8"
      "1.9"
      "1.10"
      "1.11"
      "1.12"
      "1.13"
      "1.14"
      "1.15"
      "1.16"
    ],
    "icon_link": "https://www.spigotmc.org/data/resource_icons/1/1277.jpg?1544189049",
    "author": {
      "id": "1001",
      "username": "clip"
    },
    "premium":{
      "price": "7.50",
      "currency": "usd"
    },
    "stats": {
      "downloads": "6125",
      "updates": "87",
      "reviews": {
        "unique": "316",
        "total": "352"
      },
      "rating": "4.42722"
    },
    "description": "[CENTER][URL='https://helpch.at/discord'][IMG]https://helpch.at/banner.png#[/IMG][/URL]\n\n[IMG]https://i.imgur.com/7bYmA6G.png[/IMG]\n[IMG]https://i.imgur.com/lB4Q2HS.png[/IMG][IMG]https://i.imgur.com/Bz5bAZx.png[/IMG]\n[QUOTE]\nVideo Showcase by Koz4Christ can be found on [URL='https://www.youtube.com/watch?v=xqs8hptpFlc']YouTube[/URL][/QUOTE]\n\n[FONT=Verdana][SIZE=4][COLOR=#808080]Customize your chat with a powerful formatting system that allow you to add tooltip messages when you hover over different chat sections!\nNow includes bungee compatibility for cross server chat![/COLOR][/SIZE][/FONT][/CENTER]\n\n[CENTER][FONT=Verdana][SIZE=4][COLOR=#808080]DeluxeChat allows you to create endless customizable chat formats that add \"hover tooltips\" and also \"suggest/execute command on click\" to your chat![/COLOR][/SIZE][/FONT]\n\n[FONT=Verdana]\n[SIZE=3][COLOR=#404040][I]This plugin should be compatible with most chat spam+chat utility plugins but it will override your chat format to be displayed through the formats defined in the DeluxeChat config.yml. (This will override any essentials chat formats/chat channel plugins to display the DeluxeChat format)[/I]\n[I][B]DeluxeChat is made to handle all aspects of how your chat formatting looks.[/B][/I][/COLOR][/SIZE][/FONT]\n\n[URL='https://imgur.com/a/ry6Ib6B'][SIZE=4][U]Click here to see some examples of use from the community.[/U][/SIZE][/URL]\n[IMG]https://i.imgur.com/3ojQnnI.png[/IMG][/CENTER]\n[CODE]Command: /dchat\nDescription: View plugin version / info\nPermission: deluxechat.admin\n\nCommand: /dchat reload\nDescription: Reload DeluxeChat configuration\nPermission: deluxechat.admin\n\nCommand: /gtoggle\nDescription: Switch from global to local chat if bungee is enabled\nPermission: deluxechat.bungee.toggle\n\nCommand: /msg <player> <message>\nDescription: Send a player a private message\nAliases: [message, pm, tell]\nPermission: deluxechat.pm\n\nCommand: /reply <message>\nDescription: reply to a private message\nAliases: [r]\nPermission: deluxechat.pm\n\nCommand: /socialspy:\nDescription: spy on private messages\nAliases: [deluxesocialspy]\nPermission: deluxechat.socialspy\n[/CODE]\n\n[CENTER][IMG]https://i.imgur.com/hsaRfVf.png[/IMG]\n[FONT=Verdana]\n[SIZE=4][COLOR=rgb(64, 64, 64)][I]Chat formats are loaded from the config.yml and are tied to permission nodes.[/I]\n[I]To give a player/group a specific/custom chat format, you will need to give the player/group the permission \"chatformat.<yourFormatIdentifier>\".[/I]\n\n[I]If a player has multiple chat format permissions available, the chat format priority will determine what format should be active for the player/group.[/I][/COLOR][/SIZE]\n[COLOR=rgb(64, 64, 64)][I][SIZE=4]You can assign the priority of each chat format![/SIZE][/I][/COLOR][/FONT][/CENTER]\n\n[CENTER][FONT=Verdana][SIZE=4][I]If you have bungeecord enabled, players need permission to speak across servers! Give the player the permission [COLOR=rgb(179, 0, 0)][B]deluxechat.bungee.chat[/B][/COLOR] to allow them to chat across servers![/I][/SIZE][/FONT][/CENTER]\n\n[CENTER][FONT=Verdana][SIZE=4][COLOR=#808080]All formats require a special permission node for the format to be applied to a player/group: \n[/COLOR][/SIZE]\n[SIZE=5][COLOR=#404040]chatformat.<formatidentifier>\n[/COLOR][/SIZE]\n[SIZE=4][COLOR=#404040]The <formatIdentifier> is the key for the format section which you want to apply to the player[/COLOR][/SIZE][/FONT][/CENTER]\n\n[LEFT][CODE]\n    chatformat.default:\n        description: default chat format\n        default: true\n    deluxechat.color:\n        description: ability to use color codes in chat\n        default: op\n    deluxechat.formatting:\n        description: ability to use formatting codes in chat\n        default: op\n    deluxechat.utf:\n        description: ability to use special utf characters in chat\n        default: op\n    deluxechat.admin:\n        description: ability to use dchat commands\n        default: op\n    deluxechat.hidden:\n        description: ability to see hidden tooltip messages\n        default: op\n    deluxechat.filter.bypass:\n        description: ability to bypass the chat filter if enabled\n        default: op\n    deluxechat.url:\n        description: ability to send clickable links in chat\n        default: op[/LEFT]\n    deluxechat.pm.url:\n        description: ability to send clickable links in private messages\n        default: op\n[LEFT]    deluxechat.bungee.chat:\n        description: ability to chat globally if bungee is enabled\n        default: op\n    deluxechat.bungee.toggle:\n        description: ability to chat globally if bungee is enabled\n        default: op\n    deluxechat.bungee.override:\n        description: always send to all players when in global chat even if player is in server only chat\n        default: op\n    deluxechat.pm:\n        description: ability to use /msg and /reply to private message\n        default: op\n    deluxechat.socialspy:\n        description: ability to use /socialspy to see private conversations\n        default: op\n    deluxechat.socialspy.onjoin:\n        description: will toggle socialspy on for the player when they join the server\n        default: op\n[/CODE]\n[/LEFT]\n[CENTER][IMG]https://i.imgur.com/gyhCciy.png[/IMG][/CENTER]\n[LEFT][/LEFT]\n[CENTER][FONT=Verdana]All of your chat formats are loaded from the config.yml\n\nTo create a custom chat format just copy the default chat format section from the formats: section and paste it below default!\nHere is an example config![/FONT]\n[/CENTER]\n[SPOILER=\"DeluxeChat config.yml\"]\n[LEFT][CODE][/LEFT]\n# DeluxeChat version 1.5 config file\n# Created by extended:clip\n# list as many format sections you want under formats:\n# each format section requires a default template that should be modified and\n# also requires a unique number for the priority higher number = lower priority\n# ex: guest-100, owner-1\n#   YOU MUST KEEP A default TEMPLATE! It is used when players have no other template assigned!\n#\n# example format template:\n# formats:\n#   default:\n#     priority: 2147483647\n#     channel: ''\n#     prefix: '&8[&7Guest&8] '\n#     name_color: '&7'\n#     name: '%player%'\n#     suffix: '&7> '\n#     chat_color: '&f'\n#     channel_tooltip:\n#     - '&7%player% &bis a Guest'\n#     prefix_tooltip:\n#     - '&7%player% &bis a Guest'\n#     name_tooltip:\n#     - ''\n#     suffix_tooltip:\n#     - ''\n#     channel_click_command: '\n#     prefix_click_command: '/ranks\n#     name_click_command: '/msg %player%\n#     suffix_click_command: '\n#   Member:\n#     priority: 100\n#     channel: ''\n#     prefix: '&8[&aMember&8] '\n#     name_color: '&7'\n#     name: '%player%'\n#     suffix: '&7> '\n#     chat_color: '&f'\n#     channel_tooltip:\n#     - '&7%player% &bis a Member'\n#     prefix_tooltip:\n#     - '&7%player% &bis a Member'\n#     name_tooltip:\n#     - ''\n#     suffix_tooltip:\n#     - ''\n#     channel_click_command: '\n#     prefix_click_command: '/ranks\n#     name_click_command: '/msg %player%\n#     suffix_click_command: '\ncheck_updates: true\nbungeecord:\n  enabled: true\n  servername: '&8[&cTest&8]'\n  join_global: true\nrelation_placeholders_enabled: true\ntimestamp_format: MM/dd/yy HH:mm:ss\nops_use_group_format: false\nchat_filter:\n  enabled: false\n  list:\n  - '.; '\n  - fuck;fuck\nchat_url:\n  tooltip:\n  - '&7-=[&cClick to vist the site!&7]=-'\nformats:\n  default:\n    priority: 2147483647\n    channel: '%deluxetags_tag%'\n    prefix: ''\n    name_color: '%factions_relation_color%'\n    name: '&7%player_name%'\n    suffix: ' %vault_suffix% &7&l» '\n    chat_color: '&f'\n    channel_tooltip:\n    - '&c%player%s &7custom tag'\n    - '%deluxetags_description%'\n    prefix_tooltip: []\n    name_tooltip:\n    - '&7-=[&6✦&7]=-  &7-=[&e%player_name%&7]=-  &7-=[&6✦&7]=-'\n    - '&5Sent: &f%player_timestamp%'\n    - '&eStatus: &f%deluxestatus_status%'\n    - '&cCurrent rank: %ezrankslite_rankprefix%'\n    - '&cNext rank: %ezrankslite_nextrankprefix%'\n    - '&cRankup progress: %ezrankslite_progressbar%'\n    - '&cCurrent prestige: %ezprestige_prestigetag%'\n    - '&6Blocks broken&7: &f%ezblocks_broken% blocks'\n    - '&eEnchant Tokens&7: &f%tokenenchant_tokens%'\n    - '&aBalance&7: &a$&f%ezrankslite_balance%'\n    - '&aChatReaction wins&7: &f%chatreaction_wins%'\n    - '&bServer: &f%player_server%'\n    suffix_tooltip: []\n    channel_click_command: '[URL]http://www.spigotmc.org/resources/deluxetags.4390/'\n    prefix_click_command: '[EXECUTE]/ranks'\n    name_click_command: /ranks\n    suffix_click_command: ''\n[LEFT][/CODE][/LEFT]\n[/SPOILER]\n[URL='https://docs.google.com/document/d/1bMKAwuzDjLcJwNVUq6QKmepsk5nBflnvD77smCTy1R0/edit'] [/URL]\n[CENTER][FONT=Verdana][SIZE=4][COLOR=rgb(64, 64, 64)]DeluxeChat is also fully compatible with Towny. It will work alongside TownyChat so you can manage your chat channels within TownyChat and allow DeluxeChat to handle your chat formatting. If you would like To use TownyChat integration, there is only one requirement. In your Towny channels.yml you must add a new option to every channel - hooked: true[/COLOR][/SIZE][/FONT][/CENTER]\n[FONT=Verdana][COLOR=rgb(64, 64, 64)][SIZE=3]\n[CODE]    general:\n        commands: [g]\n        type: GLOBAL\n        channeltag: '&f[g]'\n        messagecolour: '&f'\n        permission: 'towny.chat.general'\n        craftIRCTag: 'admin'\n        range: '-1'\n        hooked: true[/CODE][/SIZE][/COLOR][/FONT]\n[CENTER][IMG]https://i.imgur.com/kKeWNxa.png[/IMG][/CENTER]\n[LEFT][/LEFT]\n[CENTER][FONT=Verdana]DeluxeChat 1.12.0 or higher uses any [URL='http://helpch.at/placeholders']placeholder provided by Placeholderapi[/URL]. \nYou must have [URL='https://www.spigotmc.org/resources/placeholderapi.6245/']PlaceholderAPI [/URL]installed on your server for DeluxeChat 1.12+ to work.[/FONT]\n\n[SPOILER=\"Pre 1.12.0 DeluxeChat\"][FONT=Verdana][SIZE=6][URL='https://www.spigotmc.org/wiki/deluxechat-placeholders/']Click for DeluxeChat pre 1.12.0 placeholders[/URL][/SIZE]\n\n[URL='http://www.spigotmc.org/resources/authors/maximvdw.6687/']Maximvdw [/URL]was kind enough to share all of his placeholders with his plugin MVdWPlaceholderAPI and they are available to use if you have purchased any of his plugins that have placeholders included in them.\n\nYou must have [B]one [/B]of the following plugins installed and the plugin [URL='https://www.spigotmc.org/resources/mvdwplaceholderapi.11182/']MVdWPlaceholderAPI [/URL]installed to use his placeholders:\n\n[URL='http://www.spigotmc.org/resources/tab.1448/']Tab[/URL]\n[URL='http://www.spigotmc.org/resources/actionbar.1458/']ActionBar[/URL]\n[URL='http://www.spigotmc.org/resources/titlemotdadvanced.1629/']TitleMotdAdvanced[/URL]\n[URL='http://www.spigotmc.org/resources/featherboard.2691/']FeatherBoard[/URL]\n[URL='http://www.spigotmc.org/resources/animatednames.2175/']AnimatedNames[/URL]\n[URL='http://www.spigotmc.org/resources/dynamicsigns.3566/']DynamicSigns[/URL][/FONT]\n\n[FONT=Verdana]To enable his placeholders, make sure you meet the requirements above, and simple enable the hook by setting:[/FONT]\n[IMG]http://i.imgur.com/DT0Jduz.png[/IMG]\n[FONT=Verdana]After this is done, you can begin using his placeholders with the following placeholder format:[/FONT]\n[CODE]%mvdw_<placeholder without brackets>%[/CODE]\n[FONT=Verdana]Example:[/FONT]\n[CODE]    prefix_tooltip:\n    - 'Maxims placeholders from MVdWPlaceholderAPI:'\n    - 'name: %mvdw_player%'\n    - 'Plugin count: %mvdw_pluginscount%'\n    - 'Ram: %mvdw_usedram% / %mvdw_freeram%'[/CODE]\n[FONT=Verdana][B][URL='http://www.spigotmc.org/wiki/mvdw-placeholders/']Click here for Maxims 2000+ placeholders[/URL][/B][/FONT]\n\n[FONT=Verdana][SIZE=5][COLOR=rgb(0, 89, 179)]If you are a developer and want to add placeholders to DeluxeChat, you can too via PlaceholderAPI Expansions![/COLOR][/SIZE][/FONT]\n[/SPOILER]\n\n[FONT=Verdana][COLOR=#ff0000][B]Check the version history/updates to see which version is compatible with older Spigot builds.[/B][/COLOR][/FONT]\n\n[FONT=Verdana][SIZE=4][COLOR=#808080]This plugin modifies chat completely to send tooltip messages and allow clickable chat format parts! There may be some incompatibility issues with other chat related plugins...\n\nIf you are using a plugin such as Factions, make sure all Factions chat config options are set to false or it will override DeluxeChat and you won't see your DeluxeChat formats when talking in chat![/COLOR][/SIZE]\n[/FONT][/CENTER]\n\n[CENTER][/CENTER]\n[LEFT][FONT=Verdana][SIZE=5][B]Legal Notice:[/B][/SIZE]\n[SIZE=4]This plugin utilizes the Fanciful library by Max Kreminski.\nFanciful is licensed under MIT, the Fanciful license can be found [/SIZE][/FONT][URL='https://github.com/mkremins/fanciful/blob/master/LICENSE'][FONT=Verdana][SIZE=4]Here[/SIZE][/FONT][/URL].[/LEFT]\n[CENTER][FONT=Verdana][IMG]https://i.imgur.com/9YInyYZ.png[/IMG][/FONT][/CENTER]"
  }
]

In the case of the user not having any purchased resources would this return an empty JSON array

jacobsandersen commented 3 years ago

@Andre601 This would be a breach of privacy. Whose API key would we check? The caller? What authority do they have to see someone else's purchases? Perhaps this would work for someone's OWN resources, but not somebody elses.

We would likely have a getPurchases route for looking up a resource, and requiring the resource author's API key.

But nonetheless, this is pending API keys which are far off in the distance.

YellowPhoenix18 commented 3 years ago

Is there anything new regarding the api-keys? This feature would make many things much easier. If you need additional help here Im also open to try to help.

jacobsandersen commented 3 years ago

We need a completely separate system for API keys to run on XenForo. I'm looking into it, but I have very limited time. It's basically going to boil down to writing a custom XenForo plugin which can then be audited by other PHP developers to make sure it is sufficiently secure, and then integrating it into this system at a later time.

YellowPhoenix18 commented 3 years ago

Hmm, I will take a look if I find time for that maybe after my exams. I have sadly never developed a plugin for xenforo, but I have 3years+ symfony experience and around 5 years php-experience, so it should not be such a hard bet

PeachesMLG commented 3 years ago

Ye this is something that like 99% of devs would want to verify users before giving support to them, so It would be really awesome if you could do this. I would help but unfortunately Im not that great with php :/

YellowPhoenix18 commented 2 years ago

@simpleauthority So Im looking currently into this again. What exactly was the plan regarding the xenforo-plugin?

I assume the idea was to add a section to everyones user-settings where they can create an api-key and can regenerate one. Those keys would get into their own table in the xenforo-database and could be read from it in this api.

The question regarding the key is also the length. I personally would recommend a uid(maybe the spigot userid) + access_key, which would give an additional security.

Is there any option where we could test those things? Basically we do not have a XenForo-License at the moment and Im unsure, if I would like to invest 160$ just to test those stuff here.

jacobsandersen commented 2 years ago

Yes, we need to make a plugin for XF 1.x that does what you described. The exact mechanism, I don't know. But you have the right idea.

And sorry, I don't have any recommendations for testing it. I bought XF for the sole purpose of creating this API out of my own pocket. I can't share my license, so I don't know another way. I will be looking into the plugin at some point but have had no time. I need to finish working on some other issues for this API first as well before considering the plugin.

YellowPhoenix18 commented 2 years ago

Its fine, it shouldn't be that problem, in the end we also profit from this api. Is the resource-addon which you can buy additionally for Xenforo the one, that spigot uses? Because for that part of the api we definitely need the databse-scheme between users(buyers) and the resource, so that the sql is correct.

But im open to create that Xenforo-plugin, that shouldn't be a problem at all. And this month I really have much time again, so if it isn't that hard to create one I expect to finish it within some days.

YellowPhoenix18 commented 2 years ago

@simpleauthority Dont want to push this - but can you maybe just confirm me if the "Resource Manager" is the correct addon and the same spigot is using?

If yes we will buy Xenforo now with the addon and begin creating the addon for the access-keys.

jacobsandersen commented 2 years ago

Sorry I am busy travelling internationally.

Yes the addon is called resource manager but we need an older version of XF because Spigot is running an older version. Can you try to coordinate with @md-5 for specifics? I got a greenlight from him before to create an addon, but it has been a significant amount of time since that conversation so it would be good if we can get another greenlight from him for you to work on it. Also likely would need to be in a new public repository namespaced under SpigotMC as well.

YellowPhoenix18 commented 2 years ago

Thank you, dont need to say sorry. Have fun travelling, its always nice to see the world.

I will then wait for md-5's answer to get the more detailed infos, really hope that we can bring some movement into this issue and can maybe finish it until the end of the month. Im sure this feature is really important for so many developers and will also open new doors when it comes to premium-resources.

md-5 commented 2 years ago

Yes, we use xenforo and xenforo resource manager 1.x (whatever the latest is)

YellowPhoenix18 commented 2 years ago

Perfect, anything else @md-5 which I might need to consider or can I just start through?

md-5 commented 2 years ago

I don't think so. The resource manager is irrelevant for the API-key piece

jacobsandersen commented 2 years ago

Home now so if you have questions you can ask me @YellowPhoenix18. And yes as md-5 said, for the api key plugin you shouldn't need to worry about the resource manager addon. It should just allow users to have api keys on their account. By default this will do absolutely nothing for them, as checking and validating the api key is for external programs to do. More or less the plugin should be CRD (create-read-delete) for api keys. I think by default we want all users to have an api key so they don't need to explicitly go create one, but that should be it. Once we have api keys built into spigot, then we can move forward on this issue

Danieljunek17 commented 1 year ago

this has the future tag but how is it going cause this would be to some importance to a lot of plugin sellers

jacobsandersen commented 1 year ago

Still need to get API keys done, but I do this entire project in my free time which is...well, almost nonexistent. Sorry it's taking so long - wish I had more hands and time.

Olzie-12 commented 1 year ago

bump

Andre601 commented 1 year ago

bump

Bumping this is a waste of time. Instead could you try and help getting this implemented.

Olzie-12 commented 1 year ago

bump

Bumping this is a waste of time. Instead could you try and help getting this implemented.

how so

jacobsandersen commented 1 year ago

Because I've already told you, it is in process and pending another project entirely. What do you want me to do? If you want it done, then pay me a salary. This is done in my free time. Be patient.

jacobsandersen commented 7 months ago

Progress has been made on the API keys. https://github.com/SpigotMC/XenforoApiKeys

If anyone knows PHP, feel free to perform a code review. If you are familiar with XenForo 1.x, even better. Once that is live on Spigot and people are able to have API keys, this may be able to be done.

jacobsandersen commented 4 months ago

Update: API keys are very close to being ready. Just so you know, this hasn't been forgotten!