Skip to content

Commit

Permalink
mark purchase history as private to prevent flooding clients w/ garba…
Browse files Browse the repository at this point in the history
…ge information (fixes #57)
  • Loading branch information
fluxionary committed Jul 8, 2023
1 parent 224679b commit a06df14
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/shop_class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ function shop_class:log_purchase(player, i, mechanic)
end

self.meta:set_string("purchase_history", minetest.serialize(history))
self.meta:mark_as_private("purchase_history")
end

--------------------
Expand Down
11 changes: 11 additions & 0 deletions compat/old_smartshops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,14 @@ if smartshop.settings.enable_refund then
end,
})
end

-- we forgot to mark purchase history as private originally, so go through old shops and fix that
minetest.register_lbm({
name = "smartshop:privatise_purchase_history",
nodenames = { "group:smartshop" },
run_at_every_load = false,
action = function(pos, node)
local shop = api.get_object(pos)
shop.meta:mark_as_private("purchase_history")
end,
})
3 changes: 2 additions & 1 deletion mod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ author = fluxionary
license = LGPL-3.0-or-later
media_license = CC-BY-SA-3.0
version = 2023-05-18
min_minetest_version = 5.6.1
min_minetest_version = 5.7.0
supported_games = *
depends = fmod, futil
optional_depends = currency, default, mesecons, mesecons_mvps, petz, node_entity_queue, pipeworks, tubelib

0 comments on commit a06df14

Please sign in to comment.