forked from Botanical/BotanJS
Added RespH Snippet
This commit is contained in:
parent
16f112485a
commit
5acc48289c
@ -6,7 +6,6 @@ RUN mkdir -p /opt/utils
|
||||
RUN apk add --update bash python3 uwsgi uwsgi-python openjdk11-jre-headless; python3 -m ensurepip
|
||||
|
||||
RUN echo "www-data:x:1001:1001:www-data:/var/www:/usr/sbin/nologin" >> /etc/passwd; echo "www-data:x:1001:" >> /etc/group
|
||||
RUN chown www-data:www-data . -R
|
||||
|
||||
RUN pip3 install Flask redis compressinja Celery
|
||||
|
||||
@ -14,10 +13,11 @@ ADD [ "https://github.com/tgckpg/BotanJS/releases/download/compressors/closure.j
|
||||
, "https://github.com/tgckpg/BotanJS/releases/download/compressors/yuicompressor.jar" \
|
||||
, "/opt/utils/" ]
|
||||
|
||||
RUN chmod 644 /opt/utils/*.jar
|
||||
|
||||
COPY . /app/
|
||||
|
||||
RUN chmod 644 /opt/utils/*.jar; \
|
||||
chown www-data:www-data . -R
|
||||
|
||||
USER www-data
|
||||
|
||||
EXPOSE 5000
|
||||
|
@ -65,13 +65,7 @@
|
||||
else
|
||||
{
|
||||
IDOMElement( stage ).setAttribute(new DataKey( "value", code ));
|
||||
|
||||
temp = stage.firstChild;
|
||||
temp.removeChild(temp.firstChild);
|
||||
stage.firstChild.appendChild(Dand.textNode( code ));
|
||||
|
||||
temp = stage;
|
||||
|
||||
}
|
||||
|
||||
i = { _code: code, _stage: temp };
|
||||
|
99
botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/RespH.js
Normal file
99
botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/RespH.js
Normal file
@ -0,0 +1,99 @@
|
||||
(function ()
|
||||
{
|
||||
var ns = __namespace( "Astro.Blog.AstroEdit.Visualizer.Snippet" );
|
||||
|
||||
/** @type {System.utils.IKey} */
|
||||
var IKey = __import( "System.utils.IKey" );
|
||||
/** @type {System.utils.DataKey} */
|
||||
var DataKey = __import( "System.utils.DataKey" );
|
||||
/** @type {Dandelion.IDOMElement} */
|
||||
var IDOMElement = __import( "Dandelion.IDOMElement" );
|
||||
/** @type {Dandelion} */
|
||||
var Dand = __import( "Dandelion" );
|
||||
/** @type {Components.MessageBox} */
|
||||
var MessageBox = __import( "Components.MessageBox" );
|
||||
|
||||
var escapeStr = ns[ NS_INVOKE ]( "escapeStr" );
|
||||
var unescapeStr = ns[ NS_INVOKE ]( "unescapeStr" );
|
||||
|
||||
var resph = function( insertSnippet, snippetWrap, createContext, override )
|
||||
{
|
||||
var temp, i, j
|
||||
|
||||
, handler = function ()
|
||||
{
|
||||
// Input fields
|
||||
var v_snippetInput = Dand.wrap( "textarea", null, "v_snippet_input" );
|
||||
|
||||
if ( this._stage )
|
||||
{
|
||||
v_snippetInput.value = this._code;
|
||||
}
|
||||
|
||||
// Popup MessageBox
|
||||
new MessageBox(
|
||||
"Insert Response Headers"
|
||||
, v_snippetInput
|
||||
, "OK", "Cancel"
|
||||
, visualizer.bind({ code: v_snippetInput, stage: this._stage })
|
||||
).show();
|
||||
}
|
||||
|
||||
, visualizer = function( submitted, override )
|
||||
{
|
||||
var code, stage = this.stage;
|
||||
|
||||
code = override ? unescapeStr( override.value ) : this.code.value;
|
||||
|
||||
if (submitted && code)
|
||||
{
|
||||
if (!stage)
|
||||
{
|
||||
// Visualize component
|
||||
temp = Dand.wrap(
|
||||
'span', null, "flsf"
|
||||
, "Response Headers"
|
||||
, [
|
||||
new DataKey( "value", code )
|
||||
, new IKey(
|
||||
"style", "background-color: #444; color: white; padding: 0.2em 0.5em;"
|
||||
)
|
||||
]
|
||||
);
|
||||
insertSnippet(j = snippetWrap( "RespH", temp, false, "span" ), Boolean(override));
|
||||
}
|
||||
else
|
||||
{
|
||||
IDOMElement( stage ).setAttribute(new DataKey( "value", code ));
|
||||
temp = stage;
|
||||
}
|
||||
|
||||
i = { _code: code, _stage: temp };
|
||||
|
||||
// Set context menu
|
||||
createContext( i, j, handler );
|
||||
}
|
||||
};
|
||||
|
||||
if ( override )
|
||||
{
|
||||
visualizer( true, override );
|
||||
override = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return handler;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
var compile = function (stage)
|
||||
{
|
||||
return "[resph]" + escapeStr( IDOMElement(stage).getDAttribute("value") ) + "[/resph]";
|
||||
};
|
||||
|
||||
__static_method( resph, "compile", compile );
|
||||
|
||||
ns[ NS_EXPORT ]( EX_CLASS, "RespH", resph );
|
||||
})();
|
@ -38,6 +38,7 @@
|
||||
, "SiteFile" , "background: royalblue;"
|
||||
, "Heading" , ""
|
||||
, "Footnote" , ""
|
||||
, "RespH" , ""
|
||||
, "Meta" , ""
|
||||
, "ArticleLink" , ""
|
||||
, "ArticleContent" , ""
|
||||
|
@ -26,7 +26,7 @@ spec:
|
||||
mountPath: "/app/cache"
|
||||
containers:
|
||||
- name: web
|
||||
image: registry.k8s.astropenguin.net/astrojs:2022.04.05.03
|
||||
image: registry.k8s.astropenguin.net/astrojs:2022.04.05.05
|
||||
securityContext:
|
||||
runAsGroup: 1001
|
||||
runAsNonRoot: true
|
||||
@ -50,7 +50,7 @@ spec:
|
||||
- name: redis
|
||||
image: redis:6.0.8-alpine
|
||||
- name: compiler
|
||||
image: registry.k8s.astropenguin.net/astrojs:2022.04.05.03
|
||||
image: registry.k8s.astropenguin.net/astrojs:2022.04.05.05
|
||||
securityContext:
|
||||
runAsGroup: 1001
|
||||
runAsNonRoot: true
|
||||
|
Loading…
Reference in New Issue
Block a user