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_BROKER_URL=https://connect.owlbear.rodeo
|
||||||
REACT_APP_ICE_SERVERS_URL=https://test.owlbear.rodeo/iceservers
|
REACT_APP_ICE_SERVERS_URL=https://connect.owlbear.rodeo/iceservers
|
||||||
REACT_APP_STRIPE_API_KEY=pk_live_MJjzi5djj524Y7h3fL5PNh4e00a852XD51
|
REACT_APP_STRIPE_API_KEY=pk_live_MJjzi5djj524Y7h3fL5PNh4e00a852XD51
|
||||||
REACT_APP_STRIPE_URL=https://payment.owlbear.rodeo
|
REACT_APP_STRIPE_URL=https://payment.owlbear.rodeo
|
||||||
REACT_APP_VERSION=$npm_package_version
|
REACT_APP_VERSION=$npm_package_version
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<meta property="og:image" content="%PUBLIC_URL%/thumbnail.jpg" />
|
<meta property="og:image" content="%PUBLIC_URL%/thumbnail.jpg" />
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
<!-- Fathom -->
|
<!-- 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 -->
|
<!-- / Fathom -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -336,7 +336,7 @@ function MapFog({
|
|||||||
} else if (toolSettings.type === "toggle") {
|
} else if (toolSettings.type === "toggle") {
|
||||||
onShapesEdit(
|
onShapesEdit(
|
||||||
editingShapes.map((shape) => ({
|
editingShapes.map((shape) => ({
|
||||||
...shape,
|
id: shape.id,
|
||||||
visible: !shape.visible,
|
visible: !shape.visible,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
@ -185,6 +185,11 @@ export function TokenDataProvider({ children }) {
|
|||||||
[database, updateCache, userId]
|
[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 ownedTokens = tokens.filter((token) => token.owner === userId);
|
||||||
|
|
||||||
const tokensById = tokens.reduce((obj, token) => {
|
const tokensById = tokens.reduce((obj, token) => {
|
||||||
|
@ -280,6 +280,30 @@ function loadVersions(db) {
|
|||||||
state.editFlags = [...state.editFlags, "notes"];
|
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
|
// Get the dexie database used in DatabaseContext
|
||||||
|
@ -225,11 +225,16 @@ export function drawActionsToShapes(actions, actionIndex) {
|
|||||||
if (!action) {
|
if (!action) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (action.type === "add" || action.type === "edit") {
|
if (action.type === "add") {
|
||||||
for (let shape of action.shapes) {
|
for (let shape of action.shapes) {
|
||||||
shapesById[shape.id] = shape;
|
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") {
|
if (action.type === "remove") {
|
||||||
shapesById = omit(shapesById, action.shapeIds);
|
shapesById = omit(shapesById, action.shapeIds);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,9 @@ function NetworkedMapAndTokens({ session }) {
|
|||||||
isLoading,
|
isLoading,
|
||||||
} = useContext(MapLoadingContext);
|
} = useContext(MapLoadingContext);
|
||||||
|
|
||||||
const { putToken, getToken, updateToken } = useContext(TokenDataContext);
|
const { putToken, getToken, updateToken, getTokenFromDB } = useContext(
|
||||||
|
TokenDataContext
|
||||||
|
);
|
||||||
const {
|
const {
|
||||||
putMap,
|
putMap,
|
||||||
updateMap,
|
updateMap,
|
||||||
@ -329,7 +331,6 @@ function NetworkedMapAndTokens({ session }) {
|
|||||||
async function handlePeerData({ id, data, reply }) {
|
async function handlePeerData({ id, data, reply }) {
|
||||||
if (id === "mapRequest") {
|
if (id === "mapRequest") {
|
||||||
const map = await getMapFromDB(data);
|
const map = await getMapFromDB(data);
|
||||||
|
|
||||||
function replyWithMap(preview, resolution) {
|
function replyWithMap(preview, resolution) {
|
||||||
let response = {
|
let response = {
|
||||||
...map,
|
...map,
|
||||||
@ -393,19 +394,23 @@ function NetworkedMapAndTokens({ session }) {
|
|||||||
|
|
||||||
if (id === "mapResponse") {
|
if (id === "mapResponse") {
|
||||||
const newMap = data;
|
const newMap = data;
|
||||||
|
if (newMap?.id) {
|
||||||
setCurrentMap(newMap);
|
setCurrentMap(newMap);
|
||||||
await putMap(newMap);
|
await putMap(newMap);
|
||||||
|
}
|
||||||
assetLoadFinish();
|
assetLoadFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id === "tokenRequest") {
|
if (id === "tokenRequest") {
|
||||||
const token = getToken(data);
|
const token = await getTokenFromDB(data);
|
||||||
// Add a last used property for cache invalidation
|
// Add a last used property for cache invalidation
|
||||||
reply("tokenResponse", { ...token, lastUsed: Date.now() }, "token");
|
reply("tokenResponse", { ...token, lastUsed: Date.now() }, "token");
|
||||||
}
|
}
|
||||||
if (id === "tokenResponse") {
|
if (id === "tokenResponse") {
|
||||||
const newToken = data;
|
const newToken = data;
|
||||||
|
if (newToken?.id) {
|
||||||
await putToken(newToken);
|
await putToken(newToken);
|
||||||
|
}
|
||||||
assetLoadFinish();
|
assetLoadFinish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user