Merge branch 'master' into release/v1.7.1
This commit is contained in:
commit
bda0aa9ebe
@ -1,5 +1,5 @@
|
||||
REACT_APP_BROKER_URL=https://test.owlbear.rodeo
|
||||
REACT_APP_ICE_SERVERS_URL=https://test.owlbear.rodeo/iceservers
|
||||
REACT_APP_BROKER_URL=https://connect.owlbear.rodeo
|
||||
REACT_APP_ICE_SERVERS_URL=https://connect.owlbear.rodeo/iceservers
|
||||
REACT_APP_STRIPE_API_KEY=pk_live_MJjzi5djj524Y7h3fL5PNh4e00a852XD51
|
||||
REACT_APP_STRIPE_URL=https://payment.owlbear.rodeo
|
||||
REACT_APP_VERSION=$npm_package_version
|
||||
|
@ -28,7 +28,7 @@
|
||||
<meta property="og:image" content="%PUBLIC_URL%/thumbnail.jpg" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<!-- Fathom -->
|
||||
<script src="https://cdn.usefathom.com/script.js" data-spa="auto" data-site="%REACT_APP_FATHOM_SITE_ID%" defer></script>
|
||||
<script src="https://angelfish.owlbear.rodeo/script.js" data-spa="auto" data-site="VMSHBPKD" data-excluded-domains="localhost" defer></script>
|
||||
<!-- / Fathom -->
|
||||
</head>
|
||||
<body>
|
||||
|
@ -336,7 +336,7 @@ function MapFog({
|
||||
} else if (toolSettings.type === "toggle") {
|
||||
onShapesEdit(
|
||||
editingShapes.map((shape) => ({
|
||||
...shape,
|
||||
id: shape.id,
|
||||
visible: !shape.visible,
|
||||
}))
|
||||
);
|
||||
|
@ -185,6 +185,11 @@ export function TokenDataProvider({ children }) {
|
||||
[database, updateCache, userId]
|
||||
);
|
||||
|
||||
async function getTokenFromDB(tokenId) {
|
||||
let token = await database.table("tokens").get(tokenId);
|
||||
return token;
|
||||
}
|
||||
|
||||
const ownedTokens = tokens.filter((token) => token.owner === userId);
|
||||
|
||||
const tokensById = tokens.reduce((obj, token) => {
|
||||
|
@ -280,6 +280,30 @@ function loadVersions(db) {
|
||||
state.editFlags = [...state.editFlags, "notes"];
|
||||
});
|
||||
});
|
||||
|
||||
// 1.7.0 (hotfix) - Optimized fog shape edits to only include needed data
|
||||
db.version(17)
|
||||
.stores({})
|
||||
.upgrade((tx) => {
|
||||
return tx
|
||||
.table("states")
|
||||
.toCollection()
|
||||
.modify((state) => {
|
||||
for (let i = 0; i < state.fogDrawActions.length; i++) {
|
||||
const action = state.fogDrawActions[i];
|
||||
if (action && action.type === "edit") {
|
||||
for (let j = 0; j < action.shapes.length; j++) {
|
||||
const shape = action.shapes[j];
|
||||
const temp = { ...shape };
|
||||
state.fogDrawActions[i].shapes[j] = {
|
||||
id: temp.id,
|
||||
visible: temp.visible,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Get the dexie database used in DatabaseContext
|
||||
|
@ -225,11 +225,16 @@ export function drawActionsToShapes(actions, actionIndex) {
|
||||
if (!action) {
|
||||
continue;
|
||||
}
|
||||
if (action.type === "add" || action.type === "edit") {
|
||||
if (action.type === "add") {
|
||||
for (let shape of action.shapes) {
|
||||
shapesById[shape.id] = shape;
|
||||
}
|
||||
}
|
||||
if (action.type === "edit") {
|
||||
for (let edit of action.shapes) {
|
||||
shapesById[edit.id] = { ...shapesById[edit.id], ...edit };
|
||||
}
|
||||
}
|
||||
if (action.type === "remove") {
|
||||
shapesById = omit(shapesById, action.shapeIds);
|
||||
}
|
||||
|
@ -35,7 +35,9 @@ function NetworkedMapAndTokens({ session }) {
|
||||
isLoading,
|
||||
} = useContext(MapLoadingContext);
|
||||
|
||||
const { putToken, getToken, updateToken } = useContext(TokenDataContext);
|
||||
const { putToken, getToken, updateToken, getTokenFromDB } = useContext(
|
||||
TokenDataContext
|
||||
);
|
||||
const {
|
||||
putMap,
|
||||
updateMap,
|
||||
@ -329,7 +331,6 @@ function NetworkedMapAndTokens({ session }) {
|
||||
async function handlePeerData({ id, data, reply }) {
|
||||
if (id === "mapRequest") {
|
||||
const map = await getMapFromDB(data);
|
||||
|
||||
function replyWithMap(preview, resolution) {
|
||||
let response = {
|
||||
...map,
|
||||
@ -393,19 +394,23 @@ function NetworkedMapAndTokens({ session }) {
|
||||
|
||||
if (id === "mapResponse") {
|
||||
const newMap = data;
|
||||
if (newMap?.id) {
|
||||
setCurrentMap(newMap);
|
||||
await putMap(newMap);
|
||||
}
|
||||
assetLoadFinish();
|
||||
}
|
||||
|
||||
if (id === "tokenRequest") {
|
||||
const token = getToken(data);
|
||||
const token = await getTokenFromDB(data);
|
||||
// Add a last used property for cache invalidation
|
||||
reply("tokenResponse", { ...token, lastUsed: Date.now() }, "token");
|
||||
}
|
||||
if (id === "tokenResponse") {
|
||||
const newToken = data;
|
||||
if (newToken?.id) {
|
||||
await putToken(newToken);
|
||||
}
|
||||
assetLoadFinish();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user