Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #36 from death-save:v1.2.0
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
eclarke12 authored Mar 18, 2021
2 parents 7d2ddb2 + 4414be2 commit ade5bae
Show file tree
Hide file tree
Showing 13 changed files with 528 additions and 94 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# From https://github.com/League-of-Foundry-Developers/FoundryVTT-Module-Template/blob/master/.github/workflows/main.yml
name: Release Creation

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

#Substitute the Manifest and Download URLs in the module.json
- name: Substitute Manifest and Download Links For Versioned Ones
id: sub_manifest_link_version
uses: microsoft/variable-substitution@v1
with:
files: 'module.json'
env:
version: ${{github.event.release.tag_name}}
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip

# create a zip file with all files required by the module to add to the release
- run: zip -r ./module.zip . [email protected]/zip-exclude.lst

# Create a release for this specific version
- name: Update Release with Files
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true # set this to false if you want to prevent updating existing releases
name: ${{ github.event.release.name }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json, ./module.zip'
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}

# Update the 'latest' release
- name: Create Release
id: create_latest_release
uses: ncipollo/release-action@v1
if: endsWith(github.ref, 'master')
with:
allowUpdates: true
name: Latest
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json,./module.zip'
tag: latest
body: ${{ github.event.release.body }}
12 changes: 12 additions & 0 deletions .github/zip-exclude.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
./dist/*
./out/*
./jsdoc/*
./node_modules/*
*.git*
*.vscode*
gulpfile.js
package.json
package-lock.json
jsdoc-conf.json
tsconfig.json
foundry.js
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Foundry
foundry.js
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://192.168.1.69:59999",
"pathMapping": {
"/modules/${workspaceFolderBasename}": "${workspaceFolder}"
}
}
]
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [1.2.0] - 2021-03-18
- Players can now create Notes on the scene/map! (🎉 thanks @ethaks for this awesome new feature! 🙌)
- - Note: in order to allow Players to create Notes they must have the `Create Journal Entry` permission in the core Foundry permissions. You'll also need to enable `Allow Player Notes` in module settings!
- *¡Aquí hay dragones!* Pin Cushion is now available *en Español* thanks to @lozalojo! 🎊
- When you delete a Note, the Pin Cushion preview is now cleared 🐛
- Fixed a bug that prevented Module settings from registering 🐛
- Added support for [🐛 Bug Reporter](https://github.com/League-of-Foundry-Developers/bug-reporter)

## [1.1.4] - 2020-11-03
### Added
- Confirmed compatibility with Foundry VTT 0.7.5
Expand Down
4 changes: 2 additions & 2 deletions about.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* About this module FormApp
* @extends FormApplication
*/
class PinCushionAboutApp extends FormApplication {
export default class PinCushionAboutApp extends FormApplication {
constructor(options={}) {
super(options);
}
Expand Down Expand Up @@ -44,4 +44,4 @@ class PinCushionAboutApp extends FormApplication {
const json = await response.json();
return json;
}
}
}
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"SETTINGS.AboutAppN": "About Pin Cushion",
"SETTINGS.AboutAppH": "Displays additional info about Pin Cushion",
"SETTINGS.AllowPlayerNotesN": "Allow Player Notes",
"SETTINGS.AllowPlayerNotesH": "Allows players to create map pins",
"SETTINGS.ShowJournalPreviewN": "Show Journal Preview",
"SETTINGS.ShowJournalPreviewH": "Shows a Journal preview when hovering over a map pin",
"SETTINGS.PreviewTypeN": "Journal Preview Type",
Expand All @@ -9,4 +11,4 @@
"SETTINGS.PreviewMaxLengthH": "**TEXT PREVIEW ONLY** How many characters should the text preview show?",
"SETTINGS.PreviewDelayN": "Preview Delay",
"SETTINGS.PreviewDelayH": "How long before preview appears (in milliseconds)"
}
}
17 changes: 17 additions & 0 deletions lang/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"I18N.LANGUAGE": "Español",
"I18N.MAINTAINERS": "@Viriato139ac#0342",

"SETTINGS.AboutAppN": "Acerca de Pin Cushion",
"SETTINGS.AboutAppH": "Muestra información adicional acerca de Pin Cushion",
"SETTINGS.AllowPlayerNotesN": "Permitir notas del jugador",
"SETTINGS.AllowPlayerNotesH": "Permite que los jugadores creen chinchetas en el mapa",
"SETTINGS.ShowJournalPreviewN": "Mostrar vista previa del diario",
"SETTINGS.ShowJournalPreviewH": "Cuando se pasa el ratón por encima de una chincheta en el mapa, se muestra una vista previa del diario",
"SETTINGS.PreviewTypeN": "Tipo de vista previa del diario",
"SETTINGS.PreviewTypeH": "El tipo de vista previa del diario que se mostrará (HTML o texto)",
"SETTINGS.PreviewMaxLengthN": "Longitud máxima de la vista previa",
"SETTINGS.PreviewMaxLengthH": "**SOLO VISTA PREVIA DE TEXTO** ¿Cuantos caracteres de texto se deben mostrar en la vista previa de texto?",
"SETTINGS.PreviewDelayN": "Retraso de la vista previa",
"SETTINGS.PreviewDelayH": "Cuanto tiempo (en milisegundos) ha de pasar hasta que se muestre la vista previa"
}
109 changes: 109 additions & 0 deletions lib-wrapper-shim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2021 fvtt-lib-wrapper Rui Pinheiro


'use strict';

// A shim for the libWrapper library
export let libWrapper = undefined;

Hooks.once('init', () => {
// Check if the real module is already loaded - if so, use it
if(globalThis.libWrapper && !(globalThis.libWrapper.is_fallback ?? true)) {
libWrapper = globalThis.libWrapper;
return;
}

// Fallback implementation
libWrapper = class {
static get is_fallback() { return true };

static register(module, target, fn, type="MIXED") {
const is_setter = target.endsWith('#set');
target = !is_setter ? target : target.slice(0, -4);
const split = target.split('.');
const fn_name = split.pop();
const root_nm = split.splice(0,1)[0];
const _eval = eval; // The browser doesn't expose all global variables (e.g. 'Game') inside globalThis, but it does to an eval. We copy it to a variable to have it run in global scope.
const obj = split.reduce((x,y)=>x[y], globalThis[root_nm] ?? _eval(root_nm));

let iObj = obj;
let descriptor = null;
while(iObj) {
descriptor = Object.getOwnPropertyDescriptor(iObj, fn_name);
if(descriptor) break;
iObj = Object.getPrototypeOf(iObj);
}
if(!descriptor) throw `libWrapper Shim: '${target}' does not exist or could not be found.`;

let original = null;
const wrapper = (type == 'OVERRIDE') ? function() { return fn.call(this, ...arguments); } : function() { return fn.call(this, original.bind(this), ...arguments); }

if(!is_setter) {
if(descriptor.value) {
original = descriptor.value;
descriptor.value = wrapper;
}
else {
original = descriptor.get;
descriptor.get = wrapper;
}
}
else {
if(!descriptor.set) throw `libWrapper Shim: '${target}' does not have a setter`;
original = descriptor.set;
descriptor.set = wrapper;
}

descriptor.configurable = true;
Object.defineProperty(obj, fn_name, descriptor);
}
}

//************** USER CUSTOMIZABLE:
// Whether to warn GM that the fallback is being used
const WARN_FALLBACK = true;

// Set up the ready hook that shows the "libWrapper not installed" warning dialog
if(WARN_FALLBACK) {
//************** USER CUSTOMIZABLE:
// Module ID - by default attempts to auto-detect, but you might want to hardcode your module ID here to avoid potential auto-detect issues
// const MODULE_ID = ((import.meta?.url ?? Error().stack)?.match(/(?<=\/)modules\/.+(?=\/)/i)??[])[0]?.split('/')?.find(n => n && game.modules.has(n));
const MODULE_ID = "pin-cushion";
if(!MODULE_ID) {
console.error("libWrapper Shim: Could not auto-detect module ID. The libWrapper fallback warning dialog will be disabled.");
return;
}

Hooks.once('ready', () => {
// Module title
const MODULE_TITLE = game.modules.get(MODULE_ID).data.title;

//************** USER CUSTOMIZABLE:
// Title and message for the dialog shown when the real libWrapper is not installed.
const FALLBACK_MESSAGE_TITLE = MODULE_TITLE;
const FALLBACK_MESSAGE = `
<p><b>'${MODULE_TITLE}' depends on the 'libWrapper' module, which is not present.</b></p>
<p>A fallback implementation will be used, which increases the chance of compatibility issues with other modules.</p>
<small><p>'libWrapper' is a library which provides module developers with a simple way to modify core Foundry VTT code, while reducing the likelihood of conflict with other modules.</p>
<p>You can install it from the "Add-on Modules" tab in the <a href="javascript:game.shutDown()">Foundry VTT Setup</a>, from the <a href="https://foundryvtt.com/packages/lib-wrapper">Foundry VTT package repository</a>, or from <a href="https://github.com/ruipin/fvtt-lib-wrapper/">libWrapper's Github page</a>.</p></small>
`;

// Settings key used for the "Don't remind me again" setting
const DONT_REMIND_AGAIN_KEY = "libwrapper-dont-remind-again";

// Dialog code
console.warn(`${MODULE_TITLE}: libWrapper not present, using fallback implementation.`);
game.settings.register(MODULE_ID, DONT_REMIND_AGAIN_KEY, { name: '', default: false, type: Boolean, scope: 'world', config: false });
if(game.user.isGM && !game.settings.get(MODULE_ID, DONT_REMIND_AGAIN_KEY)) {
new Dialog({
title: FALLBACK_MESSAGE_TITLE,
content: FALLBACK_MESSAGE, buttons: {
ok: { icon: '<i class="fas fa-check"></i>', label: 'Understood' },
dont_remind: { icon: '<i class="fas fa-times"></i>', label: "Don't remind me again", callback: () => game.settings.set(MODULE_ID, DONT_REMIND_AGAIN_KEY, true) }
}
}).render(true);
}
});
}
});
75 changes: 54 additions & 21 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,62 @@
{
"name": "pin-cushion",
"title": "Pin Cushion",
"description": "Adds additional map pin functionality",
"version": "1.1.4",
"description": "Adds additional map pin (Journal Note/Scene Note) functionality",
"version": "1.2.0",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9",
"author": "Evan Clarke [errational#2007]",
"authors": [
{
"name": "Evan Clarke",
"url": "https://patreon.com/deathsave",
"discord": "errational#2007",
"twitter": "@death_save_dev",
"reddit": "u/etherboy12"
}
],
"url": "https://github.com/death-save/pin-cushion",
"manifest": "https://raw.githubusercontent.com/death-save/pin-cushion/master/module.json",
"download": "https://github.com/death-save/pin-cushion/archive/master.zip",
"scripts": [
"./pin-cushion.js",
"./about.js"
"manifest": "https://github.com/death-save/pin-cushion/releases/latest/download/module.json",
"download": "https://github.com/death-save/pin-cushion/release/latest/download/module.zip",
"esmodules": [
"./pin-cushion.js",
"./about.js"
],
"socket": true,
"styles": [
"./pin-cushion.css"
],
"styles": ["./pin-cushion.css"],
"languages": [
{
"lang": "en",
"name": "English",
"path": "./lang/en.json"
},
{
"lang": "pt-BR",
"name": "Português (Brasil)",
"path": "./lang/pt-BR.json"
}
]
}
{
"lang": "en",
"name": "English",
"path": "./lang/en.json"
},
{
"lang": "pt-BR",
"name": "Português (Brasil)",
"path": "./lang/pt-BR.json"
},
{
"lang": "es",
"name": "Español",
"path": "./lang/es.json"
}
],
"media": [
{
"type": "screenshot",
"url": "https://github.com/death-save/media/raw/master/pin-cushion/create_pin.png"
},
{
"type": "screenshot",
"url": "https://github.com/death-save/media/raw/master/pin-cushion/note-config.png"
},
{
"type": "screenshot",
"url": "https://github.com/death-save/media/raw/master/pin-cushion/journal-preview.png"
}
],
"bugs": "https://github.com/death-save/pin-cushion/issues",
"allowBugReporter": true
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pin-cushion",
"version": "1.1.4",
"version": "1.2.0",
"description": "Provides additional functionality around Map Pins",
"main": "pin-cushion.js",
"scripts": {
Expand Down
Loading

0 comments on commit ade5bae

Please sign in to comment.