Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mynij
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mynij
mynij
Commits
81c0a67f
Commit
81c0a67f
authored
Sep 23, 2021
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_mynij_search: Validate source with a json schema before save it in indexeddb
parent
105d367d
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
2127 additions
and
26 deletions
+2127
-26
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_load_source_html.html
...em/web_page_module/gadget_erp5_page_load_source_html.html
+1
-0
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_load_source_html.xml
...tem/web_page_module/gadget_erp5_page_load_source_html.xml
+2
-2
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_load_source_js.js
...teItem/web_page_module/gadget_erp5_page_load_source_js.js
+27
-10
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_load_source_js.xml
...eItem/web_page_module/gadget_erp5_page_load_source_js.xml
+2
-2
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_mynij_search_js.js
...eItem/web_page_module/gadget_erp5_page_mynij_search_js.js
+0
-1
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_mynij_search_js.xml
...Item/web_page_module/gadget_erp5_page_mynij_search_js.xml
+2
-2
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_mynij_model.js.js
...PathTemplateItem/web_page_module/gadget_mynij_model.js.js
+35
-0
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_mynij_model.js.xml
...athTemplateItem/web_page_module/gadget_mynij_model.js.xml
+2
-2
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/tv4_json_validator_js.js
...PathTemplateItem/web_page_module/tv4_json_validator_js.js
+1686
-0
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/tv4_json_validator_js.xml
...athTemplateItem/web_page_module/tv4_json_validator_js.xml
+338
-0
bt5/erp5_web_mynij_search/SkinTemplateItem/portal_skins/erp5_mynij/WebSection_getMynijSearchPrecacheManifestList.py
...p5_mynij/WebSection_getMynijSearchPrecacheManifestList.py
+1
-0
bt5/erp5_web_mynij_search/SkinTemplateItem/portal_skins/erp5_mynij/action_mynij_search_import_export_index.html.html
...5_mynij/action_mynij_search_import_export_index.html.html
+1
-0
bt5/erp5_web_mynij_search/SkinTemplateItem/portal_skins/erp5_mynij/action_mynij_search_import_export_index.js.js
.../erp5_mynij/action_mynij_search_import_export_index.js.js
+27
-7
bt5/erp5_web_mynij_search/bt/template_keep_last_workflow_history_only_path_list
...rch/bt/template_keep_last_workflow_history_only_path_list
+1
-0
bt5/erp5_web_mynij_search/bt/template_keep_workflow_path_list
...erp5_web_mynij_search/bt/template_keep_workflow_path_list
+1
-0
bt5/erp5_web_mynij_search/bt/template_path_list
bt5/erp5_web_mynij_search/bt/template_path_list
+1
-0
No files found.
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_load_source_html.html
View file @
81c0a67f
...
...
@@ -4,6 +4,7 @@
<title>
Mynij Search
</title>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"tv4.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_page_load_source.js"
type=
"text/javascript"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"mynij-style.css"
>
</head>
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_load_source_html.xml
View file @
81c0a67f
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
994.4
2668.25925.43639
</string>
</value>
<value>
<string>
994.4
3649.32057.29422
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
163
1176409.26
</float>
<float>
163
2415203.4
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_load_source_js.js
View file @
81c0a67f
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80*/
/*global window, RSVP, rJS, document*/
/*global window, RSVP, rJS, document
, tv4
*/
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
var
gadget
;
rJS
(
window
)
.
setState
({
torrent_gadget
:
null
...
...
@@ -49,11 +50,9 @@
return
undefined
;
})
.
push
(
function
(
response
)
{
var
source_json
;
if
(
!
response
)
return
undefined
;
source_json
=
JSON
.
parse
(
response
.
target
.
responseText
);
return
source_json
;
return
response
.
target
.
responseText
;
});
})
...
...
@@ -61,18 +60,36 @@
var
gadget
=
this
,
doc
,
promise_list
=
[],
schema
,
i
;
return
gadget
.
loadSource
(
options
.
url
)
.
push
(
function
(
source_list
)
{
if
(
!
source_list
)
{
return
gadget
.
state
.
model_gadget
.
getSourceSchema
()
.
push
(
function
(
s
)
{
schema
=
s
;
return
gadget
.
loadSource
(
options
.
url
);
})
.
push
(
function
(
source_string
)
{
var
source_list
,
valid
=
false
,
a_json
=
true
,
message
=
"
Failed to download source file from specified url
"
;
try
{
source_list
=
JSON
.
parse
(
source_string
);
valid
=
tv4
.
validate
(
source_list
,
schema
);
}
catch
(
e
)
{
a_json
=
false
;
}
if
(
!
source_string
||
!
a_json
||
!
valid
)
{
if
(
!
a_json
||
!
valid
)
{
message
=
"
Downloaded file is not a valid JSON source!
"
;
}
return
gadget
.
notifySubmitted
({
message
:
"
Failed to download source file from specified url...
"
,
message
:
message
,
status
:
"
error
"
})
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
page
:
"
ojs_local_controller
"
page
:
"
mynij_search
"
}});
});
}
else
{
...
...
@@ -121,4 +138,4 @@
});
});
}(
window
,
document
,
rJS
,
RSVP
));
\ No newline at end of file
}(
window
,
document
,
rJS
,
RSVP
,
tv4
));
\ No newline at end of file
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_load_source_js.xml
View file @
81c0a67f
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
994.6
1267.64826.3932
1
</string>
</value>
<value>
<string>
994.6
4336.47707.6393
1
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
16324
01883.67
</float>
<float>
16324
17697.12
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_mynij_search_js.js
View file @
81c0a67f
...
...
@@ -92,7 +92,6 @@
for
(
elt
in
result_list
[
1
])
{
elt_dict
=
result_list
[
1
][
elt
];
if
(
!
elt_dict
.
status
||
elt_dict
.
status
===
"
not built
"
)
{
has_item
=
true
;
option
=
document
.
createElement
(
"
option
"
);
option
.
value
=
elt_dict
.
index_name
;
option
.
appendChild
(
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_erp5_page_mynij_search_js.xml
View file @
81c0a67f
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
994.6
3879.43990.45038
</string>
</value>
<value>
<string>
994.6
4069.60060.33621
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
163240
1634.98
</float>
<float>
163240
5414.19
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_mynij_model.js.js
View file @
81c0a67f
...
...
@@ -236,6 +236,41 @@
});
})
.
declareMethod
(
"
getSourceSchema
"
,
function
()
{
return
{
"
$schema
"
:
"
http://json-schema.org/draft-04/schema#
"
,
"
type
"
:
"
array
"
,
"
items
"
:
[
{
"
type
"
:
"
object
"
,
"
properties
"
:
{
"
title
"
:
{
"
type
"
:
"
string
"
},
"
description
"
:
{
"
type
"
:
"
string
"
},
"
links
"
:
{
"
type
"
:
"
string
"
},
"
infohash
"
:
{
"
type
"
:
"
string
"
},
"
namehash
"
:
{
"
type
"
:
"
string
"
}
},
"
additionalProperties
"
:
false
,
"
required
"
:
[
"
title
"
,
"
description
"
,
"
links
"
]
}
]
};
})
.
declareMethod
(
"
getConfig
"
,
function
()
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/gadget_mynij_model.js.xml
View file @
81c0a67f
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
994.
49367.10232.59852
</string>
</value>
<value>
<string>
994.
64287.12898.50995
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
163
1519569.02
</float>
<float>
163
2415269.6
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/tv4_json_validator_js.js
0 → 100644
View file @
81c0a67f
This diff is collapsed.
Click to expand it.
bt5/erp5_web_mynij_search/PathTemplateItem/web_page_module/tv4_json_validator_js.xml
0 → 100644
View file @
81c0a67f
This diff is collapsed.
Click to expand it.
bt5/erp5_web_mynij_search/SkinTemplateItem/portal_skins/erp5_mynij/WebSection_getMynijSearchPrecacheManifestList.py
View file @
81c0a67f
...
...
@@ -38,6 +38,7 @@ url_list = [
"rss-parser.min.js.map"
,
"webtorrent.min.js"
,
"jszip.min.js"
,
"tv4.js"
,
"mynij-config.json"
,
"gadget_erp5_mynij.json"
]
...
...
bt5/erp5_web_mynij_search/SkinTemplateItem/portal_skins/erp5_mynij/action_mynij_search_import_export_index.html.html
View file @
81c0a67f
...
...
@@ -8,6 +8,7 @@
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"flexsearch.js"
type=
"text/javascript"
></script>
<script
src=
"jszip.min.js"
type=
"text/javascript"
></script>
<script
src=
"tv4.js"
type=
"text/javascript"
></script>
<script
src=
"action_mynij_search_import_export_index.js"
type=
"text/javascript"
></script>
</head>
<body>
...
...
bt5/erp5_web_mynij_search/SkinTemplateItem/portal_skins/erp5_mynij/action_mynij_search_import_export_index.js.js
View file @
81c0a67f
(
function
(
window
,
rJS
,
RSVP
,
jIO
,
File
,
Blob
,
document
,
JSZip
)
{
(
function
(
window
,
rJS
,
RSVP
,
jIO
,
File
,
Blob
,
document
,
JSZip
,
tv4
)
{
"
use strict
"
;
rJS
(
window
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
...
...
@@ -212,19 +212,30 @@
})
.
declareMethod
(
"
importIndexCollection
"
,
function
(
dataurl
)
{
var
gadget
=
this
;
var
gadget
=
this
,
schema
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
state
.
model_gadget
.
getSourceSchema
()
.
push
(
function
(
s
)
{
schema
=
s
;
return
jIO
.
util
.
dataURItoBlob
(
dataurl
);
})
.
push
(
function
(
file_blob
)
{
return
jIO
.
util
.
readBlobAsText
(
file_blob
,
"
application/json
"
);
})
.
push
(
function
(
evt
)
{
var
index_list
=
JSON
.
parse
(
evt
.
target
.
result
)
,
var
index_list
,
promise_list
=
[],
valid
=
true
,
i
;
try
{
index_list
=
JSON
.
parse
(
evt
.
target
.
result
);
}
catch
(
e
)
{
valid
=
false
;
}
if
(
!
valid
||
!
tv4
.
validate
(
index_list
,
schema
))
{
return
false
;
}
for
(
i
=
0
;
i
<
index_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
gadget
.
state
.
model_gadget
.
createIndexDoc
(
index_list
[
i
]));
}
...
...
@@ -307,7 +318,16 @@
redirect
:
redirect
};
return
gadget
.
importIndexCollection
(
content_dict
.
index_file
.
url
)
.
push
(
function
()
{
.
push
(
function
(
result
)
{
if
(
!
result
)
{
return
{
notify
:
{
message
:
"
The JSON file is not a valid Mynij Source!
"
,
status
:
"
error
"
},
redirect
:
redirect
};
}
return
{
notify
:
{
message
:
"
Index definition imported.
"
,
...
...
@@ -389,4 +409,4 @@
});
});
}(
window
,
rJS
,
RSVP
,
jIO
,
File
,
Blob
,
document
,
JSZip
));
\ No newline at end of file
}(
window
,
rJS
,
RSVP
,
jIO
,
File
,
Blob
,
document
,
JSZip
,
tv4
));
\ No newline at end of file
bt5/erp5_web_mynij_search/bt/template_keep_last_workflow_history_only_path_list
View file @
81c0a67f
...
...
@@ -11,5 +11,6 @@ web_page_module/mynij-**
web_page_module/mynij_**
web_page_module/rss-parser.min.js.map
web_page_module/webtorrent_min_js
web_page_module/tv4_json_validator_js
web_site_module/mynij_search
web_site_module/mynij_search/**
\ No newline at end of file
bt5/erp5_web_mynij_search/bt/template_keep_workflow_path_list
View file @
81c0a67f
...
...
@@ -11,5 +11,6 @@ web_page_module/mynij-**
web_page_module/mynij_**
web_page_module/rss-parser.min.js.map
web_page_module/webtorrent_min_js
web_page_module/tv4_json_validator_js
web_site_module/mynij_search
web_site_module/mynij_search/**
\ No newline at end of file
bt5/erp5_web_mynij_search/bt/template_path_list
View file @
81c0a67f
...
...
@@ -10,6 +10,7 @@ web_page_module/jszip_min_js
web_page_module/mynij-**
web_page_module/mynij_**
web_page_module/rss-parser.min.js.map
web_page_module/tv4_json_validator_js
web_page_module/webtorrent_min_js
web_site_module/mynij_search
web_site_module/mynij_search/**
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment