This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
4,766 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_API_URL="http://localhost:8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_API_URL="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
}, | ||
|
||
'extends': [ | ||
'plugin:vue/vue3-essential', | ||
'eslint:recommended' | ||
], | ||
parserOptions: { | ||
parser: 'babel-eslint' | ||
}, | ||
rules: { | ||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-unused-vars': 'off', | ||
'no-empty': 'off', | ||
'vue/no-unused-components': 'off', | ||
'vue/no-deprecated-slot-attribute': 'off', //Webcomponents use slot attribute | ||
"no-unreachable":"off", | ||
"no-mixed-spaces-and-tabs": "off" | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Publish scriptor | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
name: Build | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
- name: Install Node.js, NPM and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Build usepython | ||
working-directory: ./src/usepython | ||
run: | | ||
npm install | ||
npm run build | ||
- name: install node modules | ||
run: npm install | ||
- name: zipping scriptor python module | ||
working-directory: ./src/assets | ||
run: python3 make.py | ||
- name: build scriptor | ||
run: npm run build | ||
- name: zipping scriptor build | ||
run: python3 make.py | ||
- name: Get version from tag | ||
id: tag_name | ||
run: | | ||
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} | ||
- name: Upload Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "source.zip" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Done | ||
run: echo 'Done' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@babel/preset-env' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="de" class="sl-theme-viur"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="robots" content="noindex,nofollow"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
|
||
<title>Scriptor v1.0</title> | ||
</head> | ||
<body> | ||
<noscript> | ||
<strong>We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | ||
</noscript> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
<!-- built files will be auto injected --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "esnext", | ||
"baseUrl": "./", | ||
"moduleResolution": "node", | ||
"paths": { | ||
"@/*": [ | ||
"src/*" | ||
] | ||
}, | ||
"lib": [ | ||
"esnext", | ||
"dom", | ||
"dom.iterable", | ||
"scripthost" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
import zipfile | ||
|
||
|
||
def zipdir(path, ziph): | ||
# ziph is zipfile handle | ||
for root, dirs, files in os.walk(path): | ||
for file in files: | ||
ziph.write(os.path.join(root, file), | ||
os.path.relpath(os.path.join(root, file), | ||
os.path.join(path, '..'))) | ||
|
||
|
||
with zipfile.ZipFile('source.zip', 'w', zipfile.ZIP_DEFLATED) as zipf: | ||
zipdir('../../deploy', zipf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"name": "stand-alone-scriptor", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"preinstall": "npm install ./src/usepython", | ||
"serve": "vue-cli-service serve", | ||
"lint": "vue-cli-service lint", | ||
"dev": "vite", | ||
"build": "vite build" | ||
}, | ||
"dependencies": { | ||
"@codemirror/commands": "^6.1.0", | ||
"@codemirror/lang-javascript": "^6.0.2", | ||
"@codemirror/lang-python": "^6.0.1", | ||
"@codemirror/language": "^6.2.1", | ||
"@codemirror/next": "^0.16.0", | ||
"@codemirror/theme-one-dark": "^6.1.0", | ||
"@codemirror/view": "^6.2.3", | ||
"@viur/viur-shoelace": "^2.0.0-beta.82-viur-11", | ||
"@viur/viur-vue-utils": "^0.5.9", | ||
"babel-eslint": "^10.1.0", | ||
"codemirror": "^6.0.1", | ||
"core-js": "^3.8.3", | ||
"pinia": "^2.0.23", | ||
"pyodide": "^0.21.2", | ||
"rollup-plugin-copy": "^3.4.0", | ||
"rollup-plugin-delete": "^2.0.0", | ||
"rollup-plugin-visualizer": "^5.8.3", | ||
"typescript-eslint": "^0.0.1-alpha.0", | ||
"usepython": "file:src/usepython", | ||
"vue": "^3.2.13", | ||
"vue-json-pretty": "^2.2.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.16", | ||
"@babel/eslint-parser": "^7.12.16", | ||
"@vitejs/plugin-vue": "^3.1.0", | ||
"@vue/cli-plugin-babel": "~5.0.0", | ||
"@vue/cli-service": "~5.0.0", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-vue": "^8.7.1", | ||
"raw-loader": "^4.0.2", | ||
"rollup-plugin-mv": "^0.0.2", | ||
"vite": "^3.1.4", | ||
"less": "^4.1.3" | ||
|
||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"env": { | ||
"node": true | ||
}, | ||
"extends": [ | ||
"plugin:vue/vue3-essential", | ||
"eslint:recommended" | ||
], | ||
"parserOptions": { | ||
"parser": "@babel/eslint-parser" | ||
}, | ||
"rules": {} | ||
}, | ||
"browserslist": [ | ||
"> 1%", | ||
"last 2 versions", | ||
"not dead", | ||
"not ie 11" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<template> | ||
|
||
<template v-if="isLoggedIn && !isLoading"> | ||
<Home></Home> | ||
</template> | ||
|
||
</template> | ||
|
||
<style lang="less"> | ||
@import "style/app.less"; | ||
</style> | ||
|
||
<script lang="ts"> | ||
import Home from './components/Home.vue' | ||
import {Request} from "@viur/viur-vue-utils"; | ||
import {ref, onBeforeMount, inject} from 'vue'; | ||
import {usePythonStore} from "./PythonStore"; | ||
import LoadingSpinner from "./components/common/LoadingSpinner.vue"; | ||
export default { | ||
name: 'App', | ||
components: { | ||
Home, | ||
LoadingSpinner | ||
}, | ||
setup(){ | ||
let isLoggedIn = ref<boolean>(false); | ||
let isLoading = ref<boolean>(true); | ||
const global = inject("global") | ||
let pythonStore = usePythonStore(); | ||
async function init() { | ||
isLoading.value = true; | ||
await pythonStore.py.load(); | ||
let baseUrl: string = ""; | ||
if (import.meta.env.VITE_API_URL) | ||
baseUrl = `${import.meta.env.VITE_API_URL}`; | ||
else | ||
baseUrl = `${window.location.origin}`; | ||
await pythonStore.py.run(` | ||
with open("config.py", "w") as f: | ||
f.write("BASE_URL='${baseUrl}'") | ||
`) | ||
const zipUrl = new URL('./assets/scriptor.zip', import.meta.url).href | ||
console.log("zipUrl:", zipUrl); | ||
// Loading scriptor library | ||
await pythonStore.py.run(` | ||
from pyodide.http import pyfetch | ||
response = await pyfetch("${zipUrl}") | ||
await response.unpack_archive() | ||
`) | ||
isLoading.value = false; | ||
} | ||
onBeforeMount(async () => { | ||
try { | ||
let resp = await Request.get("/vi/user/view/self"); | ||
let data = await resp.json(); | ||
isLoggedIn.value = true; | ||
global.user = data.values; | ||
await init(); | ||
} | ||
catch (error) { | ||
isLoggedIn.value = false; | ||
} | ||
}); | ||
return {isLoggedIn, isLoading} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineStore } from 'pinia' | ||
import { usePython} from "usepython"; | ||
|
||
export const usePythonStore = defineStore('python', () => { | ||
const py = usePython(); | ||
|
||
|
||
return { py } | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
import zipfile | ||
|
||
|
||
def zipdir(path, ziph): | ||
# ziph is zipfile handle | ||
for root, dirs, files in os.walk(path): | ||
for file in files: | ||
ziph.write(os.path.join(root, file), | ||
os.path.relpath(os.path.join(root, file), | ||
os.path.join(path, '..'))) | ||
|
||
|
||
with zipfile.ZipFile('scriptor.zip', 'w', zipfile.ZIP_DEFLATED) as zipf: | ||
zipdir('scriptor/', zipf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from .utils import get_json_object | ||
|
||
|
||
|
||
from .network import Request | ||
from .viur import viur | ||
from .writer import Writer | ||
from .csvwriter import CsvWriter | ||
from .logger import Logging as logging | ||
|
||
try: | ||
from js import console | ||
except ModuleNotFoundError: | ||
pass | ||
|
||
|
||
import json | ||
import copy | ||
|
||
def print(*args, **kwargs): | ||
console.log("my own print!") | ||
|
||
for arg in args: | ||
logging.info(arg) |
Oops, something went wrong.