casdoor 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yaml +30 -0
- package/README.md +6 -3
- package/package.json +1 -1
- package/src/match.js +4 -2
|
@@ -26,3 +26,33 @@ jobs:
|
|
|
26
26
|
run: yarn semantic-release
|
|
27
27
|
env:
|
|
28
28
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
+
- name: Package
|
|
30
|
+
id: package
|
|
31
|
+
if: github.event_name == 'push' && github.repository == 'casdoor/casdoor-chrome-extension'
|
|
32
|
+
run: |
|
|
33
|
+
tag=$(git tag --points-at HEAD | grep '^v' | head -n 1)
|
|
34
|
+
if [ -z "$tag" ]; then
|
|
35
|
+
echo "No new release, nothing to package"
|
|
36
|
+
exit 0
|
|
37
|
+
fi
|
|
38
|
+
# the version only lives in the tag, it is written into the manifest here and not committed
|
|
39
|
+
node -e 'const fs = require("fs"); const m = JSON.parse(fs.readFileSync("manifest.json")); m.version = process.argv[1]; fs.writeFileSync("manifest.json", JSON.stringify(m, null, 2) + "\n")' "${tag#v}"
|
|
40
|
+
zip -r casdoor-extension.zip manifest.json src images
|
|
41
|
+
gh release upload "$tag" casdoor-extension.zip --clobber
|
|
42
|
+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
|
43
|
+
env:
|
|
44
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
45
|
+
- name: Publish to the Chrome Web Store
|
|
46
|
+
if: steps.package.outputs.tag != ''
|
|
47
|
+
run: |
|
|
48
|
+
if [ -z "$CLIENT_ID" ] || [ -z "$CLIENT_SECRET" ] || [ -z "$REFRESH_TOKEN" ] || [ -z "$PUBLISHER_ID" ]; then
|
|
49
|
+
echo "::warning::The Chrome Web Store secrets are not set, ${{ steps.package.outputs.tag }} is only attached to the GitHub release"
|
|
50
|
+
exit 0
|
|
51
|
+
fi
|
|
52
|
+
npx --yes chrome-webstore-upload-cli@4.0.2 --source casdoor-extension.zip
|
|
53
|
+
env:
|
|
54
|
+
EXTENSION_ID: bnjbegmkpjbcpneclidlbloadenondlm
|
|
55
|
+
PUBLISHER_ID: ${{ secrets.CHROME_PUBLISHER_ID }}
|
|
56
|
+
CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
|
|
57
|
+
CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
|
|
58
|
+
REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
|
package/README.md
CHANGED
|
@@ -18,11 +18,14 @@ Casdoor only hands an account out for a page of the system's own sign-in URLs, r
|
|
|
18
18
|
|
|
19
19
|
### Install the extension
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
Install it from the [Chrome Web Store](https://chromewebstore.google.com/detail/casdoor-browser-plugin/bnjbegmkpjbcpneclidlbloadenondlm). It also works in Edge and other Chromium browsers that allow extensions from the Chrome Web Store.
|
|
22
|
+
|
|
23
|
+
Where the store can't be reached, download `casdoor-extension.zip` from the [latest release](https://github.com/casdoor/casdoor-chrome-extension/releases/latest), unzip it, go to `chrome://extensions`, turn on **Developer mode** in the top right, click **Load unpacked** and choose the unzipped folder.
|
|
24
|
+
|
|
25
|
+
Each release is published to the Chrome Web Store and attached to the GitHub release by `.github/workflows/release.yaml`, with the version of the release written into `manifest.json`. The store can take a few days to review a new version.
|
|
23
26
|
|
|
24
27
|
### Sign in to Casdoor
|
|
25
28
|
|
|
26
29
|
1. Open the extension, enter the Casdoor URL and the name of the application to sign in with.
|
|
27
|
-
2. Add the address shown at the bottom of the extension (`https://<extension id>.chromiumapp.org/`) to the redirect URLs of that application, and allow the `token` grant type in it.
|
|
30
|
+
2. Add the address shown at the bottom of the extension (`https://<extension id>.chromiumapp.org/`) to the redirect URLs of that application, and allow the `token` grant type in it. The extension installed from the Chrome Web Store always has the address `https://bnjbegmkpjbcpneclidlbloadenondlm.chromiumapp.org/`, so it can be added once for everyone; an unpacked one gets its own.
|
|
28
31
|
3. Click **Sign in to Casdoor**. The extension then lists the systems it fills for you.
|
package/package.json
CHANGED
package/src/match.js
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
|
|
15
15
|
// The sign-in page patterns of form autofill, matched the same way as Casdoor matches them (object/form_fill.go):
|
|
16
|
-
// the host has to be the same, "*.example.com" covers the subdomains,
|
|
16
|
+
// the host has to be the same, "*.example.com" covers the subdomains, a path without "*" is a prefix, and the part
|
|
17
|
+
// after "#" is compared only when the pattern has it.
|
|
17
18
|
|
|
18
19
|
function splitFormFillUrl(value) {
|
|
19
20
|
value = (value || "").trim();
|
|
@@ -66,7 +67,8 @@ function matchFormFillUrl(pattern, pageUrl) {
|
|
|
66
67
|
if (!matchFormFillHost(patternHost, pageHost)) {
|
|
67
68
|
return false;
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
// the fragment only counts when the pattern has one, like the "#/login" route of a single-page application
|
|
71
|
+
const pagePath = patternPath.includes("#") ? fullPagePath : fullPagePath.split("#")[0];
|
|
70
72
|
if (!patternPath.includes("*")) {
|
|
71
73
|
return pagePath.startsWith(patternPath);
|
|
72
74
|
}
|